Skip to main content
Glama

create_chapter

Add a new chapter to a book in BookStack by specifying the parent book ID and chapter name, with options for description, tags, priority, and template.

Instructions

Create a new chapter in a book

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
book_idYesParent book ID
nameYesChapter name (required, max 255 chars)
descriptionNoChapter description (plain text)
description_htmlNoChapter description (HTML format)
tagsNoArray of tags with name and value
priorityNoChapter priority/order
default_template_idNoDefault template ID for new pages

Implementation Reference

  • The handler function for the 'create_chapter' tool. Validates input arguments using CreateChapterSchema, processes tags, calls the BookStackClient.createChapter method, and returns a formatted API response.
    case "create_chapter": {
      const validatedData = CreateChapterSchema.parse(args);
      const data = {
        ...validatedData,
        tags: convertTags(validatedData.tags),
      };
      const result = await client.createChapter(data);
      return formatApiResponse(result);
  • MCP Tool registration definition for 'create_chapter', including the name, description, and JSON input schema used by the MCP server.
    {
      name: "create_chapter",
      description: "Create a new chapter in a book",
      inputSchema: {
        type: "object",
        properties: {
          book_id: { type: "number", description: "Parent book ID" },
          name: {
            type: "string",
            description: "Chapter name (required, max 255 chars)",
          },
          description: {
            type: "string",
            description: "Chapter description (plain text)",
          },
          description_html: {
            type: "string",
            description: "Chapter 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"],
            },
          },
          priority: { type: "number", description: "Chapter priority/order" },
          default_template_id: {
            type: "number",
            description: "Default template ID for new pages",
          },
        },
        required: ["book_id", "name"],
      },
  • Zod validation schema (CreateChapterSchema) used to parse and validate tool input arguments in the handler.
    export const CreateChapterSchema = z.object({
      book_id: z.number(),
      name: z.string().min(1).max(255),
      description: z.string().optional(),
      description_html: z.string().optional(),
      tags: z.array(TagSchema).optional(),
      priority: z.number().optional(),
      default_template_id: z.number().optional(),
    });
  • BookStackClient helper method that performs the actual HTTP POST request to the BookStack API endpoint '/chapters' to create the chapter.
    async createChapter(data: CreateChapterRequest): Promise<Chapter> {
      return this.post<Chapter>("/chapters", data);
    }
  • TypeScript interface defining the shape of CreateChapterRequest data passed to the client method.
    export interface CreateChapterRequest {
      book_id: number;
      name: string;
      description?: string;
      description_html?: string;
      tags?: Tag[];
      priority?: number;
      default_template_id?: number;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states this is a creation operation but doesn't mention permissions required, whether it's idempotent, what happens on failure, or the format of the response. For a mutation tool with zero annotation coverage, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence with no wasted words. It's appropriately sized and front-loaded with the essential information, making it highly efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a creation tool with 7 parameters, no annotations, and no output schema, the description is insufficient. It doesn't explain what the tool returns, error conditions, or behavioral constraints. Given the complexity and lack of structured data, it should provide more context to be complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, so all parameters are documented in the schema itself. The description adds no additional parameter semantics beyond implying a 'book' context, which is already covered by the 'book_id' parameter. This meets the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Create') and resource ('new chapter in a book'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'create_page' or 'create_book' beyond specifying the resource type, which is a minor gap.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'create_page' or 'create_book', nor does it mention prerequisites such as needing an existing book. It simply states what it does without contextual usage information.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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