get_symbol
Raw source bytes for one indexed symbol with exact line bounds — cheaper and safer than reading the whole file and counting offsets. The only MCP tool that returns actual source code.
Every other tool returns context about code. get_symbol returns the
code itself — the raw source bytes of a single indexed symbol with
its exact start/end lines. It's the precise, bounded alternative to a
full-file Read followed by offset arithmetic.
When to call
- You need one function or class body, not the whole file.
- After
get_context— pipe thesymbol_idfrom its symbol list straight in. - To confirm a signature or implementation before editing, without pulling 800 unrelated lines into the context window.
Parameters
Prop
Type
Returns
| Field | Meaning |
|---|---|
symbol_id | The resolved canonical id |
source | The symbol's source bytes (bounded at ~400 lines) |
start_line, end_line | Exact 1-based line bounds in the file |
kind | function, class, method, … |
language | Detected language tag |
truncated | true if the body exceeded the line bound and was cut |
On a miss, returns { error: "Symbol not found …" } with the closest
candidate ids so the agent can retry without another get_context call.
Example
get_symbol("src/auth/service.py::AuthService")
get_symbol(
symbol_id="src/auth/service.py::login",
context_lines=10,
)Things worth knowing
- Deterministic on overloads. When a name resolves to more than one definition, resolution is stable — the same id always returns the same symbol.
- Separator-agnostic.
file.py::Name,file.py.Name, andfile.py/Nameall resolve; use whateverget_contexthanded you. - Bounded by design. The ~400-line cap keeps a single call from
blowing the context window on a giant generated file;
truncatedtells you when that happened.
Pair it with get_context: get_context
returns the symbol_ids and signatures, get_symbol fetches the one
body you actually need. Two calls, zero file reads.
get_context
The workhorse tool. Compact, batched context for any set of files, modules, or symbols — docs, ownership, freshness, and optional source/callers/callees/metrics/community in one call.
search_codebase
Semantic search over the wiki — natural-language queries with vector retrieval and full-text fallback, freshness-boosted, and federated across repos in workspace mode.