Skip to main content
Glama
ttpears

BookStack MCP Server

by ttpears

get_attachment

Retrieve attachment details and download links from BookStack documentation by providing the attachment ID.

Instructions

Get details of a specific attachment including download links

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesAttachment ID

Implementation Reference

  • The implementation of the getAttachment method in the BookStackClient class, which performs the API request.
    async getAttachment(id: number): Promise<any> {
      const response = await this.client.get(`/attachments/${id}`);
      const attachment = response.data;
      
      return {
        ...attachment,
        page_url: `${this.baseUrl}/books/${Math.floor(attachment.uploaded_to / 1000)}/page/${attachment.uploaded_to}`,
        direct_link: `[${attachment.name}](${this.baseUrl}/attachments/${attachment.id})`,
        download_url: `${this.baseUrl}/attachments/${attachment.id}`
      };
    }
  • src/index.ts:428-442 (registration)
    Registration of the "get_attachment" tool in the MCP server instance.
    server.registerTool(
      "get_attachment",
      {
        title: "Get Attachment Details",
        description: "Get details of a specific attachment including download links",
        inputSchema: {
          id: z.coerce.number().min(1).describe("Attachment ID")
        }
      },
      async (args) => {
        const attachment = await client.getAttachment(args.id);
        return {
          content: [{ type: "text", text: JSON.stringify(attachment, null, 2) }]
        };
      }

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/ttpears/bookstack-mcp'

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