QuestionQ46

VerifiedTool Design & MCP Integration

An MCP server implements a check_availability tool that queries an external calendar API. During testing, three error conditions occur:

  1. The tool is invoked with a malformed request that lacks the required user_email parameter.
  2. The calendar API returns a 404 because the specified user does not exist in the calendar system.
  3. The calendar API returns a 503 because the service is temporarily unavailable.

How should each error be reported under MCP’s error-handling design?

Explanation

Under the current MCP specification, JSON-RPC protocol errors are reserved for problems with the request itself at the protocol level: unknown tools, requests that fail the CallToolRequest schema, and server errors. Everything that goes wrong while handling a well-formed tools/call is a tool execution error returned in the result with isError: true. That explicitly includes input validation errors, such as a missing required argument against the tool's inputSchema, and API failures, such as a 404 for an unknown user or a 503 from an unavailable service. Returning all three as tool results lets the model read the message and self-correct, for example by supplying user_email or retrying later.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!