Skip to main content
Glama

create_shelf

Create a new shelf in BookStack to organize books by adding a name, description, and optional books or tags for structured content management.

Instructions

Create a new shelf

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
booksNoArray of book IDs to add to shelf
descriptionNoShelf description (plain text)
description_htmlNoShelf description (HTML format)
nameYesShelf name (required, max 255 chars)
tagsNoArray of tags with name and value

Implementation Reference

  • Handler logic for the 'create_shelf' tool: parses input with schema, processes tags, calls BookStackClient.createShelf, and formats the response.
    case "create_shelf": { const validatedData = CreateShelfSchema.parse(args); const data = { ...validatedData, tags: convertTags(validatedData.tags), }; const result = await client.createShelf(data); return formatApiResponse(result); }
  • Tool registration object defining the 'create_shelf' name, description, and input schema for MCP.
    { name: "create_shelf", description: "Create a new shelf", inputSchema: { type: "object", properties: { name: { type: "string", description: "Shelf name (required, 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 to add to shelf", 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: ["name"], },
  • Zod schema for validating input parameters of the create_shelf tool.
    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(), });
  • BookStackClient helper method that makes the POST API request to create a shelf.
    async createShelf(data: CreateShelfRequest): Promise<Shelf> { return this.post<Shelf>("/shelves", data); }
  • Helper function to convert input tags to the proper Tag format used in the handler.
    function convertTags( inputTags?: { name: string; value: string; order?: number }[] ): Tag[] | undefined { if (!inputTags) return undefined; return inputTags.map((tag) => ({ name: tag.name, value: tag.value, order: tag.order ?? 0, })); }

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