canopy_answer Reference
Canopy exposes one tool over the Model Context Protocol: canopy_answer. One natural-language question goes in; one answer comes out. Routing, retrieval, and synthesis run server-side in a single call.
The v1 catalog of 31 granular tools (canopy_search, canopy_extract_symbol, canopy_prepare, …) was removed in v2. It is history, not surface — see the changelog.
Launching the server
Section titled “Launching the server”canopy serve starts the MCP stdio server for a repository. It speaks JSON-RPC 2.0 on stdin/stdout.
canopy serve <repo> # stdio MCP servercanopy serve <repo> --answer # implies --watch; bootstraps the full-text index if missingcanopy serve <repo> --print-mcp-config # print the wiring snippet and exit (does not start the server)--print-mcp-configemits the exact config block for your agent;--client claude(default),cursor, orzedselects the format.--answeronly governs index bootstrap and watching. The tool surface is always the singlecanopy_answertool, with or without the flag.canopy setupwires every detected MCP editor automatically during onboarding.
See the CLI Reference for all serve flags.
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
question | string | yes | The natural-language question. Keep backticks around file paths, directories, and symbol names (e.g. `src/lib.rs`, `MyStruct`) so the classifier can locate them. Name the entity type — “the function foo”, not just “foo”. Phrasing picks the recipe. |
format | string | no | Output density. "concise" (default): ~200–500 chars. "standard": fuller answer with citations. |
max_internal_calls | integer | no | Cap on internal tool-handler calls (default 3, max 8). |
Example:
{ "question": "what depends on `src/api/handler.ts`?", "format": "standard" }Question shapes
Section titled “Question shapes”Phrasing picks the recipe. A precise shape beats a vague “how does X work”. The recognized shapes:
| Ask | Recipe | Returns |
|---|---|---|
where is the function/struct/class `Sym` defined? | locate | Where the symbol is defined |
show `Sym` in `path` | extract | The symbol’s source code |
what does `path` do? | explain | What the file does |
public surface of `path` | public surface | The file’s public API |
what depends on `path`? / what calls `Sym`? | dependents | Dependents / callers — blast radius |
what does `path` import? | imports | The file’s imports |
who last changed `path`? | ownership | Who last changed it |
what tests cover `path`? / coverage of `path` | tests / coverage | Tests covering it, coverage data |
is `path` reachable / dead code? | wiring | Reachable-or-dead verdict |
| are there import cycles? | cycles | Import cycles in the graph |
what should I know before editing `path`? | pre-edit dossier | Combined pre-edit briefing for the file |
list functions defined in `dir/` | filtered symbols | Symbols under a directory, filtered by kind |
| architecture overview | architecture | Module-level overview of the repo |
| how does <concept> work? | semantic fallback | Weakest shape — prefer a specific one above |
Routing
Section titled “Routing”Routing is deterministic: a corpus-validated classifier maps the question to a recipe. No LLM call, no network. It scores 360/360 on its labelled regression corpus.
Honest no-match
Section titled “Honest no-match”When nothing clears the relevance floor (cross-encoder-calibrated), the answer is “No strong match in this repository for …” — not a relay of tangential files. An empty answer is signal, not noise.
| Tier | canopy_answer behavior |
|---|---|
| Community | Keyword recipes over the local AST + full-text index |
| Solo and above | Adds semantic (embedding-backed) recipes |
CLI counterpart
Section titled “CLI counterpart”canopy answer "<question>" is the same routed call from a shell. The repo is auto-detected from the current working directory; pass an optional path to override. See CLI Reference.