# MCP tools

> The tools Corfedo offers over MCP, what each one returns and when a coding agent uses it.

Source: https://docs.corfedo.ai/connect/mcp/tools/

Your agent picks Corfedo's tools from their descriptions, so ask in plain words, for example "find where retries are configured" or "which repositories use lodash". Every tool reads only the repositories the connection may read: yours, limited to the ones you chose when you approved the client. The connection gets the tools its [permissions](https://docs.corfedo.ai/connect/authentication/#permissions) allow.

## Search and read code

| Tool | What it does |
| --- | --- |
| `list_repositories` | Lists the repositories the connection can read, with the commit each one serves |
| `search_code` | Finds code from a description or identifiers, the most relevant files first. Quoted text and regular expressions match exactly. The usual first step. |
| `find_usages` | Finds where an identifier is used, outside comments and strings, and where it is declared |
| `read_file` | Reads a file by repository and path, whole or by line range |
| `list_tree` | Lists the folders and files in a directory |

`search_code` takes the query language in [Search syntax](https://docs.corfedo.ai/reference/search-syntax/). A repository is named by its canonical name, such as `github.com/acme/payments`, or by `acme/payments` when only one repository has that name. Every result names the commit it read.

## Dependencies

These need the **Dependencies** permission.

| Tool | What it does |
| --- | --- |
| `list_dependencies` | Lists the packages a repository uses, with versions and the files that declare them |
| `find_package` | Finds which repositories use a package, which versions and where. Says how many repositories were analysed and what could hide a use, so no match does not prove a package is unused |

## Security findings

These need the **Security findings** permission. Coding agents ask for it with the other permissions, and the **Authorize** page lists it checked. Clear it there to keep findings from the agent.

| Tool | What it does |
| --- | --- |
| `list_security_findings` | Lists vulnerability findings in your repositories, most severe first |
| `get_security_finding` | Shows one finding with the affected versions, fixed versions and dependency path |
| `list_advisories` | Lists security advisories by ID, title or package |
| `get_advisory` | Shows one advisory with the affected packages and the findings it causes in your repositories |

## Ask Corfedo AI

| Tool | What it does |
| --- | --- |
| `ask` | Hands a question to Corfedo AI and returns a `conversation_id` at once. Pass the `conversation_id` to ask a follow-up. |
| `ask_output` | Waits for the answer and returns it. With `timeout` in seconds, or `block` set to false, it returns earlier and says Corfedo AI is still working. |
| `ask_cancel` | Stops Corfedo AI's work on the conversation's latest question. The conversation stays and takes follow-ups. |

Your agent uses these for questions that need many searches or reads, such as how a mechanism works across repositories. Corfedo AI does that work on the server and spends the workspace's AI budget, not your agent's context. The answer cites locations such as `acme/payments/src/retry.ts:10-20`, which `read_file` reads. Files Corfedo AI returns are links your agent can read.

`ask` takes `repositories`, up to 100 names or globs such as `acme/*`, to limit what Corfedo AI reads.

Your agent gets these tools when a workspace administrator turns on [Corfedo AI for MCP clients](https://docs.corfedo.ai/workspace/client-access/) and you kept **Ask Corfedo AI** and **Search and read code** when you [approved the client](https://docs.corfedo.ai/connect/mcp/clients/#approve-access). Conversations started here are not listed in the workspace.

## When a tool fails

A failed call returns a `code`, a `message` and a `correlationId`. Include the `correlationId` when you report a failure to your administrator. [Errors](https://docs.corfedo.ai/reference/errors/#codes) lists every code, and `stale_revision` means the revision is no longer served, so read again at `currentRevision`.

## Related

- [MCP troubleshooting](https://docs.corfedo.ai/connect/mcp/troubleshooting/) covers missing repositories and failed sign-in.
- [Search and read with the CLI](https://docs.corfedo.ai/connect/cli/search-and-read/) offers similar operations in a terminal, plus symbols and outlines.
