Skip to content

[Feature]: Add Output Schema #462

@0xKoller

Description

@0xKoller

Problem statement

Right now, when defining a tool in xmcp, the output schema is not supported.
Adding support for an output schema would significantly improve compatibility with LLM tool-calling (OpenAI, Anthropic, etc.), which benefits greatly from explicit schemas.

Proposed solution

  • Automatically infer the output schema from the handler function's return type (using TypeScript reflection, Zod inference helpers, or a similar mechanism).
  • Assign it to the tool's outputSchema property if no explicit schema was provided by the developer.

Package

xmcp (core framework)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions