Skip to content

MCP Tools Reference

This page documents all MCP tools available when Claude (or other AI assistants) connects to VMark.

VMark exposes a set of composite tools, protocol tools, and resources — all documented below. Composite tools use an action parameter to select the operation — this reduces token overhead while keeping all capabilities accessible.

Recommended Workflow

For most writing tasks, you only need a handful of actions:

Understand: structureget_digest, documentsearchRead: structureget_section, documentread_paragraph / get_contentWrite: structureupdate_section / insert_section, documentwrite_paragraph / smart_insertControl: editorundo / redo, suggestionsaccept / rejectFiles: workspacesave, tabsswitch / list

The remaining actions provide fine-grained control for advanced automation scenarios.

Mermaid Diagrams

When using AI to generate Mermaid diagrams via MCP, consider installing the mermaid-validator MCP server — it catches syntax errors using the same Mermaid v11 parsers before diagrams reach your document.


document

Read, write, search, and transform document content. 12 actions.

All actions accept an optional windowId (string) parameter to target a specific window. Defaults to the focused window.

get_content

Get the full document content as markdown text.

set_content

Replace the entire document content.

ParameterTypeRequiredDescription
contentstringYesNew document content (markdown supported).

Empty Documents Only

For safety, this action is only allowed when the target document is empty. For non-empty documents, use insert_at_cursor, apply_diff, or selectionreplace instead — these create suggestions that require user approval.

insert_at_cursor

Insert text at the current cursor position.

ParameterTypeRequiredDescription
textstringYesText to insert (markdown supported).

Returns: { message, position, suggestionId?, applied }

Suggestion System

By default, this action creates a suggestion that requires user approval. The text appears as ghost text preview. Users can accept (Enter) or reject (Escape). If Auto-approve edits is enabled in Settings → Integrations, changes are applied immediately.

insert_at_position

Insert text at a specific character position.

ParameterTypeRequiredDescription
textstringYesText to insert (markdown supported).
positionnumberYesCharacter position (0-indexed).

Returns: { message, position, suggestionId?, applied }

Search for text in the document.

ParameterTypeRequiredDescription
querystringYesText to search for.
caseSensitivebooleanNoCase-sensitive search. Default: false.

Returns: Array of matches with positions and line numbers.

replace_in_source

Replace text at the markdown source level, bypassing ProseMirror node boundaries.

ParameterTypeRequiredDescription
searchstringYesText to find in the markdown source.
replacestringYesReplacement text (markdown supported).
allbooleanNoReplace all occurrences. Default: false.

Returns: { count, message, suggestionIds?, applied }

When to use

Use apply_diff first — it's faster and more precise. Fall back to replace_in_source only when the search text crosses formatting boundaries (bold, italic, links, etc.) and apply_diff can't find it.

batch_edit

Apply multiple operations atomically.

ParameterTypeRequiredDescription
operationsarrayYesArray of operations (max 100).
baseRevisionstringYesExpected revision for conflict detection.
requestIdstringNoIdempotency key.
modestringNodryRun to preview without applying. Apply-vs-suggest is controlled by user setting.

Each operation requires type (update, insert, delete, format, or move), nodeId, and optionally text/content.

Returns: { success, changedNodeIds[], suggestionIds[] }

apply_diff

Find and replace text with match policy control.

ParameterTypeRequiredDescription
originalstringYesText to find.
replacementstringYesText to replace with.
baseRevisionstringYesExpected revision for conflict detection.
matchPolicystringNofirst, all, nth, or error_if_multiple. Default: first.
nthnumberNoWhich match to replace (0-indexed, for nth policy).
scopeQueryobjectNoScope filter to narrow search.
modestringNodryRun to preview without applying. Apply-vs-suggest is controlled by user setting.

Returns: { matchCount, appliedCount, matches[], suggestionIds[] }

replace_anchored

Replace text using context anchoring for precise targeting.

ParameterTypeRequiredDescription
anchorobjectYes{ text, beforeContext, afterContext }
replacementstringYesReplacement text.
baseRevisionstringYesExpected revision for conflict detection.
modestringNodryRun to preview without applying. Apply-vs-suggest is controlled by user setting.

read_paragraph

Read a paragraph from the document by index or content match.

ParameterTypeRequiredDescription
targetobjectYes{ index: 0 } or { containing: "text" }
includeContextbooleanNoInclude surrounding paragraphs. Default: false.

Returns: { index, content, wordCount, charCount, position, context? }

write_paragraph

Modify a paragraph in the document.

ParameterTypeRequiredDescription
baseRevisionstringYesDocument revision for conflict detection.
targetobjectYes{ index: 0 } or { containing: "text" }
operationstringYesreplace, append, prepend, or delete.
contentstringConditionalNew content (required except for delete).
modestringNodryRun to preview without applying. Apply-vs-suggest is controlled by user setting.

