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), ];

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