Merged
[mirror] openJiuwen-ai/agent-protocol#90: fix(mcp): advertise tools capabilities by default #307
openjiuwen-syncAdd on Sep 15
[mirror] openJiuwen-ai/agent-protocol#90: fix(mcp): advertise tools capabilities by default #307
Merged
Pull Request has been successfully merged by openJiuwen-bot.
(Thank you for openjiuwen-sync's contribution.)Sep 15 Added label: github-mirror
Oopenjiuwen-sync
Sep 15 Associated issue: Server capabilities not advertised — MCP Inspector shows "no capabilities"
Sep 15 Associated issue: Server capabilities not advertised — MCP Inspector shows "no capabilities"
atomgit-bot
Sep 15 Comments:
Sep 15 Comments:
变更摘要
本 PR 修复 MCP 服务端能力(capabilities)通告问题:默认配置下 ServerConfig 的 capabilities 现在默认携带 tools 能力,使 MCP Inspector 等客户端默认启用 Tools 标签页;同时在 McpServerImplement 的 AddTool、AddPrompt、AddResource 注册接口中,若对应能力标志尚未设置,则自动补齐 tools/prompts/resources 能力标志,确保 Run() 将配置拷贝进会话时能力通告完整。
主要改动
ServerConfig.capabilities默认启用tools: 在MCP/cpp-sdk/include/mcp/mcp_type.h中,将ServerConfig.capabilities的默认初始化改为 lambda 构造的ServerCapabilities,默认设置caps.tools = ToolsCapabilities{},使默认配置即通告tools: {}能力。AddTool自动补齐tools能力标志: 在McpServerImplement::AddTool中,注册工具后若config_.capabilities.tools为空则赋值为ToolsCapabilities{},保证已注册工具时能力通告包含tools。AddPrompt自动补齐prompts能力标志: 在McpServerImplement::AddPrompt中,注册提示词后若config_.capabilities.prompts为空则赋值为PromptsCapabilities{}。AddResource自动补齐resources能力标志: 在McpServerImplement::AddResource中,注册资源后若config_.capabilities.resources为空则赋值为ResourcesCapabilities{}。


Incorrect?
Sep 15 Set YiyangShao,xinyu-jiuwen as approver
atomgit-bot
Sep 15 Comments:
Sep 15 Comments:
93 messages are collapsed here。 See more
Yiyang Shao
Oct 14 Comments:
Oct 14 Comments:
/lgtm
/approved


Oct 14 Added label: lgtm-YiyangShao
openJiuwen-bot
Oct 14 Comments:
Oct 14 Comments:
Oct 14 Merged pull request
Oct 14 Removed label: ci-successful
Paired: GitHub #90 ↔ GitCode !307
github_pr: 90
head_repo: Amiirhosseini/agent-protocol-1
head_ref: fix/2-accept-header-case-insensitive
head_sha: 52026476e17e05ef7a009bbc0916a2c335846b02
base_repo: openJiuwen-ai/agent-protocol
base_ref: develop
github_repo: openJiuwen-ai/agent-protocol
base_branch: develop
base_sha: 04e2dac5faa6bfd7259c5738d7a0bd21d75f0fab
github_user: Amiirhosseini
GitHub PR mirror for CodeArts CI.
Summary
tools: {}by default inServerConfig.capabilitiesso MCP Inspector enables the Tools tab.Add*, ensure the matching capability flag is set on the server config beforeRun()copies it into sessions.Fixes #64
Test plan
Linked Closing Issues: