Skip to content

McpServer class using an outputSchema gobbles thrown errors from tool calls #699

Open
@jsas

Description

@jsas

When a tool is registered with an output schema using the McpServer class , errors thrown in the tool call are not considered in the response logic and will throw another error: MCP error -32602: MCP error -32602: Tool ${toolName} has an output schema but no structured content was provided

Steps to reproduce the behavior:

  1. register a tool with an outputSchema.
  2. throw an error in the tool call.
  3. observe the error is swallowed by the output logic.

I expect the error I threw to be thrown. Same if I choose to return a content error ({ content: ..., isError: true })

Maybe if (tool.outputSchema && !result?.isError) { on that line?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions