FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add opt out for mirroring structuredContent into Content automatically by olaservo · Pull Request #3155 · modelcontextprotocol/python-sdk · GitHub

Add opt out for mirroring structuredContent into Content automatically - #3155

Open
olaservo wants to merge 5 commits into
modelcontextprotocol:mainfrom
olaservo:structured-content-no-mirror-objects
Open

Add opt out for mirroring structuredContent into Content automatically#3155
olaservo wants to merge 5 commits into
modelcontextprotocol:mainfrom
olaservo:structured-content-no-mirror-objects

Conversation

olaservo commented Jul 24, 2026
edited
Loading

Copy link
Copy Markdown
Member

Implements the pre-SEP opt-out discussed in #1332.

A tool with an output_schema currently always serializes its structured output into a content text block alongside structuredContent, doubling large payloads. The spec states this duplication is a SHOULD, not a MUST.

This adds a per-tool opt-out, threaded convert_result → Tool → tool_manager → add_tool/@tool: mirror_structured_content=False sends structuredContent only, with empty content. Default True preserves current behavior. Docs updated (docs/servers/structured-output.md); new test follows the in-memory Client(server) pattern.

AI disclosure: implemented with Claude Code assistance and I reviewed it.

olaservo and others added 3 commits July 23, 2026 20:37
The spec's serialized-text mirror alongside structuredContent is a SHOULD,
not a MUST, but MCPServer forced it on every structured result. Add a
per-tool `mirror_structured_content` flag (default True, so existing wire
behavior is unchanged) that, when False, returns structuredContent only with
empty content -- useful for large payloads or hosts that route structured
content to the model themselves.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… claims

The opt-out is a wire choice (emit the serialized content copy or not); which
field a client forwards to a model is the client's decision, not the SDK's.
Reword the docstring, parameter help, and docs to describe duplication rather
than asserting content is "for the model."

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

No issues found across 6 files

Re-trigger cubic

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL