---
url: /development/tools-mcp.md
---

# Tools & MCP

Tools are loaded per request for the calling user; the model only sees those enabled in the request.

![Tools and MCP](./architecture/04-tools-mcp.png)

## Tool sources

* **Local tools** (`LocalTool` spec): `brainstorm`, `simplify`, `canvas_write`, `canvas_edit`, `canvas_read`.
* **MCP tools** (`McpLoader`): metadata cached per user (with a Valkey distributed lock), connection rebuilt per request; forwards the user token only when the source enables `forward_token` (default: off). MCP servers speak SSE or streamable HTTP; the Valkey cache key is `mcp_tools_raw_v3:<user>` with a 12 h TTL (60 s on failure).
* **Deep Agents built-ins**: `write_todos`, `ls`, `read_file`, `write_file`, `edit_file`, `delete`, `glob`, `grep`, `execute`, `task` — enabled per model through the harness profile.

## Selection and approval

`ToolCollection.get_tools(user)` combines local tools (if configured) and MCP tools; a non-persisted chat drops tools that require approval. The frontend tool picker lists local + MCP metadata from `GET /v1/tools`, and the chat request carries `enabled_tools`. When `enabled_tools` is set, `ContextMiddleware` shows the model only the requested tools, the remaining tools of their groups (users select groups as a whole), the canvas base tools and the enabled built-ins. The chat router maps an omitted `enabled_tools` to an empty selection, so omitting the field offers only the built-ins and canvas base tools; the middleware's unfiltered `None` path is not exercised by chat requests. Tools with `require_approval` run in `interrupt_on` mode: the run pauses until the user approves.

Configuration (MCP sources, tool call budgets) is described in [MCP](../operations/mcp.md); the tool spec pattern in the repository's [`agent/tools/README.md`](https://github.com/it-at-m/mucgpt/blob/main/mucgpt-core-service/app/agent/tools/README.md).
