-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
status:todoPlanned but not startedPlanned but not started
Description
🔍 发现的问题 / 原始需求描述
上游 opencode 已有较丰富的发现型控制面:/mcp、/experimental/resource、/experimental/tool、/experimental/tool/ids。这些能力对 agent orchestration、客户端 UI 自适应和调试都很有价值。但当前 opencode-a2a 只暴露了 provider/model discovery,没有把 MCP 资源、已注册 tools、资源目录这些可发现能力通过 A2A 公开出来。
🛠️ 详细实施方案 (必须包含涉及的文件路径和核心逻辑/伪代码)
- 先做 discovery-only 的只读扩展,避免一开始就把高风险控制接口全部开放。
涉及文件:
src/opencode_a2a/contracts/extensions.pysrc/opencode_a2a/server/agent_card.pydocs/guide.md
建议第一阶段只引入:
opencode.mcp.statusopencode.resources.listopencode.tools.idsopencode.tools.list
其中 opencode.tools.list 可接受 provider_id / model_id 参数。
- 在上游 client 中新增 discovery 调用。
涉及文件:
src/opencode_a2a/opencode_upstream_client.py
伪代码:
mcp_status() -> GET /mcp
list_resources() -> GET /experimental/resource
list_tool_ids() -> GET /experimental/tool/ids
list_tools(provider, model) -> GET /experimental/tool?provider=...&model=...
- JSON-RPC 层新增独立 handler,返回 provider-private 结果对象。
涉及文件:
src/opencode_a2a/jsonrpc/dispatch.pysrc/opencode_a2a/jsonrpc/handlers/mcp_discovery.py(new)src/opencode_a2a/jsonrpc/handlers/common.py
- 第二阶段再评估是否需要开放
mcp.add/connect/disconnect/auth*这类 mutating / auth-sensitive 方法。
建议本 issue 先不做写接口,只在设计说明中留出安全开关位。
🧪 回归测试建议
- 为 discovery handler 增加成功、参数错误、上游 500、payload mismatch 测试。
- 为 Agent Card / extension params 增加方法声明与结果字段测试。
- 单独验证
opencode.tools.list的 provider/model 参数透传。 - 运行
./scripts/doctor.sh。
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
status:todoPlanned but not startedPlanned but not started