Skip to main content
Glama

replace_symbol_source

Destructive

Rewrite an entire function or class by symbol name without reading the file, enabling direct structural source replacement in the codebase.

Instructions

Rewrite a whole function or class by name, no Read needed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeNoAlias de `new_source`. Replacement source for the symbol.
nameNoAlias de `symbol_name`. Function, method, class, or section name to replace.
sourceNoAlias de `new_source`. Replacement source for the symbol.
contentNoAlias de `new_source`. Replacement source for the symbol.
projectNoProject name/path (default: active).
file_pathNoOptional file path to disambiguate symbols.
new_sourceNoReplacement source for the symbol.
symbol_nameNoFunction, method, class, or section name to replace.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changedv4.20.0
    • addedInput schema / anyOf
      Added value: +[
      +  {
      +    "required": [
      +      "symbol_name",
      +      "new_source"
      +    ]
      +  },
      +  {
      +    "required": [
      +      "symbol_name",
      +      "content"
      +    ]
      +  },
      +  {
      +    "required": [
      +      "symbol_name",
      +      "source"
      +    ]
      +  },
      +  {
      +    "required": [
      +      "symbol_name",
      +      "code"
      +    ]
      +  },
      +  {
      +    "required": [
      +      "name",
      +      "new_source"
      +    ]
      +  }
      +]
    • addedInput schema / properties / code
      Added value: +{
      +  "description": "Alias de `new_source`. Replacement source for the symbol.",
      +  "type": "string"
      +}
    • addedInput schema / properties / content
      Added value: +{
      +  "description": "Alias de `new_source`. Replacement source for the symbol.",
      +  "type": "string"
      +}
    • addedInput schema / properties / name
      Added value: +{
      +  "description": "Alias de `symbol_name`. Function, method, class, or section name to replace.",
      +  "type": "string"
      +}
    • addedInput schema / properties / source
      Added value: +{
      +  "description": "Alias de `new_source`. Replacement source for the symbol.",
      +  "type": "string"
      +}
    • removedInput schema / required
      Removed value: -[
      -  "symbol_name",
      -  "new_source"
      -]
  2. Addedv4.0.0
  3. Removedv1.0.2
  4. Addedv1.0.1

TDQS

B3.2/5.0
Behavior3/5

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

Annotations already declare destructiveHint=true, readOnlyHint=false, and idempotentHint=false, so the safety profile is covered. The description adds that the replacement is whole-symbol ('whole function or class') and needs no prior read, which is a meaningful behavioral detail. It stops short of explaining disambiguation behavior (file_path) or what happens on multiple/zero matches.

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?

A single tight sentence with zero waste, front-loading the verb and resource. It is appropriately sized for a focused mutation tool, though the value clause ('no Read needed') is slightly marketing-flavored rather than instructional.

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

Completeness3/5

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

For a destructive mutation tool with an 8-parameter schema (including multiple aliases) and no output schema, the description covers the core action and the whole-symbol semantics but omits alias handling, disambiguation behavior, and error/edge-case handling. Annotations cover safety, but the description is somewhat thin relative to the schema's complexity.

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

Parameters3/5

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

Schema description coverage is 100%, so all eight parameters including the alias fields are already documented in the schema. The description only reinforces the 'by name' keying (symbol_name) and adds nothing about the alias params or project/file_path scoping. Baseline 3 is appropriate when the schema does the heavy lifting.

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

Purpose4/5

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

States a specific verb ('rewrite') and resource ('whole function or class by name'), making the operation clear. The phrase 'no Read needed' hints at the value proposition and helps distinguish it from read-oriented siblings like get_function_source. However, it doesn't explicitly contrast itself with the many other edit siblings (edit_lines_in_symbol, insert_near_symbol, move_symbol).

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

Usage Guidelines2/5

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

There is no when-to-use or when-not-to-use guidance and no named alternative. The agent is left to infer from 'whole function or class' that this is for full-symbol replacement versus partial edits, but nothing states which sibling to pick instead. The implicit efficiency claim ('no Read needed') is context, not routing guidance.

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