Skip to main content
Glama

edit_preview

Preview where specific text matches in a file to verify anchor uniqueness before making edits. Returns match count, line numbers, and snippets without modifying the file.

Instructions

Show where old_string would match in a file, without editing it.

Returns the match count, 1-based line numbers, and short snippets so you can confirm an anchor is unique before calling edit. Read-only and cheap (kept under ~200 tokens), so use it freely as a probe. Raises an error on a binary file or an empty old_string.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesFile path to search (absolute, or relative to root).
old_stringYesAnchor text to locate. Must match exactly, including whitespace and indentation. Cannot be empty.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathNo
foundNo
contextNo
truncatedNo
match_countNo
line_numbersNo
Behavior5/5

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

No annotations provided, but the description fully discloses behavior: read-only, cheap (~200 tokens), returns match count/line numbers/snippets, raises errors on binary files or empty old_string. This is thorough and exceeds the burden.

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?

Four sentences, front-loaded with purpose, no wasted words. Each sentence earns its place with specific information about behavior, usage, and limitations.

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

Completeness5/5

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

Given simple tool with 2 params and high schema coverage, description covers all essential aspects: purpose, usage guidance, behavioral details, error conditions, and return values. No gaps.

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 has 100% coverage, and description adds extra nuance: old_string 'must match exactly, including whitespace and indentation' and 'Cannot be empty.' Path clarification 'absolute, or relative to root' adds value beyond 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 'Show where `old_string` would match in a file, without editing it.' This is a specific verb-resource combination and distinguishes from sibling `edit` which performs actual edits.

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?

Explicitly advises 'use it freely as a probe' and 'confirm an anchor is unique before calling `edit`.' Provides context for when to use, though does not explicitly list when not to use (implied by contrast with `edit` and `grep`).

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/CoderDayton/semantic-cache-mcp'

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