add_field
Adds a field or member variable at the top of a class body with correct placement and indentation; refuses function targets. Use for class attributes, not methods.
Instructions
Add a field or member at the top of a class body: before the first
member, after a Python class docstring or a Java enum's constants
(adding the ; they need), and below the access label a C++ class
opens with. It is indented like the class's members, with a blank line
after it when a method follows. A function target is refused.
Use this when: adding a class attribute, field or member variable. Don't use this when: adding a method (add_method).
Example: class_target="LRUCache" content='version = "1.0"'
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>",
"class_target": "<class_target>",
"content": "<content>"
},
"name": "add_field"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | Field or member declaration as source text (e.g. 'version = "1.0"' or Go 'version int'). | |
| 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 |