update_book
Modify existing books in BookStack by updating details like name, description, tags, or default template for new pages.
Instructions
Update an existing book
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"id": "<id>"
},
"name": "update_book"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Book ID | |
| name | No | Book name (max 255 chars) | |
| description | No | Book description (plain text) | |
| description_html | No | Book description (HTML format) | |
| tags | No | Array of tags with name and value | |
| default_template_id | No | Default template ID for new pages |
Implementation Reference
- src/tools/content-tools.ts:569-579 (handler)The handler logic for the 'update_book' tool within the handleContentTool function. It extracts the book ID, validates the update data using UpdateBookSchema, converts tags if present, calls the BookStackClient's updateBook method, and returns a formatted API response.
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:27-27 (schema)Zod schema for validating input parameters for updating a book. It is a partial version of CreateBookSchema, allowing optional updates to book properties.
export const UpdateBookSchema = CreateBookSchema.partial(); - src/tools/content-tools.ts:98-134 (registration)Tool registration in createContentTools function, defining the name, description, and input schema for the 'update_book' tool, which is returned in the list of tools for MCP server.
{ 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"], }, }, - src/index.ts:80-100 (registration)Lists 'update_book' in the contentToolNames array used to dispatch calls to handleContentTool in the MCP server's call tool handler.
"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/lib/bookstack-client.ts:99-104 (helper)BookStackClient method that performs the actual API PUT request to update a book via the BookStack API.
async updateBook( id: number, data: Partial<CreateBookRequest> ): Promise<Book> { return this.put<Book>(`/books/${id}`, data); }