Skip to main content
Glama

Replace Document With Markdown

replace_doc_with_markdown
Destructive

Replaces a document's main note content with Markdown, letting you overwrite an AFFiNE doc's body from Markdown text. Use it to update document content programmatically.

Instructions

Replace the main note content of a document with markdown content.

Input Schema

NameRequiredDescriptionDefault
docIdYesAFFiNE document id.
strictNo
markdownYesMarkdown content to replace with
allowEmptyNoSet true to explicitly allow clearing the main note when Markdown produces no blocks.
workspaceIdNoAFFiNE workspace id. Omit only when AFFINE_WORKSPACE_ID is configured.
expectedRevisionNoOptional read_doc revision of this primary document. Reject stale content before writing. Covers document content, not workspace metadata; requires all writers to share one MCP server.

Output Schema

NameRequiredDescriptionDefault
okNo
codeNo
kindNo
docIdNo
errorNo
lossyNo
statsNo
detailsNo
replacedNo
warningsNo
causeCodeNo
retryableNo
workspaceIdNo
recoveryGuidanceNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv3.10.2

TDQS

A3.5/5.0
Behavior3/5

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

Annotations already declare destructiveHint=true, idempotentHint=false and openWorldHint=true, so the safety profile is covered. The description adds real value by narrowing the blast radius to the 'main note content' (implying other document elements survive), but it says nothing about irreversibility, the stale-write guard via expectedRevision, or the risk of silently clearing content.

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 front-loaded sentence with zero filler; the destructive action and its target are stated first. Nothing is wasted and nothing needs reordering.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists and annotations cover the safety profile, so the description does not need to explain return values. However, for a destructive six-parameter write tool sitting in a dense cluster of markdown tools (create_doc_from_markdown, append_markdown, export_doc_markdown), it leaves the sibling disambiguation and the concurrency/empty-content safeguards unaddressed.

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 83%, above the threshold where the schema carries parameter meaning, so baseline 3 applies. The description adds no parameter-level information at all — notably silent on strict, allowEmpty, and expectedRevision, which are the parameters that change failure modes.

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?

States a specific verb+resource ('Replace the main note content') plus the format ('with markdown content'), and the word 'main note' scopes the target precisely. It implicitly contrasts with append_markdown and create_doc_from_markdown via 'replace', but never names them, so an agent must infer the distinction.

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?

No explicit when-to-use or when-not-to-use guidance. The 'replace' framing implies this is for full rewrites rather than incremental edits (append_markdown) or new documents (create_doc_from_markdown), but the routing is left entirely to inference.

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

Deploy Server

Other Tools