调整mcp描述#70
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the documentation for the Model Context Protocol (MCP) interaction guide and the camera feature guide. It details the dynamic configuration of the visual analysis interface, refactors the MCP interaction guide to clarify message structures, schemas, and error handling, and replaces C++ registration examples with general JSON-based guidelines. The review feedback points out a broken Markdown anchor link in the camera feature guide, an inconsistency regarding the outer-layer session_id between the two documents, and a recommendation to unify the data type of the tools[].type field to simplify JSON deserialization in statically typed languages.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| ### 4. 视觉分析接口 | ||
|
|
||
| 设备端将捕获的图片发送到视觉分析接口(可通过mcp里面的capabilities获取url以及token): | ||
| 设备端将捕获的图片发送到视觉分析接口。接口地址和鉴权 token 由平台在 MCP 初始化阶段下发,请以 `initialize` 消息中的 `capabilities.vision.url` 和 `capabilities.vision.token` 为准,详见 [MCP 初始化能力字段](../mcp/hardware-mcp.md#步骤2初始化-mcp-会话)。 |
There was a problem hiding this comment.
在 hardware-mcp.md 中,对应的标题为 ### 步骤2:初始化 MCP 会话(冒号后包含一个空格)。在 GitHub Markdown 渲染时,全角冒号会被移除,而空格会被转换为连字符 -,因此生成的锚点为 #步骤2-初始化-mcp-会话。当前链接中缺失了 步骤2 和 初始化 之间的连字符,会导致点击链接时无法正确跳转。建议修改为:\n\n设备端将捕获的图片发送到视觉分析接口。接口地址和鉴权 token 由平台在 MCP 初始化阶段下发,请以 initialize消息中的capabilities.vision.url和capabilities.vision.token 为准,详见 [MCP 初始化能力字段](../mcp/hardware-mcp.md#步骤2-初始化-mcp-会话)。
| 注意事项: | ||
|
|
||
| - 当前协议只解析 `payload` 字段,不解析旧字段 `data`。 | ||
| - MCP 外层不携带 `session_id`。`session_id` 只会出现在平台返回的基础协议 `hello`、`stt`、`tts`、`llm` 等消息中。 |
| | `tools` | array | 是 | 工具列表。缺失或不是数组会导致本次 MCP 初始化失败 | | ||
| | `tools[].name` | string | 是 | 设备端原始工具名。为空会被跳过 | | ||
| | `tools[].description` | string | 否 | 工具说明,会提供给大模型理解工具用途 | | ||
| | `tools[].inputSchema` | object | 否 | JSON Schema。缺失时平台按 `{"type":"object"}` 处理 | |
| | `payload.method` | string | request/notification 必填 | 方法名,如 `initialize`、`tools/list`、`tools/call` | | ||
| | `payload.params` | object | request/notification 可选 | 方法参数 | | ||
| | `payload.result` | any | success response 必填 | 成功响应结果 | | ||
| | `payload.error` | object/string | error response 必填 | 失败响应错误信息 | |
There was a problem hiding this comment.
This table now says payload.error may be object/string, and the generic schema above shows error.code as a string placeholder. Because this page says MCP follows JSON-RPC 2.0, implementers copying this will produce invalid error responses: JSON-RPC errors must be an object with a numeric code and string message. Please keep the schema/table aligned with that shape so devices don't send errors the platform or standard JSON-RPC clients may reject.
调整mcp描述