post_v1_code_context
Packs the most relevant code for a query into a token budget — THE primitive for a coding agent that has to decide what to put in a prompt.
Packs the most relevant code for a query into a token budget — THE primitive for a coding agent that has to decide what to put in a prompt. It retrieves seed spans, expands each with the definitions it calls and its key callers, then greedily fills the budget, so the answer is a coherent slice of the codebase rather than a list of disconnected matches. The top match is always included, truncated if it alone overflows, so a matched query never comes back empty. A retrieval outage answers 200 with an empty bundle rather than a 5xx.
| Tool | post_v1_code_context |
| Door | https://api.hanzo.ai/v1/mcp |
| Method | tools/call (JSON-RPC 2.0) |
| Arguments | 3 |
| Operation | POST /v1/code/context |
| Product | code |
Arguments
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
budgetTokens | integer | — | — | BudgetTokens caps the bundle's size. Clamped to [256, 32000]; 0 or absent uses 4000. |
query | string | — | — | Query is what to retrieve context for. Required, max 4000 bytes. |
repo | string | — | — | Repo narrows retrieval to one repository. Empty searches every repo the org has indexed. |
This tool's schema does not declare which fields are required, nor any default, nor any enumerated value set. The columns above are empty because the door publishes nothing there, not because the answer is "none" — where a field is constrained, the constraint is stated in that field's own description.
Call it
A tools/call carries every argument in one flat object — nothing binds to a path or a query string. Every declared argument is shown, because the door marks none of them required.
curl -X POST https://api.hanzo.ai/v1/mcp \
-H "Authorization: Bearer $HANZO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "post_v1_code_context",
"arguments": {
"budgetTokens": 0,
"query": "<query>",
"repo": "<repo>"
}
}
}'Values are placeholders derived from each field's declared type. tools/list needs no credential; tools/call does — called without one the door answers HTTP 200 with a JSON-RPC result whose isError is set and whose text says what was missing. How to get a key →
The operation behind it
| Operation | Route | Product | Summary |
|---|---|---|---|
cloud_post_v1_code_context | POST /v1/code/context | code | Packs the most relevant code for a query into a token budget — THE primitive for a coding |
The same capability over plain HTTP is in the code API reference, on https://api.hanzo.ai.
All 834 tools · The door · API reference
Generated from tools/list on https://api.hanzo.ai/v1/mcp — 834 tools captured 2026-08-01 (this build read the vendored copy; the door was unreachable).
How is this guide?