delete_chapter
Remove a chapter from BookStack by moving it to the recycle bin using its ID.
Instructions
Delete a chapter (moves to recycle bin)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Chapter ID |
Implementation Reference
- src/tools/content-tools.ts:643-647 (handler)The handler logic for the 'delete_chapter' tool within the handleContentTool switch statement. It parses the chapter ID from arguments and calls BookStackClient.deleteChapter(id), returning a success message.case "delete_chapter": { const id = parseInteger(args.id); await client.deleteChapter(id); return `Chapter ${id} deleted successfully`; }
- src/tools/content-tools.ts:266-276 (schema)Tool definition providing the schema for 'delete_chapter', including input validation requiring a numeric chapter ID.{ name: "delete_chapter", description: "Delete a chapter (moves to recycle bin)", inputSchema: { type: "object", properties: { id: { type: "number", description: "Chapter ID" }, }, required: ["id"], }, },
- src/index.ts:62-66 (registration)MCP server ListToolsRequest handler returns allTools, which includes the 'delete_chapter' tool schema from createContentTools.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: allTools, }; });
- src/index.ts:124-128 (registration)MCP server CallToolRequest handler dispatches 'delete_chapter' calls to handleContentTool based on inclusion in contentToolNames.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:166-168 (helper)BookStackClient.deleteChapter method implements the core API deletion by calling DELETE /chapters/{id}.async deleteChapter(id: number): Promise<void> { return this.delete(`/chapters/${id}`); }