No support for structuredContent in tool results (MCP spec 2025-06-18)
还没有人认领这个 Issue。
评估
调研方向
首先定位并阅读 as_tool_call_result(),重点关注列表结果和 ellmer Content 对象当前是如何序列化的。为列表结果添加 structuredContent,同时保留 content 中的序列化文本,并保持 Content 对象现有的行为。验证工具结果同时包含这两种表示形式,并考虑 outputSchema 与 issue #103 的关系。
由索引模型根据 Issue 内容生成。
描述
Problem
The MCP spec (2025-06-18) defines a structuredContent field on tool results — a JSON object that provides machine-readable structured output alongside the human-readable content text.
Currently, as_tool_call_result() only produces content (text-only). There's no path for structuredContent.
Expected
When a tool returns a list/data structure, the result should include both:
{
"content": [
{"type": "text", "text": "{\"auc\": 0.92, \"tss\": 0.81}"}
],
"structuredContent": {
"auc": 0.92,
"tss": 0.81
}
}
content: Human-readable text (for backwards compatibility)structuredContent: Machine-readable JSON (for clients that support it)
Per spec: "For backwards compatibility, a tool that returns structured content SHOULD also return the serialized JSON in a TextContent block."
Use Case
SDM MCP server with ~70 tools. Each tool produces structured results (model metrics, file paths, area statistics). Clients that understand structuredContent get validated, typed data. Others fall back to text. This is the biggest quality-of-life improvement for tool-heavy servers.
Fix
In as_tool_call_result(), if the tool result is a list (and not an ellmer Content object), include it as structuredContent alongside the text serialization.
Related to #103 (outputSchema) — if a tool declares an outputSchema, the structuredContent should be validated against it.
- 主要语言
- R
- 星标
- 204
- 派生
- 23
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
posit-dev/mcptools 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 48/100
-
难度 5/5 一周以上 新手友好度 35/100
-
难度 4/5 3-5 天 新手友好度 48/100
-
难度 4/5 3-5 天 新手友好度 55/100
-
难度 4/5 3-5 天 新手友好度 35/100
查看 posit-dev/mcptools 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
-
难度 2/5 1-3 小时 新手友好度 71/100
-
难度 2/5 1-3 小时 新手友好度 72/100
-
难度 2/5 1-3 小时 新手友好度 76/100
OHDSI/PatientLevelPrediction#688 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
rfordatascience/tidytuesday#1098 ·