Skip to main content
Glama

apply_rewrite

Writes an approved rewrite into the manuscript file after diff approval, preserving encoding, line endings, and creating a backup.

Instructions

Write a proposed rewrite into the manuscript file (atomic write, original encoding and line endings kept, backup in .citecheck/backups). Only call after the user approved the diff.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rewrite_idYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4/5.0
Behavior4/5

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

With no annotations present, the description carries the full disclosure burden and does well: atomic write, preservation of original encoding and line endings, and a backup location (.citecheck/backups) are all concrete behavioral traits. It doesn't state whether the rewrite is consumed/marked applied, idempotency, or failure behavior, which are meaningful gaps for a file mutation.

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?

Two tight sentences, action and side effects front-loaded, with the gating condition as the closing clause. No filler and nothing redundant with the schema.

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 one-parameter mutation with no output schema, the description covers the essentials an agent needs: what it writes, the safety guarantees, and the approval prerequisite. Missing details about the applied rewrite's subsequent state and error cases are minor against what is provided.

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 description coverage is 0% for the single rewrite_id parameter, so the schema adds no meaning. The description never explains where rewrite_id comes from (presumably list_rewrites/propose_rewrite) or its expected form, though the name and surrounding workflow make it largely inferable.

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 ('Write a proposed rewrite into the manuscript file'), which clearly implies committing an existing proposal as opposed to propose_rewrite's drafting step. It does not explicitly name the sibling tools (revert_rewrite, discard_rewrite, list_rewrites), so the differentiation is inferential rather than spelled out.

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?

'Only call after the user approved the diff' is an explicit, actionable precondition that routes the agent correctly in the propose/approve/apply workflow. It stops short of naming the alternatives (e.g. use propose_rewrite first, discard_rewrite to abandon), which would make it a 5.

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