Skip to main content
Glama

update_chapter

Modify existing chapters in BookStack by updating content, metadata, tags, and organizational settings to maintain accurate documentation.

Instructions

Update an existing chapter

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesChapter ID
nameNoChapter name (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 main execution logic for the 'update_chapter' tool within the handleContentTool switch statement. It extracts the chapter ID, validates the update data using UpdateChapterSchema, converts tags, calls the BookStack client to update the chapter, and formats the API response.
    case "update_chapter": {
      const { id, ...updateData } = args;
      const chapterId = parseInteger(id);
      const validatedData = UpdateChapterSchema.parse(updateData);
      const data = {
        ...validatedData,
        tags: convertTags(validatedData.tags),
      };
      const result = await client.updateChapter(chapterId, data);
      return formatApiResponse(result);
    }
  • MCP Tool registration definition for 'update_chapter', including the tool name, description, and input schema specification used for tool listing and validation.
    {
      name: "update_chapter",
      description: "Update an existing chapter",
      inputSchema: {
        type: "object",
        properties: {
          id: { type: "number", description: "Chapter ID" },
          name: { type: "string", description: "Chapter name (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: ["id"],
      },
  • Zod schema definition for validating the input parameters of the update_chapter tool. It is a partial version of CreateChapterSchema, omitting the book_id field since updates target an existing chapter by ID.
    export const UpdateChapterSchema = CreateChapterSchema.partial().omit({
      book_id: true,
    });
  • Helper method in BookStackClient that performs the actual HTTP PUT request to the BookStack API endpoint /chapters/{id} to update the chapter data.
    async updateChapter(
      id: number,
      data: Partial<CreateChapterRequest>
    ): Promise<Chapter> {
      return this.put<Chapter>(`/chapters/${id}`, data);
    }
  • src/index.ts:76-100 (registration)
    Registration of 'update_chapter' in the contentToolNames array used by the MCP server to route tool calls to the appropriate handler (handleContentTool).
    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",
    ];
  • Helper utility function used in the update_chapter handler to convert input tags to the proper Tag format expected by the BookStack API.
    function convertTags(
      inputTags?: { name: string; value: string; order?: number }[]
    ): Tag[] | undefined {
      if (!inputTags) return undefined;
      return inputTags.map((tag) => ({
        name: tag.name,
        value: tag.value,
        order: tag.order ?? 0,
      }));
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. 'Update an existing chapter' implies a mutation operation, but the description doesn't specify what happens during updates (e.g., whether fields are optional, if changes are reversible, permission requirements, or error conditions). For a mutation tool with zero annotation coverage, this leaves critical behavioral traits undocumented.

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, efficient sentence with zero wasted words. It's front-loaded with the core action and resource, making it easy to parse. Every word earns its place, and there's no redundancy or fluff.

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?

Given the complexity (a mutation tool with 7 parameters), lack of annotations, and no output schema, the description is incomplete. It doesn't address behavioral aspects like side effects, error handling, or return values, leaving significant gaps for the agent. While the schema covers parameters well, the overall context for safe and effective use is insufficient.

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?

Schema description coverage is 100%, meaning all 7 parameters are documented in the input schema. The description adds no parameter-specific information beyond what's in the schema (e.g., it doesn't explain relationships between parameters like description vs. description_html). With high schema coverage, the baseline score of 3 is appropriate—the description doesn't compensate but doesn't need to since the schema handles parameter documentation.

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

Purpose3/5

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

The description 'Update an existing chapter' clearly states the action (update) and resource (chapter), which is better than a tautology. However, it doesn't distinguish this tool from sibling update tools like update_book, update_page, or update_user, all of which follow the same 'Update an existing X' pattern. The purpose is clear but lacks differentiation.

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. It doesn't mention prerequisites (e.g., needing an existing chapter ID), when not to use it (e.g., for creating vs. updating), or refer to related tools like create_chapter or get_chapter. Without any usage context, the agent must infer everything from the tool name and schema.

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