Skip to main content
Glama

update_shelf

Modify an existing shelf in BookStack by updating its name, description, books, or tags using the shelf ID.

Instructions

Update an existing shelf

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesShelf ID
nameNoShelf name (max 255 chars)
descriptionNoShelf description (plain text)
description_htmlNoShelf description (HTML format)
booksNoArray of book IDs (replaces existing books)
tagsNoArray of tags with name and value

Implementation Reference

  • MCP tool handler for 'update_shelf': extracts shelf ID, validates input with UpdateShelfSchema, converts tags, calls BookStack client.updateShelf, and returns formatted response.
    case "update_shelf": { const { id, ...updateData } = args; const shelfId = parseInteger(id); const validatedData = UpdateShelfSchema.parse(updateData); const data = { ...validatedData, tags: convertTags(validatedData.tags), }; const result = await client.updateShelf(shelfId, data); return formatApiResponse(result); }
  • Tool registration: defines the 'update_shelf' Tool object with name, description, and inputSchema matching the validation.
    { name: "update_shelf", description: "Update an existing shelf", inputSchema: { type: "object", properties: { id: { type: "number", description: "Shelf ID" }, name: { type: "string", description: "Shelf name (max 255 chars)" }, description: { type: "string", description: "Shelf description (plain text)", }, description_html: { type: "string", description: "Shelf description (HTML format)", }, books: { type: "array", description: "Array of book IDs (replaces existing books)", items: { type: "number" }, }, 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"], }, }, }, required: ["id"], },
  • Zod schemas: CreateShelfSchema for full creation, UpdateShelfSchema as partial for updates, used to validate tool inputs.
    export const CreateShelfSchema = z.object({ name: z.string().min(1).max(255), description: z.string().optional(), description_html: z.string().optional(), books: z.array(z.number()).optional(), tags: z.array(TagSchema).optional(), }); export const UpdateShelfSchema = CreateShelfSchema.partial();
  • BookStackClient helper method: performs PUT request to /shelves/{id} to update the shelf via the API.
    async updateShelf( id: number, data: Partial<CreateShelfRequest> ): Promise<Shelf> { return this.put<Shelf>(`/shelves/${id}`, data); }
  • src/index.ts:98-100 (registration)
    Dispatch registration: 'update_shelf' listed in contentToolNames array to route calls to handleContentTool.
    "update_shelf", "delete_shelf", ];

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