Skip to main content
Glama
eduardoddddddd

DesktopCommanderPy

edit_file_diff

Replace exact text snippets in files with new content, using precise matching to avoid unintended changes. Use empty string to delete text.

Instructions

Edit a file by replacing an exact text snippet with new content.

This is the preferred editing approach: send only the changed part instead of rewriting the whole file. The old_string must match exactly (whitespace, indentation) and should include enough context to be unique.

Raises ValueError if old_string is not found or found more/fewer times than expected_replacements.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesAbsolute path to the file to edit.
old_stringYesExact text to find in the file (must be unique or use expected_replacements).
new_stringYesReplacement text. Use empty string to delete old_string.
expected_replacementsNoExpected number of occurrences to replace. Default 1.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior3/5

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

With no annotations, the description carries the burden. It discloses error behavior (ValueError if old_string not found) and matching requirements, but does not describe success output, atomicity, or file existence requirements. The output schema exists but is not referenced.

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?

The description is concise with three sentences, front-loading the primary action. Every sentence provides useful information; no redundancy or fluff.

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?

Given the tool's complexity (4 params, no annotations, output schema exists), the description covers the edit mechanism, matching requirements, and error conditions. It lacks specifics on return value and preconditions (e.g., file must exist), but the output schema likely covers return details. Overall sufficient.

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 baseline is 3. The description adds valuable nuance: emphasizing exact matching for whitespace/indentation, uniqueness, and the role of `expected_replacements`. This goes beyond the schema's parameter descriptions.

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?

The description clearly states the tool's action (edit a file by replacing text), specifies the mechanism (exact snippet replacement), and distinguishes it from `write_file` by noting it only sends the changed part. The verb and resource are explicit.

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?

The description indicates this is the preferred editing approach and advises on proper use (matching whitespace, providing context). However, it does not explicitly state when not to use it or mention alternatives like `write_file` for creating new files.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/eduardoddddddd/DesktopCommanderPy'

If you have feedback or need assistance with the MCP directory API, please join our Discord server