Skip to main content
Glama

export_chapter

Export BookStack wiki chapters to HTML, PDF, plain text, or markdown formats for sharing, archiving, or offline use.

Instructions

Export a chapter in various formats

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesChapter ID
formatYesExport format

Implementation Reference

  • The handler logic within handleContentTool function that executes the export_chapter tool by parsing id and format, then calling the appropriate BookStackClient export method based on format.
    case "export_chapter": {
      const id = parseInteger(args.id);
      const format = args.format;
    
      switch (format) {
        case "html":
          const html = await client.exportChapterHtml(id);
          return html;
        case "pdf":
          return "PDF export is binary data - use API directly for file download";
        case "plaintext":
          const text = await client.exportChapterPlainText(id);
          return text;
        case "markdown":
          const markdown = await client.exportChapterMarkdown(id);
          return markdown;
        default:
          throw new Error(`Unsupported export format: ${format}`);
      }
    }
  • The Tool object definition including name, description, and inputSchema for the export_chapter tool.
    {
      name: "export_chapter",
      description: "Export a chapter in various formats",
      inputSchema: {
        type: "object",
        properties: {
          id: { type: "number", description: "Chapter ID" },
          format: {
            type: "string",
            enum: ["html", "pdf", "plaintext", "markdown"],
            description: "Export format",
          },
        },
        required: ["id", "format"],
      },
    },
  • src/index.ts:88-88 (registration)
    The export_chapter tool is listed in the contentToolNames array, which determines if handleContentTool is called for this tool.
    "export_chapter",
  • Helper method in BookStackClient that performs the HTTP GET request to export chapter as HTML.
    async exportChapterHtml(id: number): Promise<string> {
      const response: AxiosResponse<string> = await this.api.get(
        `/chapters/${id}/export/html`
      );
      return response.data;
    }
  • Helper method in BookStackClient that performs the HTTP GET request to export chapter as PDF (binary).
    async exportChapterPdf(id: number): Promise<Buffer> {
      const response: AxiosResponse<Buffer> = await this.api.get(
        `/chapters/${id}/export/pdf`,
        {
          responseType: "arraybuffer",
        }
      );
      return response.data;
    }
  • Helper method in BookStackClient that performs the HTTP GET request to export chapter as plain text.
    async exportChapterPlainText(id: number): Promise<string> {
      const response: AxiosResponse<string> = await this.api.get(
        `/chapters/${id}/export/plaintext`
      );
      return response.data;
    }
  • Helper method in BookStackClient that performs the HTTP GET request to export chapter as Markdown.
    async exportChapterMarkdown(id: number): Promise<string> {
      const response: AxiosResponse<string> = await this.api.get(
        `/chapters/${id}/export/markdown`
      );
      return response.data;
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states the action 'export' but doesn't describe what this entails—whether it's a read-only operation, if it generates downloadable files, requires permissions, has side effects, or what the output looks like. This leaves significant behavioral gaps for a mutation-like operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/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 without unnecessary words. It's appropriately sized for a simple tool and front-loads the core purpose effectively.

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?

For an export tool with no annotations and no output schema, the description is insufficient. It doesn't explain what 'export' means operationally, what the result is (e.g., file generation, data return), or any behavioral traits. Given the complexity of an export operation and lack of structured context, more completeness 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?

Schema description coverage is 100%, so the schema fully documents both parameters (id and format with enum). The description adds no additional parameter semantics beyond what's in the schema, such as explaining what a 'chapter ID' refers to or providing context about format choices. This meets the baseline for high schema coverage.

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 verb 'export' and resource 'chapter', making the purpose immediately understandable. It distinguishes from siblings like 'export_book' and 'export_page' by specifying the chapter resource, though it doesn't explicitly differentiate when to choose between these export tools.

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 like 'export_book' or 'export_page'. It doesn't mention prerequisites, constraints, or typical use cases, leaving the agent to infer usage from context alone.

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