replace_symbol_body
Modify the body of a specified symbol in code files automatically. Ensures correct indentation by aligning with the original symbol's structure, simplifying updates in large codebases.
Instructions
Replaces the body of the symbol with the given name_path
.
Important: You don't need to provide an adjusted indentation, as the tool will automatically add the indentation of the original symbol to each line. For example, for replacing a method in python, you can just write (using the standard python indentation): body="def my_method_replacement(self, ...):\n first_line\n second_line...". So each line after the first line only has an indentation of 4 (the indentation relative to the first characted), since the additional indentation will be added by the tool. Same for more deeply nested cases. You always only need to write the relative indentation to the first character of the first line, and that in turn should not have any indentation. ALWAYS REMEMBER TO USE THE CORRECT INDENTATION IN THE BODY!.
Input Schema
Name | Required | Description | Default |
---|---|---|---|
body | Yes | The new symbol body. | |
name_path | Yes | For finding the symbol to replace, same logic as in the `find_symbol` tool. | |
relative_path | Yes | The relative path to the file containing the symbol. |