Returns: { success, message, suggestionId?, applied, newRevision? }

smart_insert

Insert content at common document locations.

ParameterTypeRequiredDescription
baseRevisionstringYesDocument revision for conflict detection.
destinationvariesYesWhere to insert (see below).
contentstringYesMarkdown content to insert.
modestringNodryRun to preview without applying. Apply-vs-suggest is controlled by user setting.

Destination options:

  • "end_of_document" — Insert at the end
  • "start_of_document" — Insert at the beginning
  • { after_paragraph: 2 } — Insert after paragraph at index 2
  • { after_paragraph_containing: "conclusion" } — Insert after paragraph containing text
  • { after_section: "Introduction" } — Insert after section heading

Returns: { success, message, suggestionId?, applied, newRevision?, insertedAt? }

When to Use

  • Structured documents (with headings): Use structureget_section, update_section, insert_section
  • Flat documents (no headings): Use documentread_paragraph, write_paragraph, smart_insert
  • End of document: Use documentsmart_insert with "end_of_document"

structure

Document structure queries and section operations. 8 actions.

All actions accept an optional windowId parameter.

get_ast

Get the document's abstract syntax tree.

ParameterTypeRequiredDescription
projectionstring[]NoFields to include: id, type, text, attrs, marks, children.
filterobjectNoFilter by type, level, contains, hasMarks.
limitnumberNoMax results.
offsetnumberNoSkip count.
afterCursorstringNoNode ID for cursor pagination.

Returns: Full AST with node types, positions, and content.

get_digest

Get a compact digest of the document structure.

Returns: { revision, title, wordCount, charCount, outline[], sections[], blockCounts, hasImages, hasTables, hasCodeBlocks, languages[] }

list_blocks

List all blocks in the document with their node IDs.

ParameterTypeRequiredDescription
queryobjectNoFilter by type, level, contains, hasMarks.
projectionstring[]NoFields to include.
limitnumberNoMax results.
afterCursorstringNoNode ID for cursor pagination.

Returns: { revision, blocks[], hasMore, nextCursor? }

Node IDs use prefixes: h-0 (heading), p-0 (paragraph), code-0 (code block), etc.

resolve_targets

Pre-flight check for mutations — find nodes by query.

ParameterTypeRequiredDescription
queryobjectYesQuery criteria: type, level, contains, hasMarks.
maxResultsnumberNoMax candidates.

Returns: Resolved target positions and types.

get_section

Get content of a document section (heading and its content until next same-or-higher level heading).

ParameterTypeRequiredDescription
headingstring | objectYesHeading text (string) or { level, index }.
includeNestedbooleanNoInclude subsections.

Returns: Section content with heading, body, and positions.

update_section

Update a section's content.

ParameterTypeRequiredDescription
baseRevisionstringYesDocument revision.
targetobjectYes{ heading, byIndex, or sectionId }
newContentstringYesNew section content (markdown).
modestringNodryRun to preview without applying. Apply-vs-suggest is controlled by user setting.

insert_section

Insert a new section.

ParameterTypeRequiredDescription
baseRevisionstringYesDocument revision.
afterobjectNoSection target to insert after.
sectionHeadingobjectYes{ level, text } — heading level (1-6) and text.
contentstringNoSection body content.
modestringNodryRun to preview without applying. Apply-vs-suggest is controlled by user setting.

move_section

Move a section to a new location.

ParameterTypeRequiredDescription
baseRevisionstringYesDocument revision.
sectionobjectYesSection to move: { heading, byIndex, or sectionId }.
afterobjectNoSection target to move after.
modestringNodryRun to preview without applying. Apply-vs-suggest is controlled by user setting.

selection

Read and manipulate text selection and cursor. 5 actions.

All actions accept an optional windowId parameter.

get

Get the current text selection.

Returns: { text, range: { from, to }, isEmpty }

set

Set the selection range.

ParameterTypeRequiredDescription
fromnumberYesStart position (inclusive).
tonumberYesEnd position (exclusive).

TIP

Use the same value for from and to to position the cursor without selecting text.

replace

Replace selected text with new text.

ParameterTypeRequiredDescription
textstringYesReplacement text (markdown supported).

Returns: { message, range, originalContent, suggestionId?, applied }

Suggestion System

By default, this action creates a suggestion that requires user approval. The original text appears with strikethrough, and the new text appears as ghost text. If Auto-approve edits is enabled in Settings → Integrations, changes are applied immediately.

get_context

Get text surrounding the cursor for context understanding.

ParameterTypeRequiredDescription
linesBeforenumberNoLines before cursor. Default: 3.
linesAfternumberNoLines after cursor. Default: 3.

