get_attachment
Retrieve details for a specific attachment in BookStack by providing its ID, enabling access to file information within the wiki system.
Instructions
Get details of a specific attachment
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Attachment ID |
Implementation Reference
- src/tools/search-user-tools.ts:253-263 (registration)Tool registration object for 'get_attachment', including name, description, and input schema that requires a numeric 'id' parameter.
{ name: "get_attachment", description: "Get details of a specific attachment", inputSchema: { type: "object", properties: { id: { type: "number", description: "Attachment ID" }, }, required: ["id"], }, }, - Input schema for the get_attachment tool, defining an object with a required numeric 'id' property.
inputSchema: { type: "object", properties: { id: { type: "number", description: "Attachment ID" }, }, required: ["id"], }, - src/tools/search-user-tools.ts:479-483 (handler)Handler implementation for the get_attachment tool within the tool dispatcher. Parses the 'id' argument, calls BookStackClient.getAttachment(id), and returns a formatted response.
case "get_attachment": { const id = parseInteger(args.id); const result = await client.getAttachment(id); return formatApiResponse(result); } - src/lib/bookstack-client.ts:342-347 (helper)BookStackClient helper method that performs the actual API call to retrieve attachment details by ID from the BookStack server.
async getAttachment(id: number): Promise<Attachment> { const response: AxiosResponse<Attachment> = await this.api.get( `/attachments/${id}` ); return response.data; } - src/index.ts:56-66 (registration)Top-level registration where search-user-tools (containing get_attachment) are combined into allTools and provided to the MCP server's listTools handler.
const allTools: Tool[] = [ ...createContentTools(bookStackClient), ...createSearchAndUserTools(bookStackClient), ]; // List tools handler server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: allTools, }; });