Skip to main content
Glama

mavis_edit

Perform targeted text replacement in files. Replaces the first exact match by default, or all matches if requested; errors if no match found.

Instructions

Edit a file by replacing a specific string with new text. Default: replaces the FIRST occurrence only. If old_text is not found or matches multiple times and all_occurrences is false, returns an error. Use this for targeted edits; use mavis_write for full rewrites.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cwdNoSubdirectory to resolve path against.
pathYesPath relative to workspace root (or absolute within workspace).
new_textYesThe replacement text.
old_textYesThe exact text to find. Must match exactly (whitespace included).
all_occurrencesNoReplace ALL occurrences. Default: false (only first).
Behavior4/5

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

With no annotations, the description carries the burden of disclosing behavior. It reveals the default first-occurrence behavior, error handling for missing/multiple matches, and the effect of all_occurrences. This adds significant context beyond a simple 'edit' intent, though it omits details about file existence or permissions.

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?

Three concise sentences that lead with the core action, then behavioral defaults/errors, and end with usage guidance. Every sentence earns its place with no redundancy or filler.

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?

For a simple edit tool with no output schema, the description provides enough context: what it does, default behavior, error conditions, and when to use an alternative. It is complete given the tool's simplicity and the schema's rich parameter documentation.

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?

The input schema covers all parameters with 100% coverage, so baseline is 3. The description adds value by explaining error behavior tied to old_text and all_occurrences, and clarifying the default replacement behavior. This semantic context goes beyond the schema's simple 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 action: 'Edit a file by replacing a specific string with new text.' It specifies the resource and the operation, and explicitly distinguishes itself from mavis_write for full rewrites, making it distinct from sibling tools.

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?

Provides explicit guidance: 'Use this for targeted edits; use mavis_write for full rewrites.' Also explains error conditions when old_text is not found or when multiple matches occur with all_occurrences=false, which helps the agent decide when to call this tool.

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/GiovanniCm157/mavis-mcp-server'

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