insert_sibling
Insert code before or after a named symbol at its level, preserving surrounding spacing. Use it to place helpers relative to callers without search-and-replace.
Instructions
Insert code next to a named symbol, at its level. "before" goes above
the symbol's leading comment, decorators and export; "after" below
the symbol (after the ; that ends a C/C++ class). The code is spaced
like the gap it goes into: one-line code stacked without blank lines
stays stacked, and next to a function or class it gets at least one
blank line, two around a top-level Python def or class. A comment
indented deeper than the target ends the code above, so "before" goes
below it. "before" is refused when other code comes before the target
on its line, "after" when code follows it. Refused in JSON, YAML and
TOML files (use add_key).
Use this when: placing code relative to a symbol, such as a helper above its caller. Don't use this when: appending at the end of the file (add_top_level), or inserting into a body (insert_in_body) or a class (add_method, add_field).
Example: target="LRUCache" content="CACHE_SIZE = 100" position="before"
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>",
"content": "<content>",
"position": "<position>"
},
"name": "insert_sibling"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| target | Yes | Symbol name as list_symbols lists it, dotted for nesting (e.g. 'LRUCache', 'A.m'). | |
| content | Yes | Code to insert, re-indented to the target's level (in tabs where the file indents with them); read_symbol's text goes in as a whole. | |
| position | Yes | 'before' or 'after' the target; other values are refused. | |
| file_path | Yes | Absolute path to the source or config file. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |