Skip to content

[MCP SDK] ToolCallHandler now returns structuredContent if applicable #225

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

xavierleune
Copy link
Contributor

Q A
Bug fix? no
New feature? yes
Docs? no
Issues Fix #...
License MIT

As per documentation we should include any structured content in a dedicated field

Structured content is returned as a JSON object in the structuredContent field of a result.
For backwards compatibility, a tool that returns structured content SHOULD also return the serialized JSON in a TextContent block.

Copy link
Contributor

@JoshuaBehrens JoshuaBehrens left a comment

Choose a reason for hiding this comment

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

I have a similar patch in local testing :)

@chr-hertel chr-hertel added the MCP SDK Issues & PRs about the MCP SDK label Jul 29, 2025
@OskarStark OskarStark changed the title [MCP SDK] ToolCallHandler now returns structuredContent if applicable [MCP SDK] ToolCallHandler now returns structuredContent if applicable Jul 30, 2025
@OskarStark OskarStark changed the title [MCP SDK] ToolCallHandler now returns structuredContent if applicable [MCP SDK] ToolCallHandler now returns structuredContent if applicable Jul 30, 2025
@OskarStark
Copy link
Contributor

Please rebase, thanks

@xavierleune xavierleune force-pushed the feature/structured-content branch from ad7601d to f81c226 Compare July 30, 2025 14:21
@xavierleune
Copy link
Contributor Author

@OskarStark done 👍

Copy link
Member

@chr-hertel chr-hertel left a comment

Choose a reason for hiding this comment

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

Two things, I think this is good timing to add a test for checking the two options for type text.

Isn't it that with the current approach we end up with something like "text": "\"foobar\"" for simple, unstructured text values?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MCP SDK Issues & PRs about the MCP SDK Status: Needs Work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants