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.
PropertyTypeValue
codestringTOOL_NOT_FOUND
statusCodenumber404
isPublicbooleantrue
new ToolNotFoundError(toolName: string)
Example:
import { ToolNotFoundError } from '@frontmcp/sdk';

const tool = registry.get(name);
if (!tool) {
  throw new ToolNotFoundError(name);
}

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.
PropertyTypeValue
codestringTOOL_EXECUTION_ERROR
statusCodenumber500
isPublicbooleanfalse
originalErrorError | undefinedThe underlying cause
new ToolExecutionError(toolName: string, originalError?: Error)
Example:
import { ToolExecutionError } from '@frontmcp/sdk';

try {
  await tool.execute(input);
} catch (error) {
  throw new ToolExecutionError('my_tool', error);
}
ToolExecutionError extends InternalMcpError. Clients receive a generic message with an errorId for support correlation, not the original stack trace.

PromptNotFoundError

Thrown when a requested prompt is not registered in the server.
PropertyTypeValue
codestringPROMPT_NOT_FOUND
statusCodenumber404
isPublicbooleantrue
new PromptNotFoundError(promptName: string)
Example:
import { PromptNotFoundError } from '@frontmcp/sdk';

throw new PromptNotFoundError('summarize');
// "Prompt not found: summarize"

PromptExecutionError

Thrown when a prompt’s execute() method throws an unexpected error. This is an internal error.
PropertyTypeValue
codestringPROMPT_EXECUTION_FAILED
statusCodenumber500
isPublicbooleanfalse
promptNamestringThe prompt that failed
originalErrorError | undefinedThe underlying cause
new PromptExecutionError(promptName: string, cause?: Error)
Example:
import { PromptExecutionError } from '@frontmcp/sdk';

try {
  await prompt.execute(args);
} catch (error) {
  throw new PromptExecutionError('summarize', error);
}