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.

Instructions

Create a new shelf

Input Schema

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

Implementation Reference

  • Main execution logic for the 'create_shelf' MCP tool: validates arguments using Zod schema, converts tags to proper format, invokes BookStackClient.createShelf API wrapper, and returns a formatted JSON 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);
    }
  • Zod runtime validation schema for 'create_shelf' tool inputs, used in the handler to parse and validate arguments.
    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(),
    });
  • MCP Tool registration object defining name, description, and inputSchema for 'create_shelf', returned by createContentTools().
    {
      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"],
      },
    },
  • src/index.ts:56-59 (registration)
    Combines content tools (including create_shelf) with other tools into allTools list, used for MCP server tool listing.
    const allTools: Tool[] = [
      ...createContentTools(bookStackClient),
      ...createSearchAndUserTools(bookStackClient),
    ];
  • BookStackClient helper method that performs the actual API POST 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 expected by BookStack API.
    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,
      }));
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. 'Create a new shelf' implies a write operation but doesn't address permissions, side effects, error conditions, or what happens on success. For a creation tool with zero annotation coverage, this is insufficient behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero wasted words. It's appropriately sized for a simple creation operation and front-loads the essential information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a creation tool with 5 parameters, no annotations, and no output schema, the description is inadequate. It doesn't explain what gets returned, error handling, or system behavior beyond the basic creation action. The schema covers parameters well, but the overall context is incomplete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents all 5 parameters. The description adds no parameter information beyond what's in the schema, maintaining the baseline score of 3 where the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Create') and resource ('new shelf'), making the purpose immediately understandable. It doesn't differentiate from sibling tools like 'create_book' or 'create_user', but it's unambiguous about what it creates.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'update_shelf' or 'list_shelves'. It doesn't mention prerequisites, constraints, or typical use cases, leaving the agent to infer usage from context alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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