Skip to main content
Glama

create_document

Creates a new markdown document in Unmarkdown, allowing you to set title, content, folder, template, and theme for generating styled documents ready to publish.

Instructions

Create a new markdown document in Unmarkdown

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleNoDocument title
contentNoMarkdown content (default: empty)
folderNoFolder name (case-insensitive) or folder ID to place the document in
template_idNoVisual template ID (default: "swiss")
theme_modeNoColor theme (default: "light")

Implementation Reference

  • The handler function for create_document that sends a POST request to /v1/documents with optional title, content, folder, template_id, and theme_mode parameters.
      async ({ title, content, folder, template_id, theme_mode }) => {
        try {
          const body: Record<string, unknown> = {};
          if (title) body.title = title;
          if (content) body.content = content;
          if (folder) body.folder = folder;
          if (template_id) body.template_id = template_id;
          if (theme_mode) body.theme_mode = theme_mode;
          const result = await client.request("POST", "/v1/documents", body);
          return jsonResult(result);
        } catch (err) {
          return errorResult(err);
        }
      },
    );
  • Zod schema defining the input parameters for create_document: title, content, folder, template_id, and theme_mode (all optional).
    {
      title: z.string().optional().describe("Document title"),
      content: z
        .string()
        .optional()
        .describe("Markdown content (default: empty)"),
      folder: z
        .string()
        .optional()
        .describe("Folder name (case-insensitive) or folder ID to place the document in"),
      template_id: z
        .string()
        .optional()
        .describe('Visual template ID (default: "swiss")'),
      theme_mode: z
        .enum(["light", "dark"])
        .optional()
        .describe('Color theme (default: "light")'),
  • src/tools.ts:83-126 (registration)
    Registration of create_document on the McpServer via server.tool(), with name, description, schema, metadata hints, and handler.
    server.tool(
      "create_document",
      "Create a new markdown document in Unmarkdown",
      {
        title: z.string().optional().describe("Document title"),
        content: z
          .string()
          .optional()
          .describe("Markdown content (default: empty)"),
        folder: z
          .string()
          .optional()
          .describe("Folder name (case-insensitive) or folder ID to place the document in"),
        template_id: z
          .string()
          .optional()
          .describe('Visual template ID (default: "swiss")'),
        theme_mode: z
          .enum(["light", "dark"])
          .optional()
          .describe('Color theme (default: "light")'),
      },
      {
        title: "Create Document",
        readOnlyHint: false,
        destructiveHint: false,
        idempotentHint: false,
        openWorldHint: true,
      },
      async ({ title, content, folder, template_id, theme_mode }) => {
        try {
          const body: Record<string, unknown> = {};
          if (title) body.title = title;
          if (content) body.content = content;
          if (folder) body.folder = folder;
          if (template_id) body.template_id = template_id;
          if (theme_mode) body.theme_mode = theme_mode;
          const result = await client.request("POST", "/v1/documents", body);
          return jsonResult(result);
        } catch (err) {
          return errorResult(err);
        }
      },
    );
  • Helper function used by create_document handler to wrap the API response as a JSON text result.
    function jsonResult(data: unknown) {
      return {
        content: [
          { type: "text" as const, text: JSON.stringify(data, null, 2) },
        ],
      };
    }
  • Helper function used by create_document handler to format error responses.
    function errorResult(err: unknown) {
      if (err instanceof ApiError) {
        return {
          content: [
            {
              type: "text" as const,
              text: `Error ${err.status} (${err.code}): ${err.message}`,
            },
          ],
          isError: true,
        };
      }
      const message = err instanceof Error ? err.message : String(err);
      return {
        content: [{ type: "text" as const, text: `Error: ${message}` }],
        isError: true,
      };
    }
Behavior2/5

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

Annotations provide readOnlyHint=false, destructiveHint=false, idempotentHint=false, and openWorldHint=true. The description adds little beyond stating creation. It does not disclose return behavior, error handling, or side effects, which is minimal given no output schema.

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?

The description is a single, concise sentence. It is front-loaded and easy to parse, but it is somewhat terse and could provide more utility without sacrificing brevity.

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?

Given no output schema and 5 parameters fully described in the schema, the description lacks completeness about return values, success conditions, or potential errors. It does not sufficiently compensate for the absence of output schema information.

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 100%, so the schema already documents all parameters. The description does not add extra meaning beyond stating the tool creates a document, so baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action (create), resource (markdown document), and context (Unmarkdown). It distinguishes from sibling tools like update_document, get_document, and convert_markdown by specifying creation.

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?

The description implies when to use the tool (to create a new document) but provides no explicit guidance on alternatives or when not to use it. Given sibling tools exist (e.g., update_document), this is a gap.

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