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

> Generate a @Tool class

Generates a `@Tool` class extending `ToolContext` with stub input/output schemas.

## Usage

```bash theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
nx g @frontmcp/nx:tool fetch-contacts --project crm
```

## Options

| Option      | Type     | Default | Description                                  |
| ----------- | -------- | ------- | -------------------------------------------- |
| `name`      | `string` | —       | **Required.** The name of the tool           |
| `project`   | `string` | —       | **Required.** The project to add the tool to |
| `directory` | `string` | —       | Subdirectory within `src/tools/`             |

## Generated File

```
src/tools/fetch-contacts.tool.ts
```

```ts theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
import { Tool, ToolContext } from '@frontmcp/sdk';
import { z } from 'zod';

@Tool({
  name: 'fetch-contacts',
  description: 'TODO: describe what this tool does',
  inputSchema: {
    // TODO: define input schema
  },
  outputSchema: {
    // TODO: define output schema
  },
})
export default class FetchContactsTool extends ToolContext {
  async execute(input: unknown) {
    // TODO: implement
    return {};
  }
}
```

## Example

```bash theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
# Add to a specific subdirectory
nx g @frontmcp/nx:tool send-email --project crm --directory notifications
# Creates: src/tools/notifications/send-email.tool.ts
```

After generating, update the app to register the tool:

```ts theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
import FetchContactsTool from './tools/fetch-contacts.tool';

@App({
  id: 'crm',
  tools: [FetchContactsTool],
})
class CrmApp {}
```
