Skip to main content
Glama

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
NameRequiredDescriptionDefault
idYesDocument UUID
titleNoNew title
contentNoNew markdown content
folderNoMove to folder by name (case-insensitive) or folder ID. Set to null to move to Unfiled.
template_idNoNew template ID
theme_modeNoNew color theme
descriptionNoDocument description (null to clear)
page_widthNoPage width for published view

Implementation Reference

  • 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);
        }
      },
    );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/UnMarkdown/mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server