Skip to main content
Glama

apply_edit

Apply edits to files using either precise workspace changes or text-matching replacement when positions are uncertain.

Instructions

Apply an edit to a file. Two modes: (1) WorkspaceEdit mode — pass workspace_edit with positional changes returned by rename_symbol or format_document; (2) Text-match mode — pass file_path + old_text + new_text to find and replace text without needing line/column positions. Text-match tries exact match first, then whitespace-normalised line match (handles indentation differences). Use text-match when AI-generated positions would be imprecise.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workspace_editNo
file_pathNo
old_textNo
new_textNo
Behavior4/5

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

With no annotations provided, the description carries full burden and does well by explaining behavioral traits: two operational modes, how text-match mode works (exact match first, then whitespace-normalized line match), and handling of indentation differences. It doesn't cover error handling or permissions, but provides substantial context.

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 efficiently structured: first sentence states purpose, then clearly explains two modes with their parameter requirements and use cases. Every sentence adds value with zero waste, and it's appropriately sized for the tool's complexity.

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 no annotations, 0% schema coverage, no output schema, and 4 parameters with nested objects, the description does an excellent job covering purpose, usage, parameters, and behavior. It could mention response format or error cases, but is largely complete for the tool's complexity.

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

Parameters5/5

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

With 0% schema description coverage for 4 parameters, the description fully compensates by explaining parameter semantics: workspace_edit for mode 1, and file_path + old_text + new_text for mode 2. It clarifies the mutual exclusivity and purpose of each parameter set beyond the bare 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?

The description clearly states the tool's purpose: 'Apply an edit to a file' with two specific modes (WorkspaceEdit and text-match). It distinguishes from siblings by specifying it's for applying edits, unlike format_document (which returns edits) or rename_symbol (which returns positional changes).

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?

The description provides explicit guidance on when to use each mode: WorkspaceEdit mode for positional changes from rename_symbol or format_document, and text-match mode when AI-generated positions would be imprecise. It clearly differentiates use cases without alternatives needed among siblings.

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/blackwell-systems/agent-lsp'

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