Skip to main content
Glama
ThaLoc0one

Documentation MCP Server

by ThaLoc0one

docs_export_pdf

Generate PDF files from your documentation or built site. Specify the source path, output filename, and optionally include specific pages. Uses browser engines to produce accurate PDFs.

Instructions

Generate PDF from documentation using Puppeteer/Playwright

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
docsPathYesPath to documentation or built site
outputPathYesOutput path for PDF file
includePagesNoSpecific pages to include (optional, includes all by default)

Implementation Reference

  • The main handler function for docs_export_pdf tool. It extracts args (docsPath, outputPath, includePages) and returns a text response containing instructions for manually generating a PDF from documentation using Puppeteer/Playwright. It does NOT actually generate a PDF itself—it only provides a code snippet and instructions.
    export async function exportPdf(args: any) {
      const { docsPath, outputPath, includePages } = args as ExportPdfArgs;
    
      const instructions = `📄 PDF Export Instructions:
    
    1. Install dependencies:
       npm install --save-dev puppeteer
    
    2. Create export script (pdf-export.js):
    
    \`\`\`javascript
    const puppeteer = require('puppeteer');
    const path = require('path');
    
    async function exportPdf() {
      const browser = await puppeteer.launch();
      const page = await browser.newPage();
      
      // Navigate to your built documentation
      await page.goto('file://${docsPath}/index.html', {
        waitUntil: 'networkidle0'
      });
      
      // Generate PDF
      await page.pdf({
        path: '${outputPath}',
        format: 'A4',
        printBackground: true,
        margin: {
          top: '20mm',
          right: '20mm',
          bottom: '20mm',
          left: '20mm'
        }
      });
      
      await browser.close();
      console.log('PDF generated: ${outputPath}');
    }
    
    exportPdf();
    \`\`\`
    
    3. Run the script:
       node pdf-export.js
    
    Alternative tools:
    - prince (commercial, excellent quality)
    - wkhtmltopdf (free, good quality)
    - md-to-pdf (for simple Markdown)
    
    For Docusaurus, check:
    - docusaurus-prince-pdf
    - docusaurus-pdf`;
    
      return {
        content: [
          {
            type: "text",
            text: instructions,
          },
        ],
      };
    }
  • TypeScript interface defining the input arguments for the exportPdf handler: docsPath (required), outputPath (required), and optional includePages array.
    interface ExportPdfArgs {
      docsPath: string;
      outputPath: string;
      includePages?: string[];
    }
  • src/index.ts:156-178 (registration)
    Tool registration object in the 'tools' array, defining name, description, and JSON Schema input validation for docs_export_pdf.
    {
      name: "docs_export_pdf",
      description: "Generate PDF from documentation using Puppeteer/Playwright",
      inputSchema: {
        type: "object",
        properties: {
          docsPath: {
            type: "string",
            description: "Path to documentation or built site",
          },
          outputPath: {
            type: "string",
            description: "Output path for PDF file",
          },
          includePages: {
            type: "array",
            items: { type: "string" },
            description: "Specific pages to include (optional, includes all by default)",
          },
        },
        required: ["docsPath", "outputPath"],
      },
    },
  • src/index.ts:310-311 (registration)
    Route in the CallToolRequestSchema switch statement that dispatches 'docs_export_pdf' requests to the exportPdf handler function.
    case "docs_export_pdf":
      return await exportPdf(args);
  • src/index.ts:15-15 (registration)
    Import statement that brings the exportPdf function from src/tools/exportPdf.ts into the main server file.
    import { exportPdf } from "./tools/exportPdf.js";
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions using Puppeteer/Playwright, implying headless browser rendering, but does not disclose whether it creates files locally or on a server, whether the operation is synchronous, or what happens if pages fail to load.

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?

Single sentence, no wasted words, but lacks structure (e.g., no bullet points or explicit separation of purpose vs. technical detail).

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 exists. The description does not explain default behavior for optional parameters (e.g., includePages defaults to all pages), output format details, or error scenarios. More completeness is needed for a tool that generates files.

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 description adds no extra meaning beyond the schema. Baseline 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 'Generate PDF from documentation using Puppeteer/Playwright' clearly states the action (Generate), the resource (PDF from documentation), and the technology (Puppeteer/Playwright), distinguishing it from siblings like docs_build_static or docs_preview.

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 information is provided about when to use this tool versus alternatives (e.g., for final output vs. preview), nor are there any prerequisites or exclusions mentioned.

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/ThaLoc0one/documentation-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server