add_key
Add a key-value pair to a JSON object, YAML mapping, TOML table, Python dict literal or JS/TS object literal. The entry follows the container's layout: one key per line stays so, an inline object stays inline, and a trailing comma is kept.
Instructions
Add a key-value pair to a JSON object, YAML mapping, TOML table, Python dict literal or JS/TS object literal. The entry follows the container's layout: one key per line stays so, an inline object stays inline, and a trailing comma is kept. A YAML key with no value gets a nested mapping. A key the container already has is refused, naming the target to give replace_value.
Use this when: the key does not exist yet. Don't use this when: the key exists (replace_value), or you add a list item (append_to_array).
Example (TS, const CONFIG = { server: {...} }): parent_target="CONFIG.server" key="port" value="8080"
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>",
"parent_target": "<parent_target>",
"key": "<key>",
"value": "<value>"
},
"name": "add_key"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes | Key to add. JSON, YAML and JS/TS: one name, quoted for you when needed. TOML: a dotted key, so quote a name with a dot yourself ('"example.com"'). Python: a key expression, so quote string keys ('"timeout"'). | |
| value | Yes | Value as source text in the file's syntax, strings quoted (e.g. '"2.0.0"' or '42'). | |
| file_path | Yes | Absolute path to the source or config file. | |
| parent_target | Yes | Parent container: its key path from the top level in a config file ('' for the root; quote a key with dots, 'a."b.c"'), or a Python or JS/TS module-level variable's name, dotted into nested literals ('CONFIG.server'). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |