Allow dynamic generation of tool definition in MCP Server
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 45/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- java
调研方向
首先跟踪启动期间调用 ToolCallbackProvider.getToolCallbacks 的位置,以及 MCP 服务器处理 tools/list 请求的位置。添加所请求的 flag,使 tools/list 可以选择使用缓存的回调,或再次获取这些回调,然后使用现有的服务器测试验证 flag 的两种设置和动态工具定义。
由索引模型根据 Issue 内容生成。
描述
Please do a quick search on GitHub issues first, the feature you are about to request might have already been requested.
Expected Behavior
Add a boolean property/flag called "callGetToolCallbacksEverytime".
If the flag is set to true then everytime an MCP server receives a tools/list request, the MCP server should call getToolCallbacks on registered ToolCallbackProvider. This will allow an MCP Server's implementation to dynamically generate ToolDefinition based on the request. All the implementation will need to do is provide a custom ToolCallbackProvider and also set the flag to true. If the flag is set to "false" then the current behaviour of calling getToolCallbacks only during startup is used.
Current Behavior
In the current behavior, i configured a custom ToolCallbackProvider to override the "description" that is generated for my tool. However, my tool callback provider's "getToolCallbacks" method is only called once during application startup. When my MCP Client sends a "tools/list" request, the MCP Server returns the tool definitions it computed at application startup. It doesn't try to get the new list from ToolCallbackProvider.
In the current behavior, getToolCallbacks is called on a ToolCallbackProvider only at startup. This makes it impossible to generate tool definition dynamically i.e. when "tools/list" request is received.
Context
My use case requires me to generate tool description dynamically based on the user of the MCP Client. MCP Client invokes a "tools/list" request but my Spring AI based MCP Server returns tooldefinition that it computed at the application startup. In my use case i would like to generate description for my tool dynamically everytime the MCP Server receives a "tools/list" request.
- 主要语言
- Java
- 星标
- 3.7k
- 派生
- 1.1k
- 平均合并
- 1 天 15 小时
- 30 天内合并 PR
- 9
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
modelcontextprotocol/java-sdk 的其他 Issue
-
area/transport bug P2
难度 2/5 1-3 小时 新手友好度 88/100
modelcontextprotocol/java-sdk#1136 ·
-
area/client bug P2
难度 2/5 1-3 小时 新手友好度 84/100
modelcontextprotocol/java-sdk#1124 · 1 条评论 ·
-
ServerCapabilities.logging is added unconditionally, overriding the caller's explicit capabilities 未关闭bug P2 ready for work
难度 2/5 1-3 小时 新手友好度 68/100
modelcontextprotocol/java-sdk#1086 · 1 条评论 ·
-
enhancement good first issue P3
难度 2/5 1-3 小时 新手友好度 82/100
modelcontextprotocol/java-sdk#1067 ·
-
bug P2 ready for work
难度 2/5 1-3 小时 新手友好度 74/100
modelcontextprotocol/java-sdk#898 · 1 条评论 ·
查看 modelcontextprotocol/java-sdk 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 2/5 1-3 小时 新手友好度 76/100
-
bug needs triage
难度 2/5 1-3 小时 新手友好度 76/100
-
难度 1/5 1 小时以内 新手友好度 94/100
objectionary/hone-maven-plugin#1061 ·
-
难度 2/5 1-3 小时 新手友好度 76/100
spring-projects/spring-modulith#1895 ·