delete_attachment
Remove an attachment from a BookStack wiki by specifying its ID to manage content and maintain organized documentation.
Instructions
Delete an attachment
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Attachment ID |
Implementation Reference
- src/tools/search-user-tools.ts:485-489 (handler)Executes the 'delete_attachment' MCP tool: parses the attachment ID from input arguments, invokes the BookStack client's deleteAttachment method, and returns a success message.case "delete_attachment": { const id = parseInteger(args.id); await client.deleteAttachment(id); return `Attachment ${id} deleted successfully`; }
- Tool schema definition specifying the name, description, and input schema (requiring a numeric 'id' for the attachment).{ name: "delete_attachment", description: "Delete an attachment", inputSchema: { type: "object", properties: { id: { type: "number", description: "Attachment ID" }, }, required: ["id"], }, },
- src/lib/bookstack-client.ts:360-362 (helper)BookStackClient helper method that performs the actual HTTP DELETE request to the BookStack API endpoint `/attachments/{id}`.async deleteAttachment(id: number): Promise<void> { return this.delete(`/attachments/${id}`); }
- src/index.ts:102-128 (registration)Registers 'delete_attachment' in the searchUserToolNames array for dispatch routing to the appropriate handler (handleSearchAndUserTool) in the MCP server's CallToolRequestSchema handler.// Search and user tools const searchUserToolNames = [ "search_all", "list_users", "get_user", "create_user", "update_user", "delete_user", "list_roles", "get_role", "create_role", "update_role", "delete_role", "list_attachments", "get_attachment", "delete_attachment", "list_images", "get_image", "update_image", "delete_image", ]; if (contentToolNames.includes(name)) { result = await handleContentTool(name, args, bookStackClient); } else if (searchUserToolNames.includes(name)) { result = await handleSearchAndUserTool(name, args, bookStackClient); } else {
- src/index.ts:56-66 (registration)Includes the 'delete_attachment' tool (via createSearchAndUserTools) in the allTools array advertised to MCP clients via ListToolsRequestSchema.const allTools: Tool[] = [ ...createContentTools(bookStackClient), ...createSearchAndUserTools(bookStackClient), ]; // List tools handler server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: allTools, }; });