Skip to main content

Overview

Tool and prompt errors are thrown when a tool or prompt cannot be found or when execution fails. Not-found errors are public and safe to expose to clients, while execution errors are internal and hide implementation details.

Error Reference

ToolNotFoundError

Thrown when a requested tool is not registered in the server.
Example:

ToolExecutionError

Thrown when a tool’s execute() method throws an unexpected error. This is an internal error — the original error details are hidden from clients.
Example:
ToolExecutionError extends InternalMcpError. Clients receive a generic message with an errorId for support correlation, not the original stack trace. A public error thrown from execute(), such as InvalidInputError, is not wrapped: the client gets its own message and code.

PromptNotFoundError

Thrown when a requested prompt is not registered in the server.
Example:

PromptExecutionError

Thrown when a prompt’s execute() method throws an unexpected error. This is an internal error. A public error, such as MissingPromptArgumentError or one passed to this.fail(), is not wrapped.
Example: