Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions docs/router/mcp.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,30 @@ The MCP server converts each operation into a corresponding tool:

Operations are converted to snake_case for tool naming consistency.

#### Custom Tool Names

You can override the default tool name by adding the `@mcpTool` directive to your operation:

```graphql
"""
Returns employee details by their unique ID.
"""
query GetEmployee($id: Int!) @mcpTool(name: "get_employee_by_id") {
employee(id: $id) {
id
name
role
}
}
```

With this directive, the tool will be named `get_employee_by_id` instead of the default `execute_operation_get_employee`.

Key points about the `@mcpTool` directive:

- The directive is automatically stripped before schema validation, so you don't need to define it in your GraphQL schema
- If the directive is absent or the name is empty, the default naming convention is used

### Best Practices

1. **Meaningful names**: Give operations clear, action-oriented names that describe what they do.
Expand Down