Skip to main content
Glama

create_book

Create a new book in BookStack with required name, optional description, tags, and default template settings for organizing wiki content.

Instructions

Create a new book in the system

Input Schema

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

Implementation Reference

  • Handler function for the 'create_book' tool. Validates input arguments using CreateBookSchema, converts tags if provided, calls the BookStackClient.createBook method, and returns a formatted API response.
    case "create_book": { const validatedData = CreateBookSchema.parse(args); const data = { ...validatedData, tags: convertTags(validatedData.tags), }; const result = await client.createBook(data); return formatApiResponse(result); }
  • Zod schema used for runtime validation of input parameters for the create_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(), });
  • Tool registration/specification in createContentTools function, defining name, description, and inputSchema for MCP tool discovery and validation.
    { name: "create_book", description: "Create a new book in the system", inputSchema: { type: "object", properties: { name: { type: "string", description: "Book name (required, 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: ["name"], }, },
  • BookStack API client method that performs the actual HTTP POST request to create a book via the BookStack /books endpoint.
    async createBook(data: CreateBookRequest): Promise<Book> { return this.post<Book>("/books", data); }
  • src/index.ts:76-126 (registration)
    Registration of create_book as a content tool: included in the list of handled tools and routed to handleContentTool in the MCP server's call tool handler.
    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", ]; // Search and user tools 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)) {

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