modelcontextprotocol / modelcontextprotocol/python-sdk
Implement consistent structuredContent handling per specification clarification
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 24.3k
- 派生
- 4k
- 平均合并
- 1 天 1 小时
- 30 天内合并 PR
- 31
描述
Summary
Following the specification issue modelcontextprotocol/specification#1411, the Python SDK needs to ensure consistent handling of structuredContent vs content fields in tool responses.
Problem
Currently there's inconsistency across MCP implementations:
- Some clients use
structuredContentwhen available (e.g., Cursor) - Others ignore it entirely
- This leads to different behavior with the same servers
Current SDK Behavior
The Python SDK needs to be reviewed to ensure it properly handles the relationship between structuredContent and content fields.
Required Changes
Once modelcontextprotocol/specification#1411 is resolved, update the SDK to:
- Implement the specified client behavior for
structuredContent - Ensure proper fallback to
contentwhen needed - Validate that servers populate both fields consistently
- Add tests to verify the correct behavior
- Ensure consistency with the TypeScript SDK implementation
References
- Specification issue: modelcontextprotocol/specification#1411
- TypeScript SDK issue: modelcontextprotocol/typescript-sdk#911
- Discord discussion: https://discord.com/channels/1358869848138059966/1411057080902746293
cc: @dsp-ant
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先阅读规范 issue modelcontextprotocol/specification#1411 以及链接的 TypeScript SDK issue;它们定义了此 Python SDK 必须匹配的行为。然后定位 Python 客户端和服务器的响应处理,并为已明确的 structuredContent 行为添加测试。完成的标准是实现指定的回退逻辑、验证服务器字段的一致性,并与 TypeScript SDK 保持一致。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python, typescript
- 领域
- api, backend-api-design
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 25/100