get_symbol_source
Retrieves the source code of the innermost symbol (function, method, class) at a given cursor position by walking the document symbol tree and slicing the file range.
Instructions
Return the source code of the innermost symbol (function, method, class, struct, etc.) whose range contains the given cursor position. Calls textDocument/documentSymbol, walks the symbol tree to find the smallest enclosing symbol, then slices the file at that symbol's range. Returns symbol_name, symbol_kind, start_line (1-based), end_line (1-based), and source text. Use line+character or position_pattern (@@-syntax) to specify the cursor. character defaults to 1.
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>"
},
"name": "get_symbol_source"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| line | No | ||
| character | No | ||
| file_path | Yes | ||
| language_id | No | ||
| position_pattern | No |