append_to_array
Add a value to a JSON, YAML, TOML, or Python module-level list while preserving the existing inline or multiline layout and trailing commas.
Instructions
Append a value to a JSON, YAML or TOML array or a Python module-level
list. The value follows the array's layout: an inline array stays
inline ([1, 2] becomes [1, 2, 3]), one element per line gets a new
line, and a trailing comma is kept. Comments are not elements: the
comma goes before them.
Use this when: adding a list item. Don't use this when: adding a key-value pair (add_key).
Example: target="project.dependencies" value='"new-package"'
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>",
"value": "<value>"
},
"name": "append_to_array"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| value | Yes | Value as source text in the file's syntax, strings quoted (e.g. '"2.0.0"' or '42'). | |
| target | Yes | Key path from the top level to a JSON, YAML or TOML array ('project.dependencies'), or a Python module-level list's name. | |
| file_path | Yes | Absolute path to the source or config file. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |