Skip to content

Add OutputSchema to Tool and CallToolResult.structuredContent #285

Description

@pantanurag555

OutputSchema was added to Tool after updates to the specification: modelcontextprotocol/modelcontextprotocol@c2e0fd6

I am working on changes to add it to the java-sdk. Creating an issue to avoid duplicated work.

Activity

  1. changed the title [-]Add OutputSchema to Tool[/-] [+]Add OutputSchema to Tool and CallToolResult.structuredContent[/+] on Jun 4, 2025
  2. pantanurag555 commented on Jun 5, 2025

    @pantanurag555
    ContributorAuthor

    @tzolov @chemicL Hey there, I am picking up work on these changes and wanted to clarify the scope of the work based on the contributing guidelines.

    Relevant PRs for python-sdk: #685 #684

    Scope:

    • Schema changes to add Tool.outputSchema and CallToolResult.structuredContent
    • No server side changes since the tool definition and result definition are dependent on the server owner.
    • Client side changes to create a caching mechanism of sorts for the tool list and leveraging this mechanism to validate the Tool.outputSchema against the CallToolResult.structuredContent when required [According to the spec: Clients SHOULD validate structured results against this schema.]
    • Relevant tests

    My major question about the scope of work revolves around the client side changes. I saw that there was some discussion around a standalone schema validator in #271. Should I introduce the caching mechanism and validator changes in the first PR itself or should that be a PR of its own? I think they can be separated for the first iteration since this is a SHOULD statement. Would like some maintainer input on this to reduce churn.

  3. loong-coder commented on Jun 6, 2025

    @loong-coder

    Hello @pantanurag555 , could you please provide an update on the #285 ? I'd appreciate knowing its current status.

  4. pantanurag555 commented on Jun 6, 2025

    @pantanurag555
    ContributorAuthor

    Hey @loong-coder. I have the changes but based on the contributing guidelines and comments from a maintainer in #271, I need to clarify the scope of work after creating an issue to claim work on the feature. I have tried to that in the comment above yours. If I don't hear back from them in a couple of days, I will raise the PR as is.

  5. pantanurag555 commented on Jun 9, 2025

    @pantanurag555
    ContributorAuthor

    Implementation PR: #302

  6. tzolov commented on Jun 30, 2025

    @tzolov
    Contributor

    Hi @pantanurag555 , thank you for raising this issue.

    Updating the Schema to add Schema changes to add Tool.outputSchema and CallToolResult.structuredContent is obvious.
    The specification though says that If an output schema is provided, Servers MUST provide structured results that conform to this schema. IMO this means that the MCP server needs to validate the structured output to ensure it is conformant to the output-schema: https://modelcontextprotocol.io/specification/2025-06-18/server/tools#output-schema.

    The client SHOULD (not MUST e.g. optionally) validate the response.

    Here is my read of the spec: #357

    Also #357 introduces a plugable JsonSchemaValidator abstraction that perhaps can be (re)used for the client side validations (including the #271).

  7. added
    enhancementNew feature or request
    P1Significant bug affecting many users, highly requested feature
    on Feb 18, 2026
  8. added this to the 0.11.0 milestone on Feb 18, 2026
  9. tzolov commented on Feb 18, 2026

    @tzolov
    Contributor

    Resolved by #357

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1Significant bug affecting many users, highly requested featureenhancementNew feature or request

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions