Skip to main content
Glama
markup-carve

carve-mcp

Official
by markup-carve

Create reversible AST patch

carve_create_reversible_ast_patch
Read-only

Compare two PART 12 ASTs and generate a reversible patch with forward and inverse operations, including semantic stale-edit fingerprints for safe migration.

Instructions

Compare two PART 12 ASTs and return forward and inverse operations with semantic stale-edit fingerprints.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
afterYesPART 12 AST after the edit (maximum 1000000 JSON bytes)
beforeYesPART 12 AST before the edit (maximum 1000000 JSON bytes)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
changesYes
forwardYes
inverseYes
versionYes
afterFingerprintYes
beforeFingerprintYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.1.4
    • addedOutput schema / 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"
      +}
    • changedOutput schema / required
      Previous value: -[
      -  "version",
      -  "forward",
      -  "inverse",
      -  "beforeFingerprint",
      -  "afterFingerprint"
      -]New value: +[
      +  "version",
      +  "forward",
      +  "inverse",
      +  "beforeFingerprint",
      +  "afterFingerprint",
      +  "changes"
      +]
  2. Addedv0.1.3

TDQS

A4/5.0
Behavior3/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's 'return' wording is consistent with that. It adds no major behavioral detail beyond mentioning the generated artifacts; it does not contradict the annotations.

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?

One compact sentence carries the action, inputs, and output without repetition or filler. It is front-loaded and every clause 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?

With only two fully documented parameters and an output schema available, the description does not need to enumerate return values. The only slight gap is that 'semantic stale-edit fingerprints' is domain jargon with no expansion, but it is coherent within the tool family.

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 the input schema already documents before and after. The description adds the domain constraint that they are PART 12 ASTs, which the schema properties also mention, but it contributes little meaning beyond that.

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?

Description opens with a specific verb ('Compare') and a concrete resource ('two PART 12 ASTs'), then specifies the deliverable: forward and inverse operations plus semantic stale-edit fingerprints. This clearly separates it from the non-reversible carve_create_ast_patch and the apply-family siblings.

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 wording 'Compare... and return' makes it evident this tool is for analysis/diffing rather than applying changes, which differentiates it from carve_apply_reversible_ast_patch and carve_apply_ast_patch. It does not spell out exclusions, but the context is clear enough for an agent to choose it when an inverse patch is required.

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