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
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Attachment ID |
Implementation Reference
- src/bookstack-client.ts:729-740 (handler)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) }] }; }