get_symbol_body
Retrieve the source code body of any function, method, or class by name and file path, getting only the relevant code without loading the entire file.
Instructions
Get the source code body of a specific symbol (function, method, or class).
This tool retrieves only the code for the specified symbol, enabling efficient
context usage by avoiding loading entire files.
Args:
file_path: Path to the file containing the symbol
symbol_name: Name of the symbol to retrieve (e.g., "process_data", "MyClass.my_method")
Returns:
Dictionary containing:
- status: "success" or "error"
- symbol_name: Name of the symbol
- type: Type of symbol (function, method, class)
- line: Start line number
- end_line: End line number
- code: The actual source code
- signature: Function/method signature (if available)
- docstring: Documentation string (if available)
- called_by: List of symbols that call this symbolInput Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | ||
| symbol_name | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||