Skip to main content
Glama
ThaLoc0one

Documentation MCP Server

by ThaLoc0one

docs_preview

Preview documentation locally by starting a development server. Supports Docusaurus, MkDocs, and Sphinx frameworks with configurable port and docs directory.

Instructions

Start local development server to preview documentation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
docsPathYesPath to documentation directory
frameworkYesDocumentation framework used
portNoPort number (default: 3000 for Docusaurus, 8000 for MkDocs/Sphinx)

Implementation Reference

  • The handler function 'preview' that executes the docs_preview tool logic. Returns instructions for starting a local dev server (Docusaurus, MkDocs, or Sphinx) with framework-specific commands and port configuration.
    export async function preview(args: any) {
      const { docsPath, framework, port } = args as PreviewArgs;
    
      const defaultPorts: Record<string, number> = {
        docusaurus: 3000,
        mkdocs: 8000,
        sphinx: 8000,
      };
    
      const selectedPort = port || defaultPorts[framework] || 3000;
    
      const instructions: Record<string, string> = {
        docusaurus: `👀 Starting Docusaurus Preview:
    
    1. Navigate to docs:
       cd ${docsPath}
    
    2. Start dev server:
       npm start
    
    3. Server will run on: http://localhost:${selectedPort}
    
    4. Features:
       - Hot reload
       - Fast refresh
       - Search
       - Navigation
    
    Press Ctrl+C to stop the server.`,
        mkdocs: `👀 Starting MkDocs Preview:
    
    1. Navigate to project:
       cd ${docsPath}
    
    2. Start dev server:
       mkdocs serve -a localhost:${selectedPort}
    
    3. Server will run on: http://localhost:${selectedPort}
    
    4. Features:
       - Auto-reload on save
       - Live preview
       - Search
    
    Press Ctrl+C to stop the server.`,
        sphinx: `👀 Starting Sphinx Preview:
    
    1. Build the docs:
       cd ${docsPath}
       make html
    
    2. Start simple HTTP server:
       cd _build/html
       python -m http.server ${selectedPort}
    
    3. Server will run on: http://localhost:${selectedPort}
    
    4. For auto-rebuild, use sphinx-autobuild:
       pip install sphinx-autobuild
       sphinx-autobuild . _build/html --port ${selectedPort}
    
    Press Ctrl+C to stop the server.`,
      };
    
      const instruction = instructions[framework] || "Framework not supported";
    
      return {
        content: [
          {
            type: "text",
            text: instruction,
          },
        ],
      };
    }
  • The input schema definition for the 'docs_preview' tool, specifying required inputs: docsPath (string), framework (enum: docusaurus/mkdocs/sphinx), and optional port (number).
    name: "docs_preview",
    description: "Start local development server to preview documentation",
    inputSchema: {
      type: "object",
      properties: {
        docsPath: {
          type: "string",
          description: "Path to documentation directory",
        },
        framework: {
          type: "string",
          description: "Documentation framework used",
          enum: ["docusaurus", "mkdocs", "sphinx"],
        },
        port: {
          type: "number",
          description: "Port number (default: 3000 for Docusaurus, 8000 for MkDocs/Sphinx)",
        },
      },
      required: ["docsPath", "framework"],
    },
  • src/index.ts:312-313 (registration)
    The case handler in the CallToolRequestSchema switch that dispatches to the 'preview' function when tool name is 'docs_preview'.
    case "docs_preview":
      return await preview(args);
  • The PreviewArgs interface defining the shape of the documentation preview arguments (docsPath, framework, optional port).
    interface PreviewArgs {
      docsPath: string;
      framework: string;
      port?: number;
    }
  • src/index.ts:16-16 (registration)
    The import of the 'preview' function from './tools/preview.js' into the main server file.
    import { preview } from "./tools/preview.js";

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

B3.2/5.0
Behavior2/5

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

No annotations provided. The description lacks behavioral details: e.g., if the server blocks, how to stop it, or what output is produced. Only states it starts a server.

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, clear sentence. Efficient but could benefit from additional structured detail (e.g., output behavior).

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

Completeness3/5

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

No output schema, but the tool is simple. Still, the description doesn't mention what the result is (e.g., URL, server status). Adequate but not complete.

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 description adds no extra meaning beyond the schema. 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 ('start local development server') and the resource ('documentation preview'). It distinguishes from siblings like docs_build_static and docs_generate_*.

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 (e.g., when to preview vs build). No exclusions or prerequisites mentioned.

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