Uh oh!
There was an error while loading. Please reload this page.
[tools] add support for structured responses - #81
Conversation
dieter-medium
commented
Jul 17, 2025
Nice job! Does this not also require an 'outputSchema'? |
honzasterba
commented
Jul 17, 2025
output schema is optional for structured output, for now I just added support for the response field |
Uh oh!
There was an error while loading. Please reload this page.
| attr_reader :content, :is_error | ||
| # @param structured_content [Hash] The structured content of the response, must be provided. | ||
| # @param content [String, nil] The content array of the response, can be nil. If nil will generate a single element with structured content converted to JSON string. |
There was a problem hiding this comment.
For backwards compatibility, a tool that returns structured content SHOULD also return the serialized JSON in a TextContent block.
Not a MUST, but a SHOULD, but I agree with doing it for backwards compatibility in this gem.
- add support for structured content (https://modelcontextprotocol.io/specification/2025-06-18/server/tools#structured-content) in tool responses - for backwards compatibility implements text content auto-generation
71346ef to
3431c23Comparehonzasterba
commented
Jul 28, 2025
separated unrelated change into new PR |
honzasterba
commented
Aug 20, 2025
anything else needed to merge this? |
koic
commented
Aug 25, 2025
According to https://modelcontextprotocol.io/specification/2025-06-18/schema#calltoolresult, it seems preferable to add an optional |
anandaroop
commented
Sep 26, 2025
Thank you for this PR @honzasterba. I also require this functionality. Therefore I have tried another approach in line with @koic's suggestion at #147 |
koic
commented
Sep 27, 2025
I'll close this since I think the issue has been resolved in #147. Thank you for raising it! |
Add new response class to be able to return structuredContent as part of tools response in a backwards compatible way
Motivation and Context
Structured responses are an established part of the spec and the SDK should support it.
How Has This Been Tested?
Add new tested and tested with internal MCP server implementation.
Breaking Changes
None
Types of changes
Checklist