Skip to main content
Glama

create_page

Create a new page in a BookStack wiki by specifying content in HTML or Markdown format, organizing it within books or chapters, and adding tags for categorization.

Instructions

Create a new page in a book or chapter

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
book_idNoParent book ID (required if not in chapter)
chapter_idNoParent chapter ID (required if not directly in book)
htmlNoPage content in HTML format
markdownNoPage content in Markdown format
nameYesPage name (required, max 255 chars)
priorityNoPage priority/order
tagsNoArray of tags with name and value

Implementation Reference

  • The main handler logic for the 'create_page' tool within the handleContentTool switch statement. Validates input using CreatePageSchema, processes tags, calls the BookStackClient.createPage method, and returns a formatted response.
    case "create_page": { const validatedData = CreatePageSchema.parse(args); const data = { ...validatedData, tags: convertTags(validatedData.tags), }; const result = await client.createPage(data); return formatApiResponse(result); }
  • Tool registration definition including name, description, and input schema for the MCP tool list.
    { name: "create_page", description: "Create a new page in a book or chapter", inputSchema: { type: "object", properties: { book_id: { type: "number", description: "Parent book ID (required if not in chapter)", }, chapter_id: { type: "number", description: "Parent chapter ID (required if not directly in book)", }, name: { type: "string", description: "Page name (required, max 255 chars)", }, html: { type: "string", description: "Page content in HTML format" }, markdown: { type: "string", description: "Page content in Markdown 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: "Page priority/order" }, }, required: ["name"], },
  • Zod validation schema used in the handler to parse and validate arguments for create_page.
    export const CreatePageSchema = z .object({ book_id: z.number().optional(), chapter_id: z.number().optional(), name: z.string().min(1).max(255), html: z.string().optional(), markdown: z.string().optional(), tags: z.array(TagSchema).optional(), priority: z.number().optional(), }) .refine((data) => data.book_id || data.chapter_id, { message: "Either book_id or chapter_id must be provided", }) .refine((data) => data.html || data.markdown, { message: "Either html or markdown content must be provided", });
  • BookStackClient helper method that performs the actual API POST request to create a page.
    async createPage(data: CreatePageRequest): Promise<Page> { return this.post<Page>("/pages", data); }
  • TypeScript interface defining the shape of the CreatePageRequest used by the client and handler.
    export interface CreatePageRequest { book_id?: number; chapter_id?: number; name: string; html?: string; markdown?: string; tags?: Tag[]; priority?: number; }

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