replace_value
Update an existing config key, object entry, variable, constant, field, or macro value in a source file while leaving its declaration intact; add a value to an uninitialized declaration.
Instructions
Replace the value of an existing config key, dict or object entry, or
of a variable, constant, field or macro in a source file (X = 1,
const X = 1;, int x = 1;, #define N 3). Only the value changes; a
declaration without one gets one (let x; becomes let x = 2;, YAML
a: becomes a: 2). Refused: a function, class or type (use
replace_function), a name sharing one value with others (a = b = 1)
and a declaration that cannot have a value (extern, TS declare).
Array elements are not addressable.
Use this when: updating a value that exists. Don't use this when: the key is new (add_key), or you edit an array (append_to_array, remove_from_array).
Example: target="project.version" content='"2.0.0"'
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| target | Yes | Key path from the top level in a config file ('project.version'; quote a key with dots, '"editor.fontSize"'; keys in YAML flow mappings and TOML inline tables count, 'a.x'), a path into a Python or JS/TS module-level dict or object ('CONFIG."timeout"', 'CONFIG.server.port'), or a variable, constant, field or macro name ('MAX', 'A.x'). | |
| content | 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. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |