Skip to content

Add support for tool structured content and output schema #146

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

Merged

Conversation

ptitjes
Copy link
Contributor

@ptitjes ptitjes commented Jul 11, 2025

Fixes #139

In this PR, I add:

  • structuredContent in CallToolResult
  • outputSchema in Tool
  • extends the ToolSerializationTest
  • added an additional Server.addTool() taking a tool directly, to make it more consistent with addPrompt methods

Motivation and Context

To support the new tool structured output and output schema of the 2025-06-18 protocol version.

How Has This Been Tested?

I extended the existing ToolSerializationTest to verify that the output schema was correctly serialized.

Breaking Changes

Note that I added the outputSchema field in the Tool data class before the new annotations field added on July, the 7th. I considered that there had not been any release since the addition of annotations, so it would not break the compatibility of the componentX() data class methods for the SDK users.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

@devcrocod devcrocod self-requested a review July 14, 2025 12:35
Copy link
Contributor

@devcrocod devcrocod left a comment

Choose a reason for hiding this comment

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

lgtm

@devcrocod devcrocod enabled auto-merge (squash) July 14, 2025 12:36
@devcrocod devcrocod force-pushed the feature/tool-structured-output branch from 578d61f to f38f00d Compare July 14, 2025 12:55
@devcrocod devcrocod disabled auto-merge July 14, 2025 12:55
@devcrocod devcrocod enabled auto-merge (squash) July 14, 2025 12:55
@devcrocod devcrocod merged commit 12f686f into modelcontextprotocol:main Jul 14, 2025
1 check passed
@ptitjes ptitjes deleted the feature/tool-structured-output branch July 14, 2025 13:22
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.

Support tool structured content and output schema
2 participants