Skip to main content
Glama

update_image

Modify image details in BookStack, such as changing the image name, to maintain accurate visual content references across your wiki.

Instructions

Update image details

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesImage ID
nameNoImage name

Implementation Reference

  • The handler function for the 'update_image' tool. It destructures 'id' and 'name' from arguments, parses the ID to integer, calls the BookStackClient's updateImage method, and formats the API response.
    case "update_image": { const { id, name } = args; const imageId = parseInteger(id); const result = await client.updateImage(imageId, { name }); return formatApiResponse(result); }
  • The core helper method in BookStackClient that performs the HTTP PUT (or multipart POST if image provided) to the BookStack API endpoint `/image-gallery/{id}` to update the image name.
    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); } }
  • Registration of the 'update_image' tool in createSearchAndUserTools function, including name, description, and JSON input schema.
    { name: "update_image", description: "Update image details", inputSchema: { type: "object", properties: { id: { type: "number", description: "Image ID" }, name: { type: "string", description: "Image name" }, }, required: ["id"], }, },
  • src/index.ts:103-128 (registration)
    Dispatch registration in main server handler: 'update_image' is listed in searchUserToolNames and routed to handleSearchAndUserTool.
    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", ]; if (contentToolNames.includes(name)) { result = await handleContentTool(name, args, bookStackClient); } else if (searchUserToolNames.includes(name)) { result = await handleSearchAndUserTool(name, args, bookStackClient); } else {
  • Zod schema defining the structure for image update data (name optional string max 180 chars).
    export const UpdateImageSchema = z.object({ name: z.string().max(180).optional(), });
  • Helper function used in handler to parse image ID to integer.
    export function parseInteger(value: unknown): number { if (typeof value === "number") return value; if (typeof value === "string") { const parsed = parseInt(value, 10); if (isNaN(parsed)) throw new Error(`Invalid integer: ${value}`); return parsed; } throw new Error(`Expected integer, got ${typeof value}`); }

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