Skip to main content
Glama

update_document

Idempotent

Update a document's content, title, folder, template, theme, description, or page width by providing its UUID.

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

  • Handler function for update_document tool. Accepts id (required), and optional title, content, folder, template_id, theme_mode, description, page_width. Builds a request body with only defined fields and sends a PATCH request to /v1/documents/:id.
      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);
        }
      },
    );
  • Zod schema for update_document input parameters: id (required UUID string), title, content, folder (nullable string), template_id, theme_mode (light/dark), description (nullable string), page_width (full/wide/standard).
    {
      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"),
    },
  • src/tools.ts:203-257 (registration)
    Registration of the 'update_document' tool on the MCP server via server.tool(), with name, description, schema, metadata hints (title, readOnlyHint, destructiveHint, idempotentHint, openWorldHint), and the handler callback.
    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);
        }
      },
    );
Behavior2/5

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

Annotations already declare readOnlyHint=false, destructiveHint=false, idempotentHint=true, openWorldHint=true. The description adds no behavioral context beyond what the annotations imply (e.g., no mention of partial updates, idempotency, or what happens with missing fields).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single concise sentence that is front-loaded. Could be slightly more informative without sacrificing conciseness.

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

Completeness2/5

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

No output schema, and the description does not mention return values or behavior for the 8 parameters. Given the tool's complexity and the lack of return value documentation, the description is insufficient.

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 coverage is 100%, so baseline is 3. The description summarizes 'content or metadata' but does not add meaning beyond the schema's parameter descriptions.

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?

The description clearly states the action (update) and the resource (document), plus specifies scope (content or metadata). However, it does not distinguish from sibling tools like create_document or publish_document.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool vs. alternatives such as create_document or publish_document. The description lacks usage context.

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

Install Server

Other Tools

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