Returns: { before, after, currentLine, currentParagraph, block }

The block object contains:

FieldTypeDescription
typestringBlock type: paragraph, heading, codeBlock, blockquote, etc.
levelnumberHeading level 1-6 (only for headings)
languagestringCode language (only for code blocks with language set)
inListstringList type if inside a list: bullet, ordered, or task
inBlockquotebooleantrue if inside a blockquote
inTablebooleantrue if inside a table
positionnumberDocument position where the block starts

set_cursor

Set the cursor position (clears selection).

ParameterTypeRequiredDescription
positionnumberYesCharacter position (0-indexed).

format

Text formatting, block types, lists, and list batch operations. 10 actions.

All actions accept an optional windowId parameter.

toggle

Toggle a formatting mark on the current selection.

ParameterTypeRequiredDescription
markstringYesbold, italic, code, strike, underline, or highlight

Create a hyperlink on the selected text.

ParameterTypeRequiredDescription
hrefstringYesLink URL.
titlestringNoLink title (tooltip).

Remove hyperlink from the selection. No additional parameters.

clear

Remove all formatting from the selection. No additional parameters.

set_block_type

Convert the current block to a specific type.

ParameterTypeRequiredDescription
blockTypestringYesparagraph, heading, codeBlock, or blockquote
levelnumberConditionalHeading level 1-6 (required for heading).
languagestringNoCode language (for codeBlock).

insert_hr

Insert a horizontal rule (---) at the cursor. No additional parameters.

toggle_list

Toggle list type on the current block.

ParameterTypeRequiredDescription
listTypestringYesbullet, ordered, or task

indent_list

Increase indentation of the current list item. No additional parameters.

outdent_list

Decrease indentation of the current list item. No additional parameters.

list_modify

Batch modify a list's structure and content.

ParameterTypeRequiredDescription
baseRevisionstringYesDocument revision.
targetobjectYes{ listId }, { selector }, or { listIndex }
operationsarrayYesArray of list operations.
modestringNodryRun to preview without applying. Apply-vs-suggest is controlled by user setting.

Operations: add_item, delete_item, update_item, toggle_check, reorder, set_indent


table

Table operations. 3 actions.

All actions accept an optional windowId parameter.

insert

Insert a new table at the cursor.

ParameterTypeRequiredDescription
rowsnumberYesNumber of rows (must be at least 1).
colsnumberYesNumber of columns (must be at least 1).
withHeaderRowbooleanNoWhether to include a header row. Default: true.

delete

Delete the table at the cursor position. No additional parameters.

modify

Batch modify a table's structure and content.

ParameterTypeRequiredDescription
baseRevisionstringYesDocument revision.
targetobjectYes{ tableId }, { afterHeading }, or { tableIndex }
operationsarrayYesArray of table operations.
modestringNodryRun to preview without applying. Apply-vs-suggest is controlled by user setting.

Operations: add_row, delete_row, add_column, delete_column, update_cell, set_header


editor

Editor state operations. 3 actions.

All actions accept an optional windowId parameter.

undo

Undo the last editing action.

redo

Redo the last undone action.

focus

Focus the editor (bring it to front, ready for input).


workspace

Manage documents, windows, and workspace state. 12 actions.

Actions that operate on a specific window accept an optional windowId parameter.

list_windows

List all open VMark windows.

Returns: Array of { label, title, filePath, isFocused, isAiExposed }

get_focused

Get the focused window's label.

focus_window

Focus a specific window.

ParameterTypeRequiredDescription
windowIdstringYesWindow label to focus.

new_document

Create a new empty document.

ParameterTypeRequiredDescription
titlestringNoOptional document title.

open_document

Open a document from the filesystem.

ParameterTypeRequiredDescription
pathstringYesFile path to open.

save

Save the current document.

save_as

Save the document to a new path.

ParameterTypeRequiredDescription
pathstringYesNew file path.

get_document_info

Get document metadata.

Returns: { filePath, isDirty, title, wordCount, charCount }

close_window

Close a window.

list_recent_files

List recently opened files.

Returns: Array of { path, name, timestamp } (up to 10 files, most recent first).

get_info

Get information about the current workspace state.

Returns: { isWorkspaceMode, rootPath, workspaceName }

reload_document

Reload the active document from disk.

ParameterTypeRequiredDescription
forcebooleanNoForce reload even if document has unsaved changes. Default: false.

Fails if the document is untitled or has unsaved changes without force: true.


tabs

Manage editor tabs within windows. 6 actions.

All actions accept an optional windowId parameter.

list

List all tabs in a window.

Returns: Array of { id, title, filePath, isDirty, isActive }

switch

Switch to a specific tab.

ParameterTypeRequiredDescription
tabIdstringYesTab ID to switch to.

