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 and apply or undo a reversible AST patch against Carve source, returning a 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.
includeAstNoAlso return the patched AST.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
astNo
sha256No
sourceYes
directionYes
sourcePatchYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv0.1.6
    • addedInput schema / properties / includeAst
      Added value: +{
      +  "default": false,
      +  "description": "Also return the patched AST.",
      +  "type": "boolean"
      +}
    • addedOutput schema / properties / sha256
      Added value: +{
      +  "type": "string"
      +}
    • changedOutput schema / required
      Previous value: -[
      -  "direction",
      -  "ast",
      -  "source",
      -  "sourcePatch"
      -]New value: +[
      +  "direction",
      +  "source",
      +  "sourcePatch"
      +]
  2. 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"
  3. 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"
      +}
  4. Addedv0.1.3

TDQS

A3.8/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 is consistent with them (it explicitly does not write files). It adds meaningful value beyond the annotations: stale-guarding, verification against source before application, and minimal resulting edits. It stops short of describing failure modes for a stale fingerprint.

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?

A single dense sentence that front-loads the operations (verify, apply, undo) and the key differentiator (no file writes). No filler; every clause carries information.

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?

With an output schema present, return values needn't be explained, and annotations cover the safety profile. For a nested-patch tool the description is largely sufficient, though it could clarify what 'stale-guarded' means operationally and how a failed verification surfaces.

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 all four parameters are documented in the schema, including the inverse toggle and includeAst. The description adds only the notion of stale-guarding/fingerprints, not new per-parameter semantics. Baseline 3 applies.

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?

The description states specific verbs (verify, apply, undo) and a clear resource (reversible AST patch), plus a distinguishing scope clause: 'return a minimal stale-guarded UTF-8 source edit without writing files.' It doesn't explicitly name the sibling apply tool it differs from, but the 'without writing files' framing does separate it from a write-performing apply.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is only implied through the 'without writing files' phrasing and the verify-then-apply flow. There is no explicit when/when-not guidance and no named alternative among siblings like carve_apply_ast_patch or carve_apply_reversible... helpers, leaving the routing inference to the agent.

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