modelcontextprotocol / modelcontextprotocol/python-sdk

Implement consistent structuredContent handling per specification clarification

未关闭
#1,332 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

bug enhancement needs decision P3 pending SEP approval
主要语言
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 structuredContent when 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:

  1. Implement the specified client behavior for structuredContent
  2. Ensure proper fallback to content when needed
  3. Validate that servers populate both fields consistently
  4. Add tests to verify the correct behavior
  5. Ensure consistency with the TypeScript SDK implementation

References

cc: @dsp-ant

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 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

把新 issue 发到你的邮箱

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