close

Close a tab.

ParameterTypeRequiredDescription
tabIdstringNoTab ID to close. Defaults to active tab.

create

Create a new empty tab.

Returns: { tabId }

get_info

Get detailed tab information.

ParameterTypeRequiredDescription
tabIdstringNoTab ID. Defaults to active tab.

Returns: { id, title, filePath, isDirty, isActive }

reopen_closed

Reopen the most recently closed tab.

Returns: { tabId, filePath, title } or message if none available.

VMark keeps track of the last 10 closed tabs per window.


media

Insert math, diagrams, media, wiki links, and CJK formatting. 11 actions.

All actions accept an optional windowId parameter.

math_inline

Insert inline LaTeX math.

ParameterTypeRequiredDescription
latexstringYesLaTeX expression (e.g., E = mc^2).

math_block

Insert a block-level math equation.

ParameterTypeRequiredDescription
latexstringYesLaTeX expression.

mermaid

Insert a Mermaid diagram.

ParameterTypeRequiredDescription
codestringYesMermaid diagram code.

markmap

Insert a Markmap mindmap. Uses standard Markdown headings to define the tree.

ParameterTypeRequiredDescription
codestringYesMarkdown with headings defining the mindmap tree.

svg

Insert an SVG graphic. The SVG renders inline with pan, zoom, and PNG export.

ParameterTypeRequiredDescription
codestringYesSVG markup (valid XML with <svg> root).

Insert a wiki-style link.

ParameterTypeRequiredDescription
targetstringYesLink target (page name).
displayTextstringNoDisplay text (if different from target).

Result: [[target]] or [[target|displayText]]

video

Insert an HTML5 video element.

ParameterTypeRequiredDescription
srcstringYesVideo file path or URL.
baseRevisionstringYesDocument revision.
titlestringNoTitle attribute.
posterstringNoPoster image path or URL.

audio

Insert an HTML5 audio element.

ParameterTypeRequiredDescription
srcstringYesAudio file path or URL.
baseRevisionstringYesDocument revision.
titlestringNoTitle attribute.

video_embed

Insert a video embed (iframe). Supports YouTube (privacy-enhanced), Vimeo, and Bilibili.

ParameterTypeRequiredDescription
videoIdstringYesVideo ID (YouTube: 11-char, Vimeo: numeric, Bilibili: BV ID).
baseRevisionstringYesDocument revision.
providerstringNoyoutube (default), vimeo, or bilibili.

cjk_punctuation

Convert punctuation between half-width and full-width.

ParameterTypeRequiredDescription
directionstringYesto-fullwidth or to-halfwidth.

cjk_spacing

Add or remove spacing between CJK and Latin characters.

ParameterTypeRequiredDescription
spacingActionstringYesadd or remove.

suggestions

Manage AI-generated edit suggestions pending user approval. 5 actions.

When AI uses documentinsert_at_cursor / insert_at_position / replace_in_source, selectionreplace, or documentapply_diff / batch_edit, the changes are staged as suggestions that require user approval.

All actions accept an optional windowId parameter.

Undo/Redo Safety

Suggestions don't modify the document until accepted. This preserves full undo/redo functionality — users can undo after accepting, and rejecting leaves no trace in history.

Auto-Approve Mode

If Auto-approve edits is enabled in Settings → Integrations, changes apply directly without creating suggestions. The actions below are only needed when auto-approve is disabled (the default).

list

List all pending suggestions.

Returns: { suggestions: [...], count, focusedId }

Each suggestion includes id, type (insert, replace, delete), from, to, newContent, originalContent, and createdAt.

accept

Accept a specific suggestion, applying its changes to the document.

ParameterTypeRequiredDescription
suggestionIdstringYesID of the suggestion to accept.

reject

Reject a specific suggestion, discarding it without changes.

ParameterTypeRequiredDescription
suggestionIdstringYesID of the suggestion to reject.

accept_all

Accept all pending suggestions in document order.

reject_all

Reject all pending suggestions.


Protocol Tools

Two standalone tools for querying server capabilities and document state. These do not use the composite action pattern.

get_capabilities

Get the MCP server's capabilities and available tools.

Returns: { version, supportedNodeTypes[], supportedQueryOperators[], limits, features }

get_document_revision

Get the current document revision for optimistic locking.

ParameterTypeRequiredDescription
windowIdstringNoWindow identifier.

Returns: { revision, lastUpdated }

Use the revision in mutation actions to detect concurrent edits.


MCP Resources

In addition to tools, VMark exposes these read-only resources:

Resource URIDescription
vmark://document/outlineDocument heading hierarchy
vmark://document/metadataDocument metadata (path, word count, etc.)
vmark://windows/listList of open windows
vmark://windows/focusedCurrently focused window label