update_image
Modify image details like name and metadata in BookStack wiki pages to maintain accurate visual content.
Instructions
Update image details
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Image ID | |
| name | No | Image name |
Implementation Reference
- src/tools/search-user-tools.ts:511-517 (handler)MCP tool handler implementation for 'update_image'. Extracts id and name from args, parses id to integer, calls BookStackClient.updateImage, and returns formatted response.case "update_image": { const { id, name } = args; const imageId = parseInteger(id); const result = await client.updateImage(imageId, { name }); return formatApiResponse(result); }
- JSON Schema in tool definition specifying input parameters for 'update_image': required id (number), optional name (string).inputSchema: { type: "object", properties: { id: { type: "number", description: "Image ID" }, name: { type: "string", description: "Image name" }, }, required: ["id"], },
- src/index.ts:103-122 (registration)Registration of 'update_image' in the dispatch array for search/user tools in the main MCP server handler.const searchUserToolNames = [ "search_all", "list_users", "get_user", "create_user", "update_user", "delete_user", "list_roles", "get_role", "create_role", "update_role", "delete_role", "list_attachments", "get_attachment", "delete_attachment", "list_images", "get_image", "update_image", "delete_image", ];
- src/lib/bookstack-client.ts:396-411 (helper)BookStackClient helper method implementing the API call to update an image via PUT or multipart POST to /image-gallery/{id}.async updateImage( id: number, data: { name?: string }, imageFile?: Buffer, filename?: string ): Promise<ImageGallery> { if (imageFile && filename) { const formData = new FormData(); if (data.name) formData.append("name", data.name); formData.append("image", imageFile, filename); return this.postMultipart<ImageGallery>(`/image-gallery/${id}`, formData); } else { return this.put<ImageGallery>(`/image-gallery/${id}`, data); } }
- src/lib/validation.ts:118-120 (schema)Zod schema for validating update_image parameters internally (optional name field).export const UpdateImageSchema = z.object({ name: z.string().max(180).optional(), });