Skip to main content
Glama

publish_document

Publish documents to shareable web pages with rendered charts, diagrams, graphs, and math. Control visibility and page width for public or unlisted access.

Instructions

Publish a document to a shareable web page. Default visibility is 'link' (unlisted). Published pages render all content including Chart.js charts, Mermaid diagrams, Graphviz graphs, and KaTeX math. Email-based sharing is not available here; direct users to unmarkdown.com for that.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesDocument UUID
slugNoCustom URL slug (auto-generated if omitted)
descriptionNoSEO description for published page
visibilityNo"public" or "link" (default, unlisted)
page_widthNoPage width for published view

Implementation Reference

  • The publish_document tool is registered and implemented in src/tools.ts. It takes a document ID and optional configuration parameters (slug, description, visibility, page_width), performs a POST request to the API, and returns the result or an error.
    server.tool(
      "publish_document",
      "Publish a document to a shareable web page. Default visibility is 'link' (unlisted). Published pages render all content including Chart.js charts, Mermaid diagrams, Graphviz graphs, and KaTeX math. Email-based sharing is not available here; direct users to unmarkdown.com for that.",
      {
        id: z.string().describe("Document UUID"),
        slug: z
          .string()
          .optional()
          .describe("Custom URL slug (auto-generated if omitted)"),
        description: z
          .string()
          .optional()
          .describe("SEO description for published page"),
        visibility: z
          .enum(["public", "link"])
          .optional()
          .describe('"public" or "link" (default, unlisted)'),
        page_width: z
          .enum(["full", "wide", "standard"])
          .optional()
          .describe("Page width for published view"),
      },
      {
        title: "Publish Document",
        readOnlyHint: false,
        destructiveHint: false,
        idempotentHint: true,
        openWorldHint: true,
      },
      async ({ id, slug, description, visibility, page_width }) => {
        try {
          const body: Record<string, unknown> = {};
          if (slug) body.slug = slug;
          if (description) body.description = description;
          if (visibility) body.visibility = visibility;
          if (page_width) body.page_width = page_width;
          const result = await client.request(
            "POST",
            `/v1/documents/${encodeURIComponent(id)}/publish`,
            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