delete_attachment
Remove an attachment from BookStack by specifying its ID to manage wiki 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)The handler function for the 'delete_attachment' MCP tool. It parses the input 'id' parameter, calls 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`; }
- The Tool definition including name, description, and inputSchema for the 'delete_attachment' tool, which is returned by createSearchAndUserTools and registered with the MCP server.{ name: "delete_attachment", description: "Delete an attachment", inputSchema: { type: "object", properties: { id: { type: "number", description: "Attachment ID" }, }, required: ["id"], }, },
- src/index.ts:103-128 (registration)Registration and dispatch logic in the main MCP server handler. Includes 'delete_attachment' in searchUserToolNames array and routes calls to handleSearchAndUserTool.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/lib/bookstack-client.ts:360-362 (helper)Helper method in BookStackClient that sends the DELETE request to the BookStack API endpoint `/attachments/{id}`.async deleteAttachment(id: number): Promise<void> { return this.delete(`/attachments/${id}`); }