Skip to main content
Glama

replace_symbol

Replace one symbol's syntax-tree span with new text, re-indented, preserving neighbors. Parses first to reject syntax errors; supports hash guard, dry run, and re-index.

Instructions

Replace exactly one declaration (its syntax-tree span incl. decorators/export) with new_text, re-indented. Neighbours on the same line are untouched. The new file is parsed first and refused if it adds syntax errors (force=True overrides). Pass expected_hash (old_hash from a previous call) to guard against concurrent changes. Returns old text + hashes; re-indexes immediately. dry_run previews.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
pathNo
forceNo
dry_runNo
new_textYes
expected_hashNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.2

TDQS

A4.1/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does well: it discloses the parse-first/refuse-on-syntax-error safety check, the force override, the concurrency guard via expected_hash, an immediate re-index side effect, and dry_run preview. It lacks any note on permissions/scope-of-file targeting, but the behavioral disclosure is unusually rich for a mutation tool.

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

Conciseness4/5

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

Dense but front-loaded, leading with the core action and following with safety, concurrency, and return behavior. Each clause adds distinct information, though the packed phrasing slightly hurts scannability.

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

Completeness4/5

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

An output schema exists, yet the description still notes it returns old text + hashes. Combined with coverage of safety, concurrency, preview, and re-indexing, this is nearly complete for a complex mutation tool; only the path parameter's role is unexplained.

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 0%, so the description must compensate; it explains new_text, force, dry_run, and expected_hash (tying it to 'old_hash from a previous call') clearly. It omits any explanation of the path parameter, which is the one gap for a 6-param tool.

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 precise verb+resource+scope: replacing exactly one declaration at its syntax-tree span, including decorators/export, with re-indented text. An agent can distinguish it from siblings like rename_symbol or insert_code without opening any schema.

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

Usage Guidelines3/5

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

Provides operational conditions (dry_run previews, force overrides the safety check, expected_hash guards concurrency) but never states when to choose this tool over siblings such as rename_symbol, insert_code, or symbol-based edits. Usage is implied rather than routed.

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