Carve

v0.1.13
io.github.markup-carve/carve-mcp Checked 3 hours ago Published 19 days ago

Parse, lint, format, render, and migrate Carve documents through MCP.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

carve_lint Lint Carve

Check Carve source for author-facing problems and silent degradation.

ParameterTypeDescription
source *stringDocument source (maximum 1000000 UTF-8 bytes)
platformsarray

carve_diagnose_and_fix Diagnose and fix Carve

Diagnose Carve source, propose bounded fixes, and optionally apply selected safe fix IDs with forward and undo patches. Writer-review fixes are never applied automatically.

ParameterTypeDescription
source *stringDocument source (maximum 1000000 UTF-8 bytes)
applyFixIdsarray
platformsarray

carve_format Format Carve

Format Carve source canonically and report any lossy raw-format nodes.

ParameterTypeDescription
source *stringDocument source (maximum 1000000 UTF-8 bytes)
alignTablesbooleanPad table cells so columns align.

carve_render Render Carve

Render Carve to HTML, Markdown, plain text, or ANSI terminal text, with loss reporting.

ParameterTypeDescription
source *stringDocument source (maximum 1000000 UTF-8 bytes)
target *string
allowRawHtmlbooleanPass trusted raw HTML through on HTML output. Disabled by default.
asciiHeadingIdsstringHeading ID policy; explicit values override the preset.
extensionsarrayOpt-in extensions; semantic-spans is HTML-only.
lowercaseHeadingIdsbooleanLowercase generated heading IDs; explicit values override the preset.
maxRenderLossesintegerMaximum detailed losses to return.
presetstringportable lowercases IDs and transliterates where possible; static-html is HTML-only.
sanitizeUrlsbooleanReport blocked authored URL schemes as render losses. A dangerous scheme is always blanked; this server never emits one.
smartTypographyfalse is source; { quotes: false } keeps typed quotes only.
strictLossesbooleanFail instead of returning output when a raw-format node would be dropped.

carve_check_targets Check Carve publishing targets

Compare one Carve document across HTML, Markdown, plain text, ANSI, GitHub, WordPress, and PDF-stage profiles, returning target-specific warnings, losses, and fallbacks.

ParameterTypeDescription
source *stringDocument source (maximum 1000000 UTF-8 bytes)
targetsarray

carve_parse Parse Carve

Parse and resolve Carve into its position-aware interchange AST.

ParameterTypeDescription
source *stringDocument source (maximum 1000000 UTF-8 bytes)
positionsbooleanInclude source positions.

carve_create_ast_patch Create structured AST patch

Compare two PART 12 Carve ASTs and return position-independent add, replace, and remove operations.

ParameterTypeDescription
after *PART 12 AST after the edit (maximum 1000000 JSON bytes)
before *PART 12 AST before the edit (maximum 1000000 JSON bytes)

carve_apply_ast_patch Apply structured AST patch

Validate and apply structured operations to a PART 12 Carve AST, returning the patched AST and canonical Carve source.

ParameterTypeDescription
ast *PART 12 base AST (maximum 1000000 JSON bytes)
operations *arrayStructured patch operations (maximum 1000 operations and 1000000 JSON bytes)

carve_select_ast_nodes Find AST nodes by semantic selector

Resolve an element ID on any node, a heading ID, footnote label, node type, or current AST path to reviewable PART 12 AST paths without silently choosing among multiple matches.

ParameterTypeDescription
ast *PART 12 AST (maximum 1000000 JSON bytes)
selector *object

carve_get_block Get Carve source blocks

Return the exact source text of the nodes a selector matches, or a heading's section, with UTF-8 byte offsets and the source sha256. No AST unless includeAst.

ParameterTypeDescription
selector *object
source *stringDocument source (maximum 1000000 UTF-8 bytes)
includeAstboolean
scopestringsection: a heading through its content, up to the next heading of the same or higher level.

carve_replace_source Replace Carve source of one node

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.

ParameterTypeDescription
selector *object
source *stringDocument source (maximum 1000000 UTF-8 bytes)
text *stringCarve source that replaces the selected range.
expectedSha256stringSource sha256 from carve_get_block; a mismatch refuses the edit.
includeSourcebooleanAlso return the whole edited source.
scopestringsection: a heading through its content, up to the next heading of the same or higher level.

carve_plan_ast_edit Plan a semantic AST edit

Plan one or more atomic semantic AST edits and return a human-readable, reversible, stale-guarded source patch without writing the document.

ParameterTypeDescription
edit *object
selector *object
source *stringDocument source (maximum 1000000 UTF-8 bytes)
thenarrayAdditional atomic edits resolved against the original source (maximum 100 total steps).

carve_create_reversible_ast_patch Create reversible AST patch

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

ParameterTypeDescription
after *PART 12 AST after the edit (maximum 1000000 JSON bytes)
before *PART 12 AST before the edit (maximum 1000000 JSON bytes)

carve_apply_reversible_ast_patch Preview reversible AST patch as source edits

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

ParameterTypeDescription
patch *objectVersion 1 reversible AST patch (maximum 1000000 JSON bytes and 1000 operations per direction)
source *stringDocument source (maximum 1000000 UTF-8 bytes)
includeAstbooleanAlso return the patched AST.
inversebooleanApply inverse operations to undo the patch.

carve_migrate Migrate to Carve

Migrate HTML, Markdown, Djot, or BBCode source to Carve with version 2 fidelity diagnostics.

ParameterTypeDescription
format *string
source *stringDocument source (maximum 1000000 UTF-8 bytes)
markdownDialectobjectOpt-in Markdown flavor constructs; valid only for Markdown input.