create_book
Add a new book to your BookStack wiki by specifying its name, description, and optional tags or templates for organized content management.
Instructions
Create a new book in the system
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Book name (required, 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:559-567 (handler)Executes the create_book tool: parses args with CreateBookSchema, converts tags, calls BookStackClient.createBook, and returns formatted 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); }
- src/tools/content-tools.ts:59-96 (registration)MCP Tool object registration for 'create_book' including name, description, and input schema definition.{ 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"], },
- src/lib/validation.ts:19-25 (schema)Zod validation schema for create_book input parameters, used in the handler for parsing and validation.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(), });
- src/lib/bookstack-client.ts:95-97 (helper)BookStackClient helper method that sends POST request to /books API endpoint to create the book.async createBook(data: CreateBookRequest): Promise<Book> { return this.post<Book>("/books", data); }
- src/index.ts:56-60 (registration)Top-level tool list registration including content tools (which contains create_book) for the MCP server.const allTools: Tool[] = [ ...createContentTools(bookStackClient), ...createSearchAndUserTools(bookStackClient), ];