insert_after_symbol
Insert text after a symbol's declaration to add methods or helpers. Provides a diff preview and works even without a language server by using tree-sitter parsing.
Instructions
Insert text immediately after a symbol's declaration.
Useful for adding a new method to a struct (insert after an existing one), or appending a related helper. Provide the full text to insert in 'content' — include leading newline if appropriate.
The response includes a unified diff of the change — a preview in dry-run, the applied change otherwise — unless show_write_diff is disabled.
Works even when the language server is cold or cannot parse the file: it then locates the symbol via a fresh tree-sitter parse (line-granular range, annotated in the output).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| uri | No | Absolute path, file:// URI, or workspace-relative path. | |
| content | No | Text to insert after the symbol. | |
| dry_run | No | If true (default), preview only; do not write. | |
| dirty_ok | No | Allow editing a file with uncommitted changes. Default false — review/commit first, or pass true to proceed. | |
| name_path | Yes | Slash-separated symbol path within the file (e.g. "ClassName/methodName", or just "funcName" for top-level). |