Skip to main content
Glama

export_page

Export BookStack wiki pages to HTML, PDF, plain text, or markdown formats for offline use, sharing, or backup purposes.

Instructions

Export a page in various formats

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesPage ID
formatYesExport format

Implementation Reference

  • Defines the input schema for the 'export_page' tool, requiring a page ID and specifying supported export formats (html, pdf, plaintext, markdown).
    {
      name: "export_page",
      description: "Export a page in various formats",
      inputSchema: {
        type: "object",
        properties: {
          id: { type: "number", description: "Page ID" },
          format: {
            type: "string",
            enum: ["html", "pdf", "plaintext", "markdown"],
            description: "Export format",
          },
        },
        required: ["id", "format"],
      },
    },
  • The handler logic within handleContentTool for 'export_page', which parses the page ID and format, then delegates to the appropriate BookStackClient export method or returns a message for PDF.
    case "export_page": {
      const id = parseInteger(args.id);
      const format = args.format;
    
      switch (format) {
        case "html":
          const html = await client.exportPageHtml(id);
          return html;
        case "pdf":
          return "PDF export is binary data - use API directly for file download";
        case "plaintext":
          const text = await client.exportPagePlainText(id);
          return text;
        case "markdown":
          const markdown = await client.exportPageMarkdown(id);
          return markdown;
        default:
          throw new Error(`Unsupported export format: ${format}`);
      }
    }
  • BookStackClient helper methods that perform the actual HTTP requests to BookStack API for exporting a page in HTML, PDF, plaintext, or Markdown formats.
    async exportPageHtml(id: number): Promise<string> {
      const response: AxiosResponse<string> = await this.api.get(
        `/pages/${id}/export/html`
      );
      return response.data;
    }
    
    async exportPagePdf(id: number): Promise<Buffer> {
      const response: AxiosResponse<Buffer> = await this.api.get(
        `/pages/${id}/export/pdf`,
        {
          responseType: "arraybuffer",
        }
      );
      return response.data;
    }
    
    async exportPagePlainText(id: number): Promise<string> {
      const response: AxiosResponse<string> = await this.api.get(
        `/pages/${id}/export/plaintext`
      );
      return response.data;
    }
    
    async exportPageMarkdown(id: number): Promise<string> {
      const response: AxiosResponse<string> = await this.api.get(
        `/pages/${id}/export/markdown`
      );
      return response.data;
    }
  • src/index.ts:56-59 (registration)
    Registers the 'export_page' tool (via createContentTools) in the allTools array provided to the MCP server's ListToolsRequest handler.
    const allTools: Tool[] = [
      ...createContentTools(bookStackClient),
      ...createSearchAndUserTools(bookStackClient),
    ];
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 states the tool exports a page but doesn't reveal critical traits: whether it's read-only or destructive, if it requires specific permissions, what the output looks like (e.g., file download or data return), or any rate limits. For a tool with zero annotation coverage, this is a significant gap in transparency.

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, efficient sentence that directly states the tool's function. It's front-loaded with the core action and resource, with no wasted words. However, it could be slightly more structured by explicitly mentioning parameters or output, though its brevity is generally effective.

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 the tool's complexity (export operation with 2 required parameters), lack of annotations, and no output schema, the description is incomplete. It doesn't cover behavioral aspects (e.g., output format, side effects), usage context, or parameter details beyond what the schema provides. For a tool with this profile, more comprehensive information is needed.

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?

The input schema has 100% description coverage, with clear docs for 'id' and 'format' (including an enum). The description adds minimal value beyond the schema by implying parameter usage ('Export a page in various formats'), but doesn't explain semantics like what a Page ID represents or format implications. Baseline 3 is appropriate as the schema does the heavy lifting.

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 action ('Export') and resource ('a page'), specifying it can be done 'in various formats'. This distinguishes it from other export tools like export_book and export_chapter by focusing on pages. However, it doesn't explicitly differentiate from sibling tools beyond the resource type, which prevents a perfect score.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing an existing page ID), compare it to other export tools (export_book, export_chapter), or indicate scenarios where it's preferred over other operations like get_page. This lack of contextual direction leaves the agent without usage cues.

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/lautarobarba/bookstack_mcp_server'

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