> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agentfront.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Tool & Prompt Errors

> Errors thrown during tool and prompt lookup and execution.

## 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.

| Property | Type | Value |
| - | - | - |
| `code` | `string` | `TOOL_NOT_FOUND` |
| `statusCode` | `number` | `404` |
| `isPublic` | `boolean` | `true` |

```typescript theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
new ToolNotFoundError(toolName: string)
```

**Example:**

```typescript theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
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.

| Property | Type | Value |
| - | - | - |
| `code` | `string` | `TOOL_EXECUTION_ERROR` |
| `statusCode` | `number` | `500` |
| `isPublic` | `boolean` | `false` |
| `originalError` | `Error \| undefined` | The underlying cause |

```typescript theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
new ToolExecutionError(toolName: string, originalError?: Error)
```

**Example:**

```typescript theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
import { ToolExecutionError } from '@frontmcp/sdk';

try {
  await tool.execute(input);
} catch (error) {
  throw new ToolExecutionError('my_tool', error);
}
```

<Note>
  `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.
</Note>

***

### PromptNotFoundError

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

| Property | Type | Value |
| - | - | - |
| `code` | `string` | `PROMPT_NOT_FOUND` |
| `statusCode` | `number` | `404` |
| `isPublic` | `boolean` | `true` |

```typescript theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
new PromptNotFoundError(promptName: string)
```

**Example:**

```typescript theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
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. A public error, such as `MissingPromptArgumentError` or one passed to `this.fail()`, is not wrapped.

| Property | Type | Value |
| - | - | - |
| `code` | `string` | `PROMPT_EXECUTION_FAILED` |
| `statusCode` | `number` | `500` |
| `isPublic` | `boolean` | `false` |
| `promptName` | `string` | The prompt that failed |
| `originalError` | `Error \| undefined` | The underlying cause |

```typescript theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
new PromptExecutionError(promptName: string, cause?: Error)
```

**Example:**

```typescript theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
import { PromptExecutionError } from '@frontmcp/sdk';

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


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.