modelcontextprotocol / modelcontextprotocol/python-sdk

Add option to skip output validation for mcp client

未关闭
#2,626 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

enhancement needs decision P3
主要语言
Python
星标
24.3k
派生
4k
平均合并
1 天 1 小时
30 天内合并 PR
31

描述

Description

MCP Client session currently validates the output generated by MCP servers agains the reported json schema, and raises ValidationError.
This means that MCP server tools that have a not well maintained output schema, but are otherwise functional, are unusable.
The request is to add an option either at the ClientSession interface and/or the call_tool method so skip validation and return the result even if it does not conform to the output schemma

References

https://github.com/modelcontextprotocol/python-sdk/blob/main/src/mcp/client/session.py#L319-L349

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 src/mcp/client/session.py 的第 319-349 行开始,跟踪 MCP 工具输出与其报告的 JSON schema 进行检查并引发 ValidationError 的位置。确定退出验证的选项应放在 ClientSession、call_tool,还是两者都放。完成标准是调用方可以跳过输出验证,并接收输出与 schema 不匹配的工具的结果。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
api
Issue 类型
功能
难度
3/5
预计耗时
1-2 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
65/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。