Skip to main content
Glama

edit_source_file

Modify one source file with exact unique replacements and the SHA256 from read_source_file, or create a new file in an existing directory. Requires source write opt-in and never deletes files.

Instructions

Edit one source file using exact unique replacements and the SHA256 returned by read_source_file. NEW creates a file exclusively in an existing directory using content. Requires source write opt-in; never deletes files.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
contentNo
replacementsNo
expected_sha256Yes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

A3.9/5.0
Behavior4/5

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

Annotations only declare destructiveHint=false; the description adds real value beyond that by asserting 'never deletes files', the write opt-in requirement, and exclusive-create semantics for NEW. It does not explain the failure mode on a SHA mismatch or what happens when old_text is non-unique, both of which matter for an editing 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?

Three dense sentences with the edit mechanism front-loaded and the create variant and safety caveats following. No filler, though the 'NEW creates a file exclusively...' sentence is terse enough to be slightly ambiguous about the exclusive-create failure behavior.

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?

For a mutation tool with no output schema and minimal annotations, the description covers the essential behaviors: hash precondition, opt-in write permission, no-delete guarantee, and create-vs-edit modes. It stops short of describing return values or error conditions, which are left entirely unspecified.

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 coverage is 0%, so the description must carry the parameter burden. It clarifies expected_sha256 (from read_source_file) and content (used by NEW mode), and implies replacements via 'exact unique replacements', but never covers path or explains that expected_sha256 is required even in create mode.

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 and resource ('Edit one source file') plus the mechanism (exact unique replacements, SHA256 from read_source_file), and covers the create-new variant. It references the relevant sibling for obtaining the hash, but does not distinguish itself from commit_candidate or explain the read→edit→commit relationship.

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

Usage Guidelines4/5

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

Gives clear preconditions: use the SHA256 returned by read_source_file, and a source write opt-in is required. It does not state when-not to use it, e.g. what separates this from commit_candidate or how it interacts with the broader candidate workflow.

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