modelcontextprotocol / modelcontextprotocol/java-sdk
More extensible CallToolRequest
还没有人认领这个 Issue。
- 主要语言
- Java
- 星标
- 3.7k
- 派生
- 1.1k
- 平均合并
- 1 天 15 小时
- 30 天内合并 PR
- 9
描述
Expected Behavior
We want to define our own tool-specific requests with own parsers for 'params'.
Current Behavior
The arguments for tool calls are always Maps.
Context
We develop our own MCP server that offers features like querying and we have our own set of tools to parse, validate and execute them.
The problem is that request object is always de-serialised as a map and we need to serialise it back or figure out a way to reconstruct our objects from the maps. It works most of the time, but is rather inconvenient for queries.
There is https://github.com/modelcontextprotocol/java-sdk/blob/main/mcp-core/src/main/java/io/modelcontextprotocol/json/McpJsonMapper.java, but as far as I understand, it is mainly used to decouple Jackson from the rest of the code.
We could have used that but it looks rather technical.
What I would like to have: some way to define my own request objects and make their payloads shallow or leave them unparsed so the each individual tool can later parse its payload and decide what to do. Or stick with standard map-based one if that is fine for it.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先阅读 McpJsonMapper.java,并跟踪 CallToolRequest 如何反序列化工具参数。在保留现有基于 map 的行为的同时,定义受支持的工具特定请求解析扩展点,然后通过相关的请求反序列化测试验证所选择的行为。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- java
- 领域
- api, backend-api-design
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 冷清
- 描述清晰度
- 需要澄清
- 新手友好度
- 35/100