Skip to main content
Glama

replace_value

Destructive

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

NameRequiredDescriptionDefault
targetYesKey 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').
contentYesValue as source text in the file's syntax, strings quoted (e.g. '"2.0.0"' or '42').
file_pathYesAbsolute path to the source or config file.

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv3.2.0
    • addedInput schema / properties / content / description
      Added value: +"Value as source text in the file's syntax, strings quoted (e.g. '\"2.0.0\"' or '42')."
    • addedInput schema / properties / file_path / description
      Added value: +"Absolute path to the source or config file."
    • addedInput schema / properties / target / description
      Added value: +"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')."
  2. First observedv1.2.0

TDQS

A4.9/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Goes well beyond the annotations (destructiveHint=true, readOnlyHint=false) by disclosing exactly what mutates: only the value changes, and a declaration lacking a value gains one (`let x;` -> `let x = 2;`, YAML `a:` -> `a: 2`). It also lists three hard refusal conditions (chained `a = b = 1`, `extern`, TS `declare`) and states array elements are not addressable. Output schema exists, so return format need not be repeated.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the core action, then structured into use/don't-use blocks and an example. Despite the length, every sentence contributes either routing, a refusal boundary, or a semantic detail; there is no padding.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 3-parameter destructive write tool with an output schema and full annotation coverage, the description supplies everything an agent needs: scope, refusal cases, sibling routing, and a worked example. No material gap remains.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3; the description adds value by showing a concrete target/content pair (target="project.version", content='"2.0.0"'), which conveys that content must be quoted source text in the file's syntax — a common failure point. It stops short of explaining the target path grammar in depth, which is left to the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb (Replace) and resource (value of an existing config key, dict/object entry, variable, constant, field or macro), then enumerates concrete syntax forms (`X = 1`, `const X = 1;`, `#define N 3`). It also names what it explicitly is not (replace_function) and what is out of scope (array elements), so an agent can place it among the 29 siblings immediately.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Has explicit 'Use this when: updating a value that exists' and 'Don't use this when: the key is new (add_key), or you edit an array (append_to_array, remove_from_array)' sections naming the exact alternatives. The refusal list adds further routing (function/class/type -> replace_function). Nothing is left to inference.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.