Skip to main content
Glama

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesBook ID
nameNoBook name (max 255 chars)
descriptionNoBook description (plain text)
description_htmlNoBook description (HTML format)
tagsNoArray of tags with name and value
default_template_idNoDefault template ID for new pages

Implementation Reference

  • 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); }
  • 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();
  • 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", ];
  • 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); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/lautarobarba/bookstack_mcp_server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server