insert_symbol
Insert code at a specific location using AST-based positioning. Uses two-phase process: dry-run returns diff and token, then confirm to apply.
Instructions
Insert code at a specific location. Phase 1: returns diff + token. Phase 2: confirm with token to apply.
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": {
"filePath": "<filePath>",
"projectRoot": "<projectRoot>"
},
"name": "insert_symbol"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filePath | Yes | Absolute path to file | |
| projectRoot | Yes | Project root (REQUIRED) | |
| code | No | Code to insert (Phase 1 only ΓÇö omit in Phase 2, server uses stored content) | |
| anchorSymbol | No | Symbol to position relative to | |
| position | No | Where to insert | |
| className | No | Class name (optional) | |
| confirm | No | Set true to apply a pending operation (Phase 2) | |
| confirmationToken | No | Token from Phase 1 dry-run (Phase 2 only) | |
| diffFormat | No | Diff verbosity in Phase 1 output (default: unified). Use none to skip diff and save tokens. |