insert_before_symbol
Insert new code before a symbol's definition to add functions, classes, or imports at precise locations.
Instructions
Inserts the given content before the beginning of the definition of the given symbol (via the symbol's location). A typical use case is to insert a new class, function, method, field or variable assignment; or a new import statement before the first symbol in the file.
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": {
"name_path": "<name_path>",
"relative_path": "<relative_path>",
"body": "<body>"
},
"name": "insert_before_symbol"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| body | Yes | The body/content to be inserted before the line in which the referenced symbol is defined. | |
| name_path | Yes | Name path of the symbol before which to insert content (definitions in the `find_symbol` tool apply). | |
| relative_path | Yes | The relative path to the file containing the symbol. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |