Skip to content

修复服务方法描述等更新网关 gateway tool list 不更新的问题 - #187

Open
xiangshenb wants to merge 1 commit into
spring-ai-alibaba:mainfrom
xiangshenb:fix-gateway-update
Open

修复服务方法描述等更新网关 gateway tool list 不更新的问题#187
xiangshenb wants to merge 1 commit into
spring-ai-alibaba:mainfrom
xiangshenb:fix-gateway-update

Conversation

@xiangshenb

Copy link
Copy Markdown

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

  1. 修改某个服务方法的描述
  2. 查看 gateway tool list 是否立即更新显示最新描述,mcp gateway 无需重启
  3. 确认旧描述不再显示,且列表功能正常

Special notes for reviews

无特殊注意事项,修改仅影响服务方法描述更新逻辑和 gateway tool list 刷新

@github-actions

github-actions Bot commented Mar 2, 2026

Copy link
Copy Markdown

CLA Assistant Lite bot:
Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


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.
You can retrigger this bot by commenting recheck in this Pull Request

@guanxuc

guanxuc commented Mar 13, 2026

Copy link
Copy Markdown
Collaborator

@xiangshenb hi, please sign the cla, thx.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +172 to +177
for (McpTool tool : toolsToNacosList) {
McpToolMeta toolMeta = new McpToolMeta();
toolMeta.setEnabled(true); // 默认启用所有工具
this.toolsMeta.put(tool.getName(), toolMeta);
}
mcpToolSpec.setToolsMeta(this.toolsMeta);

Copilot AI Mar 26, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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);

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants