ViiVo / 开发者文档
能力参考画布与节点

读取画布

读取布局、画布版本和节点状态。编辑前用此接口取得最新 revision。

get_canvas

读取布局、画布版本和节点状态。编辑前用此接口取得最新 revision。

参数与调用

get_canvas读取数据

调试台中选择 get_canvas/minimal 示例。文档中的 ID 均为占位值,请替换成服务端返回的真实值。

验证范围:快照契约、MCP 响应与权限范围的自动化测试。 不包含真实付费生成的端到端验收。

参数说明

以下字段放入工具的 arguments 对象内。“必填”指所在对象内必填;可选对象省略时无需填写其内部字段。空值与省略的含义以该字段 Schema 为准。

project_idstring必填

项目的规范 ID,由管理员或当前项目上下文提供;调用身份仍需具备项目权限。

minLength: 1 · maxLength: 255 · pattern: "^(?!\\.{1,2}$)[^/\\\\?#%\\x00-\\x20\\x7f]+$"
canvas_idstring必填

项目内的画布 ID,从画布列表或当前画布上下文获取。

pattern: "^[a-zA-Z0-9_-]{1,64}$"
完整输入 JSON Schema(包含组合条件、枚举与引用)
{
  "properties": {
    "project_id": {
      "type": "string",
      "minLength": 1,
      "pattern": "^(?!\\.{1,2}$)[^/\\\\?#%\\x00-\\x20\\x7f]+$",
      "maxLength": 255,
      "description": "项目的规范 ID,由管理员或当前项目上下文提供;调用身份仍需具备项目权限。"
    },
    "canvas_id": {
      "type": "string",
      "pattern": "^[a-zA-Z0-9_-]{1,64}$",
      "description": "项目内的画布 ID,从画布列表或当前画布上下文获取。"
    }
  },
  "required": [
    "project_id",
    "canvas_id"
  ],
  "title": "get_canvasArguments",
  "type": "object",
  "additionalProperties": false
}

完整调用示例

get_canvas / minimal

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "get_canvas",
    "arguments": {
      "project_id": "01EXAMPLEPROJECT00000000000",
      "canvas_id": "default"
    }
  }
}

将示例保存为 request.json 后发送:

curl https://mcp.viivo.djagon.com/mcp/ \
  -H "Authorization: Bearer $MCP_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -H "MCP-Protocol-Version: 2025-06-18" \
  --data-binary @request.json

如何读取结果

先检查 HTTP 状态,再检查 JSON-RPC 的 error 与 result.isError。工具返回内容位于 result.content;如有结构化结果则同时查看 result.structuredContent。HTTP 200 不代表业务成功。

工具声明的输出 Schema
{
  "additionalProperties": true,
  "title": "get_canvasDictOutput",
  "type": "object"
}

具体处理见 结果与错误处理。

原始工具契约说明

Read current layout and node_states separately. Use layout.revision for edits. Runtime results and resources are authoritative presentation data, never a layout save payload. Pending resource identities remain in the read.

本页内容