update_document
Modify document content, metadata, or formatting in the Unmarkdown MCP Server to maintain and publish styled documents across platforms.
Instructions
Update a document's content or metadata
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Document UUID | |
| title | No | New title | |
| content | No | New markdown content | |
| folder | No | Move to folder by name (case-insensitive) or folder ID. Set to null to move to Unfiled. | |
| template_id | No | New template ID | |
| theme_mode | No | New color theme | |
| description | No | Document description (null to clear) | |
| page_width | No | Page width for published view |
Implementation Reference
- src/tools.ts:202-257 (handler)The 'update_document' tool is registered and implemented in src/tools.ts. It uses the `client.request` helper to send a PATCH request to the /v1/documents/{id} API endpoint.
// 5. update_document server.tool( "update_document", "Update a document's content or metadata", { id: z.string().describe("Document UUID"), title: z.string().optional().describe("New title"), content: z.string().optional().describe("New markdown content"), folder: z .string() .nullable() .optional() .describe("Move to folder by name (case-insensitive) or folder ID. Set to null to move to Unfiled."), template_id: z.string().optional().describe("New template ID"), theme_mode: z .enum(["light", "dark"]) .optional() .describe("New color theme"), description: z .string() .nullable() .optional() .describe("Document description (null to clear)"), page_width: z .enum(["full", "wide", "standard"]) .optional() .describe("Page width for published view"), }, { title: "Update Document", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true, }, async ({ id, title, content, folder, template_id, theme_mode, description, page_width }) => { try { const body: Record<string, unknown> = {}; if (title !== undefined) body.title = title; if (content !== undefined) body.content = content; if (folder !== undefined) body.folder = folder; if (template_id !== undefined) body.template_id = template_id; if (theme_mode !== undefined) body.theme_mode = theme_mode; if (description !== undefined) body.description = description; if (page_width !== undefined) body.page_width = page_width; const result = await client.request( "PATCH", `/v1/documents/${encodeURIComponent(id)}`, body, ); return jsonResult(result); } catch (err) { return errorResult(err); } }, );