Skip to main content
Glama
ThaLoc0one

Documentation MCP Server

by ThaLoc0one

docs_create_page

Create or edit individual documentation pages with Markdown content, specifying path, title, and content for multi-language project documentation.

Instructions

Create or edit individual documentation pages with Markdown content

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
docsPathYesPath to documentation directory
pagePathYesRelative path for the page (e.g., 'guides/getting-started.md')
titleYesPage title
contentYesMarkdown content for the page

Implementation Reference

  • src/index.ts:85-108 (registration)
    Tool schema definition for docs_create_page registered in the tools array with input validation schema (docsPath, pagePath, title, content) and required fields.
    name: "docs_create_page",
    description: "Create or edit individual documentation pages with Markdown content",
    inputSchema: {
      type: "object",
      properties: {
        docsPath: {
          type: "string",
          description: "Path to documentation directory",
        },
        pagePath: {
          type: "string",
          description: "Relative path for the page (e.g., 'guides/getting-started.md')",
        },
        title: {
          type: "string",
          description: "Page title",
        },
        content: {
          type: "string",
          description: "Markdown content for the page",
        },
      },
      required: ["docsPath", "pagePath", "title", "content"],
    },
  • Core handler function that creates a Markdown documentation page: creates directories recursively, formats content with YAML frontmatter (title), writes to file, and returns success message.
    export async function createPage(args: any) {
      const { docsPath, pagePath, title, content } = args as CreatePageArgs;
    
      try {
        const fullPath = path.resolve(docsPath, pagePath);
        const dir = path.dirname(fullPath);
    
        await fs.mkdir(dir, { recursive: true });
    
        const formattedContent = `---
    title: ${title}
    ---
    
    # ${title}
    
    ${content}
    `;
    
        await fs.writeFile(fullPath, formattedContent, "utf-8");
    
        return {
          content: [
            {
              type: "text",
              text: `✅ Page created successfully at: ${fullPath}`,
            },
          ],
        };
      } catch (error) {
        throw new Error(`Failed to create page: ${error}`);
      }
    }
  • TypeScript interface defining the expected arguments for createPage: docsPath, pagePath, title, and content (all required strings).
    interface CreatePageArgs {
      docsPath: string;
      pagePath: string;
      title: string;
      content: string;
    }
  • src/index.ts:304-328 (registration)
    Route registration in the CallToolRequestSchema handler that dispatches the "docs_create_page" tool name to the createPage function.
          case "docs_create_page":
            return await createPage(args);
          case "docs_generate_api":
            return await generateApi(args);
          case "docs_build_static":
            return await buildStatic(args);
          case "docs_export_pdf":
            return await exportPdf(args);
          case "docs_preview":
            return await preview(args);
          case "docs_generate_openapi":
            return await generateOpenApi(args);
          case "docs_generate_sales_docs":
            return await generateSalesDocs(args);
          default:
            throw new Error(`Unknown tool: ${name}`);
        }
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        return {
          content: [{ type: "text", text: `Error: ${errorMessage}` }],
          isError: true,
        };
      }
    });
  • src/index.ts:12-13 (registration)
    Import statement importing the createPage handler from the tools module.
    import { createPage } from "./tools/createPage.js";
    import { generateApi } from "./tools/generateApi.js";

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

B3.1/5.0
Behavior2/5

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

No annotations are provided, so the description carries full burden. It only states 'create or edit' without clarifying whether it overwrites, upserts, or requires prerequisites. No side effects or permissions are disclosed.

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 sentence with ten words, front-loading the key action. It is concise but could benefit from slightly more detail without becoming verbose.

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, no annotations, and the tool being a mutation (create/edit), the description lacks return value information, error handling clues, and clarification of the create-vs-edit behavior. It is incomplete for an agent to use confidently.

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 the schema already describes all four parameters. The description adds the term 'Markdown' which is redundant with the content parameter description, and 'individual' may help but doesn't add semantic depth. Baseline score 3 is appropriate.

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 tool creates or edits documentation pages with Markdown content. It distinguishes from sibling tools like docs_generate_api or docs_export_pdf by specifying 'individual pages', though it doesn't explicitly name alternatives.

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 use for manual page creation/editing, contrasting with automatic generation tools. However, it lacks explicit when-to-use or when-not-to-use guidance, and no alternatives are mentioned.

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