read_symbol
Return the source of a single function, class, method, variable, or config key without reading the whole file. Use depth options to fetch full code, interface, or signature.
Instructions
Return the source of one symbol (function, class, method, variable) or
the value of a config key, without reading the whole file. Read-only.
"full" is the text replace_function and delete_symbol take: decorators,
a JS/TS export, a C++ template <...> header and code that only
wraps the symbol (a Go type, a closure's key, a C typedef)
included, a C/C++ class ending with its ;. It starts at the symbol's
first byte, the later lines at their file indentation. "interface"
gives a class's header, fields and method signatures (bodies as
...), indented as in the class, or a function's signature;
"signature" the signature or class header alone, after decorators.
Both refuse a variable, constant, field, type alias or macro, saying
what it is. A name with a prototype or forward declaration reads as
its definition.
Use this when: reading one symbol; pick the narrowest depth. Don't use this when: you need the file's outline (list_symbols) or its imports (read_imports).
Example: target="LRUCache", depth="interface"
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"file_path": "<file_path>",
"target": "<target>"
},
"name": "read_symbol"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| depth | No | 'full' (default) the whole symbol; 'interface' a class skeleton or function signature; 'signature' the signature or class header. Config files take only 'full'. Other values are refused. | full |
| target | Yes | Symbol name as list_symbols lists it, dotted for nesting ('LRUCache.get', 'A.m(int)'), or a config key path from the top level ('project.version'; quote a key with dots, '"editor.fontSize"'). | |
| file_path | Yes | Absolute path to the source or config file. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |