[tools] add support for structured responses#81
[tools] add support for structured responses#81honzasterba wants to merge 1 commit intomodelcontextprotocol:mainfrom
Conversation
|
Nice job! Does this not also require an 'outputSchema'? |
|
output schema is optional for structured output, for now I just added support for the response field |
| 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
3431c23
Compare
|
separated unrelated change into new PR |
|
anything else needed to merge this? |
|
According to https://modelcontextprotocol.io/specification/2025-06-18/schema#calltoolresult, it seems preferable to add an optional |
|
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 |
|
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