delete_symbol
Delete a function, method, class, or other symbol with its decorators and leading comments, preserving file spacing. Use it to remove code definitions cleanly without manual cleanup.
Instructions
Delete a whole function, method, class or other symbol, with its
decorators, a JS/TS export and a C++ template <...> header. The
blank lines that set it apart go too, so the file keeps its spacing. A
symbol that shares a line with other code is cut out of the line. One
name of a declaration of several (int a, b;, struct S {...} s;) is
refused: give replace_function the declaration without it. Refused in
JSON, YAML and TOML files (use delete_key).
Use this when: removing a symbol along with its doc comment. Don't use this when: removing a config key (delete_key), an import (remove_import) or lines inside a body (delete_in_body).
Example: target="LRUCache.old_method"
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>"
},
"name": "delete_symbol"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| target | Yes | Symbol name as list_symbols lists it, dotted for nesting (e.g. 'LRUCache.old_method', 'A.m(int)'). | |
| file_path | Yes | Absolute path to the source or config file. | |
| include_leading_comments | No | True (default) also deletes the comment block above the symbol, or before it on its first line; false keeps it. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |