Skip to main content
Glama

update_shelf

Modify an existing shelf's properties including name, description, books, and tags in BookStack to maintain organized content structure.

Instructions

Update an existing shelf

Input Schema

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

Implementation Reference

  • Handler logic for the 'update_shelf' tool within the handleContentTool switch statement. Parses arguments, validates input using UpdateShelfSchema, converts tags, calls the BookStack client to update the shelf, and formats the 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); }
  • Zod schema definitions for shelf creation and updates. UpdateShelfSchema is a partial of CreateShelfSchema and is used for input validation in the handler.
    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();
  • Tool registration in createContentTools function, defining the 'update_shelf' tool name, description, and input schema for MCP.
    { 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"], },
  • BookStackClient method that performs the actual API PUT request to update a shelf via `/shelves/{id}` endpoint.
    async updateShelf( id: number, data: Partial<CreateShelfRequest> ): Promise<Shelf> { return this.put<Shelf>(`/shelves/${id}`, data); }
  • src/index.ts:97-100 (registration)
    Lists 'update_shelf' in the contentToolNames array used to route tool calls to handleContentTool in the main MCP server handler.
    "create_shelf", "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