update_page
Modify existing BookStack wiki pages by updating content, metadata, or structure. Change page name, HTML/markdown content, tags, priority, or move pages between books/chapters using the page ID.
Instructions
Update an existing page
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| book_id | No | Move to different book ID | |
| chapter_id | No | Move to different chapter ID | |
| html | No | Page content in HTML format | |
| id | Yes | Page ID | |
| markdown | No | Page content in Markdown format | |
| name | No | Page name (max 255 chars) | |
| priority | No | Page priority/order | |
| tags | No | Array of tags with name and value |
Implementation Reference
- src/tools/content-tools.ts:693-702 (handler)Handler logic for the 'update_page' tool within the handleContentTool switch statement. Parses the page ID, validates input data using UpdatePageSchema, converts tags, calls the BookStack client's updatePage method, and formats the response.case "update_page": { const { id, ...updateData } = args; const pageId = parseInteger(id); const validatedData = UpdatePageSchema.parse(updateData); const data = { ...validatedData, tags: convertTags(validatedData.tags), }; const result = await client.updatePage(pageId, data); return formatApiResponse(result);
- src/lib/validation.ts:60-68 (schema)Zod schema used for input validation in the update_page handler. Defines optional properties for updating page details like book_id, chapter_id, name, content (html/markdown), tags, and priority.export const UpdatePageSchema = z.object({ book_id: z.number().optional(), chapter_id: z.number().optional(), name: z.string().min(1).max(255).optional(), html: z.string().optional(), markdown: z.string().optional(), tags: z.array(TagSchema).optional(), priority: z.number().optional(), });
- src/tools/content-tools.ts:359-393 (registration)Tool registration object in createContentTools function array. Specifies name, description, and detailed inputSchema for the MCP tool protocol.{ name: "update_page", description: "Update an existing page", inputSchema: { type: "object", properties: { id: { type: "number", description: "Page ID" }, book_id: { type: "number", description: "Move to different book ID" }, chapter_id: { type: "number", description: "Move to different chapter ID", }, name: { type: "string", description: "Page name (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: ["id"], },
- src/lib/bookstack-client.ts:215-219 (helper)BookStackClient helper method that executes the actual API PUT request to update a page via `/pages/{id}` endpoint.async updatePage( id: number, data: Partial<CreatePageRequest> ): Promise<Page> { return this.put<Page>(`/pages/${id}`, data);
- src/index.ts:91-100 (registration)Dispatch registration in index.ts where 'update_page' is listed in contentToolNames array to route calls to handleContentTool."create_page", "update_page", "delete_page", "export_page", "list_shelves", "get_shelf", "create_shelf", "update_shelf", "delete_shelf", ];