Skip to main content
Glama
markup-carve

carve-mcp

Official
by markup-carve

Replace Carve source of one node

carve_replace_source
Read-only

Replace a selected Carve node or heading section's exact source bytes, validating parse and lint to refuse unsafe edits and returning forward and undo patches.

Instructions

Splice Carve text over the exact source bytes of one selected node or heading section, leaving every other byte untouched. Refuses if the node kind changes, the rest of the document parses differently, or new lint findings appear. Returns forward and undo patches.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYesCarve source that replaces the selected range.
scopeNosection: a heading through its content, up to the next heading of the same or higher level.node
sourceYesDocument source (maximum 1000000 UTF-8 bytes)
selectorYes
includeSourceNoAlso return the whole edited source.
expectedSha256NoSource sha256 from carve_get_block; a mismatch refuses the edit.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
endYes
lintYes
matchYes
patchYes
startYes
writeNo
sha256Yes
sourceNo
undoPatchYes
resultSha256Yes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.1.6

TDQS

A4.2/5.0
Behavior5/5

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

Discloses traits nothing in the annotations or schema covers: the atomicity guarantee ("leaving every other byte untouched") and three concrete refusal conditions (node kind change, re-parse divergence, new lint findings), plus the forward/undo patch return. This also resolves the apparent tension with readOnlyHint=true – the tool computes and returns patches rather than mutating state directly, consistent with the create/apply sibling split.

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 sentences, each earning its place: scope of edit, failure conditions, return value. The most decision-relevant information (exact-bytes splice) is front-loaded with zero filler.

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 need not be detailed, and the failure semantics and scope are covered. It stops short of explaining how a caller produces a valid selector or the expectedSha256 precondition flow (deferred to carve_get_block / carve_select_ast_nodes), which a mutation-adjacent tool could reasonably spell out.

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 coverage is 83%, so the schema already documents text, source, scope, includeSource and expectedSha256; the description adds only the mapping of "node or heading section" onto the scope enum. The selector's five kind values are left entirely to the schema, and no extra semantics are contributed beyond

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?

States a precise verb ("Splice Carve text over the exact source bytes") and a bounded resource ("one selected node or heading section"), and the byte-exact framing distinguishes it from the AST-patch siblings. An agent can tell this is a surgical, range-scoped replacement rather than a document-wide edit.

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 implied by "one selected node or heading section" (i.e. requires a selector target), but there is no explicit when-to-use versus carve_create_ast_patch / carve_create_reversible_ast_patch, and no stated prerequisite such as obtaining the selector or sha256 first. Adequate but leaves routing to inference.

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