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:
- register a tool with an outputSchema.
- throw an error in the tool call.
- 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?
When a tool is registered with an output schema using the
McpServerclass , 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 providedSteps to reproduce the behavior:
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?