修复服务方法描述等更新网关 gateway tool list 不更新的问题 - #187
Conversation
|
CLA Assistant Lite bot: I have read the CLA Document and I hereby sign the CLA xiangshen seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. |
|
@xiangshenb hi, please sign the cla, thx. |
There was a problem hiding this comment.
Pull request overview
此 PR 旨在修复“服务方法描述更新后,gateway tool list 不自动刷新、仍显示旧数据”的问题,通过在注册/更新链路中补齐 tool meta 信息,使网关侧的工具列表能正确同步刷新。
Changes:
- 在 MCP Server 首次注册到 Nacos 时,为每个 tool 初始化并上报
toolsMeta(默认启用)。 - 将
toolsMeta写入McpToolSpecification,确保网关 tool list 刷新所需的元信息完整。
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| for (McpTool tool : toolsToNacosList) { | ||
| McpToolMeta toolMeta = new McpToolMeta(); | ||
| toolMeta.setEnabled(true); // 默认启用所有工具 | ||
| this.toolsMeta.put(tool.getName(), toolMeta); | ||
| } | ||
| mcpToolSpec.setToolsMeta(this.toolsMeta); |
There was a problem hiding this comment.
Indentation in this new block uses spaces and does not match the surrounding file’s tab-based indentation. This can cause noisy diffs and may violate any configured formatter/checkstyle rules; please reformat these lines to be consistent with the rest of the file.
| for (McpTool tool : toolsToNacosList) { | |
| McpToolMeta toolMeta = new McpToolMeta(); | |
| toolMeta.setEnabled(true); // 默认启用所有工具 | |
| this.toolsMeta.put(tool.getName(), toolMeta); | |
| } | |
| mcpToolSpec.setToolsMeta(this.toolsMeta); | |
| for (McpTool tool : toolsToNacosList) { | |
| McpToolMeta toolMeta = new McpToolMeta(); | |
| toolMeta.setEnabled(true); // 默认启用所有工具 | |
| this.toolsMeta.put(tool.getName(), toolMeta); | |
| } | |
| mcpToolSpec.setToolsMeta(this.toolsMeta); |
Describe what this PR does / why we need it
修复服务方法描述更新后,网关工具列表不自动刷新的问题。
之前修改了服务方法描述,但网关的 tool list 仍然显示旧数据,导致用户看到信息不一致。
本次修改确保更新服务方法描述后,gateway tool list 会正确刷新。
Does this pull request fix one issue?
NONE
Describe how you did it
在服务方法更新逻辑中增加了 gateway tool list 的刷新调用。
保证每次修改服务方法描述后,相关缓存/列表会同步更新。
Describe how to verify it
Special notes for reviews
无特殊注意事项,修改仅影响服务方法描述更新逻辑和 gateway tool list 刷新