add_method
Add a method to an existing class at the end of its body, matching method spacing and preserving Go type or C++ access context.
Instructions
Add a method at the end of a class body, after its last member, spaced like the class's methods. In Go it goes after the type declaration. In a C++ class whose last method is followed by an access label, it goes right after that method, so it gets the same access. A one-line Python or Ruby class is refused, and so is a function target (use insert_in_body).
Use this when: adding a method to an existing class. Don't use this when: adding a field (add_field) or a top-level function (add_top_level).
Example: class_target="LRUCache" content='def clear(self):\n self.items.clear()'
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | Complete method source, re-indented like the class's members, keeping its own relative indentation. | |
| file_path | Yes | Absolute path to the source or config file. | |
| class_target | Yes | Class name as list_symbols lists it (a struct, interface or Go struct type too), dotted for nesting ('A.B'). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |