Skip to main content
Glama
markup-carve

carve-mcp

Official
by markup-carve

Preview reversible AST patch as source edits

carve_apply_reversible_ast_patch
Read-only

Verify a reversible AST patch against source, then apply or undo it to return a minimal stale-guarded UTF-8 edit without writing files.

Instructions

Verify a reversible AST patch against source, apply or undo it, and return a minimal stale-guarded UTF-8 source edit without writing files.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
patchYesVersion 1 reversible AST patch (maximum 1000000 JSON bytes and 1000 operations per direction)
sourceYesDocument source (maximum 1000000 UTF-8 bytes)
inverseNoApply inverse operations to undo the patch.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
astYes
sourceYes
directionYes
sourcePatchYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv0.1.5
    • addedOutput schema / properties / sourcePatch / properties / edits / items / properties / end / description
      Added value: +"Exclusive UTF-8 byte offset"
    • addedOutput schema / properties / sourcePatch / properties / edits / items / properties / start / description
      Added value: +"Inclusive UTF-8 byte offset"
    • addedOutput schema / properties / sourcePatch / properties / unresolved / items / properties / end / description
      Added value: +"Exclusive UTF-8 byte offset"
    • addedOutput schema / properties / sourcePatch / properties / unresolved / items / properties / start / description
      Added value: +"Inclusive UTF-8 byte offset"
  2. Changed1 schema field changedv0.1.4
    • addedInput schema / properties / patch / properties / changes
      Added value: +{
      +  "items": {
      +    "additionalProperties": {},
      +    "properties": {
      +      "kind": {
      +        "enum": [
      +          "add",
      +          "remove",
      +          "replace"
      +        ],
      +        "type": "string"
      +      },
      +      "path": {
      +        "type": "string"
      +      },
      +      "summary": {
      +        "type": "string"
      +      },
      +      "target": {
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "kind",
      +      "path",
      +      "target",
      +      "summary"
      +    ],
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
  3. Addedv0.1.3

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true and destructiveHint=false, and the description adds meaningful behavioral details: it is stale-guarded, returns a minimal UTF-8 source edit, and does not write files. This goes beyond the structured annotations and clarifies that 'apply or undo' is non-destructive.

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 entire description is a single front-loaded sentence that packs purpose, behavior, and key constraints without wasted words. Every element ('verify', 'apply or undo', 'minimal stale-guarded UTF-8', 'without writing files') earns its place.

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 tool with three parameters, nested patch schema, output schema, and strong annotations, the description is nearly complete. It covers the non-obvious behavioral contract (no file writes, stale guard, undo support). It lacks only explicit routing against siblings like carve_apply_ast_patch, which is somewhat mitigated by the reversible/non-writing language.

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 100%, so source, patch, and inverse are already fully described in the schema. The description reinforces the reversible-patch context but adds no parameter-specific meaning beyond the schema, matching the baseline of 3 for high coverage.

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 states a specific verb-resource relationship: verify or apply/undo a reversible AST patch and return a source edit. It explicitly notes that no files are written, which distinguishes it from the likely file-writing sibling carve_apply_ast_patch. The reversible nature and undo capability make its role unambiguous.

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 provides clear usage context: to verify and safely apply or undo a reversible patch without persisting changes. It implies when this tool is appropriate, but it does not explicitly name alternatives or state when not to use it. This is clear context without exclusions, so it earns a 4.

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