delete_in_body
Deletes a matched snippet from a function body, preserving trailing comments and refusing to empty Python bodies. Use to remove statements, blocks, lines, or object literal entries.
Instructions
Delete a snippet inside a function's body, matched as replace_in_body
matches one. A deletion that empties its lines removes them whole; a
comment after the snippet on its last line stays. One that would leave
a Python body without a statement is refused (replace the snippet with
pass).
Use this when: removing a statement, block or line in a body, or an entry of an object literal passed as an argument. Don't use this when: deleting a whole function or class (delete_symbol).
Example: target="RegisterRoutes" snippet='r.Mount("/kb", kbHandler)'
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>",
"snippet": "<snippet>"
},
"name": "delete_in_body"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| target | Yes | Function or method name as list_symbols lists it, dotted for nesting ('LRUCache.get'); overloads take parameter types ('A.m(int)'). | |
| snippet | Yes | Text in the target's body, matching one place: its exact text at token boundaries, or else whole lines with the same indentation added to or removed from each. | |
| file_path | Yes | Absolute path to the source or config file. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |