update_book
Modify an existing book's details including name, description, tags, and default template in BookStack wiki instances through API integration.
Instructions
Update an existing book
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| default_template_id | No | Default template ID for new pages | |
| description | No | Book description (plain text) | |
| description_html | No | Book description (HTML format) | |
| id | Yes | Book ID | |
| name | No | Book name (max 255 chars) | |
| tags | No | Array of tags with name and value |
Implementation Reference
- src/tools/content-tools.ts:569-579 (handler)The handler case in handleContentTool function that executes the update_book tool: parses arguments, validates input using UpdateBookSchema, processes tags, and delegates to BookStackClient.updateBook.case "update_book": { const { id, ...updateData } = args; const bookId = parseInteger(id); const validatedData = UpdateBookSchema.parse(updateData); const data = { ...validatedData, tags: convertTags(validatedData.tags), }; const result = await client.updateBook(bookId, data); return formatApiResponse(result); }
- src/lib/validation.ts:19-27 (schema)Zod schemas for book creation and partial update validation used by the update_book tool.export const CreateBookSchema = z.object({ name: z.string().min(1).max(255), description: z.string().optional(), description_html: z.string().optional(), tags: z.array(TagSchema).optional(), default_template_id: z.number().optional(), }); export const UpdateBookSchema = CreateBookSchema.partial();
- src/lib/bookstack-client.ts:99-104 (helper)BookStackClient.updateBook method that sends PUT request to BookStack API /books/{id} endpoint to update the book.async updateBook( id: number, data: Partial<CreateBookRequest> ): Promise<Book> { return this.put<Book>(`/books/${id}`, data); }
- src/index.ts:76-100 (registration)Registration of update_book as a content tool in the dispatch logic for CallToolRequest in the MCP server.const contentToolNames = [ "list_books", "get_book", "create_book", "update_book", "delete_book", "export_book", "list_chapters", "get_chapter", "create_chapter", "update_chapter", "delete_chapter", "export_chapter", "list_pages", "get_page", "create_page", "update_page", "delete_page", "export_page", "list_shelves", "get_shelf", "create_shelf", "update_shelf", "delete_shelf", ];
- src/tools/content-tools.ts:98-134 (registration)Tool definition object for update_book returned by createContentTools, including name, description, and inputSchema.{ name: "update_book", description: "Update an existing book", inputSchema: { type: "object", properties: { id: { type: "number", description: "Book ID" }, name: { type: "string", description: "Book name (max 255 chars)" }, description: { type: "string", description: "Book description (plain text)", }, description_html: { type: "string", description: "Book description (HTML format)", }, tags: { type: "array", description: "Array of tags with name and value", items: { type: "object", properties: { name: { type: "string" }, value: { type: "string" }, order: { type: "number" }, }, required: ["name", "value"], }, }, default_template_id: { type: "number", description: "Default template ID for new pages", }, }, required: ["id"], }, },