Skip to main content
Glama
ttpears

BookStack MCP Server

by ttpears

List Attachments

get_attachments

Retrieve files and links from BookStack with filtering and sorting options to organize documentation attachments.

Instructions

List attachments (files and links) with filtering and sorting

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
offsetNoPagination offset
countNoNumber of results to return
sortNoSort field
filterNoFilter criteria

Implementation Reference

  • The backend client method 'getAttachments' that performs the API request.
    async getAttachments(options?: {
      offset?: number;
      count?: number;
      sort?: string;
      filter?: Record<string, any>;
    }): Promise<ListResponse<Attachment>> {
      const params: any = {
        offset: options?.offset || 0,
        count: Math.min(options?.count || 50, 500)
      };
      
      if (options?.sort) params.sort = options.sort;
      if (options?.filter) params.filter = JSON.stringify(options.filter);
      
      const response = await this.client.get('/attachments', { params });
      const data = response.data;
      
      return {
        ...data,
        data: data.data.map((attachment: Attachment) => ({
          ...attachment,
          page_url: `${this.baseUrl}/books/${Math.floor(attachment.uploaded_to / 1000)}/page/${attachment.uploaded_to}`,
          direct_link: `[${attachment.name}](${this.baseUrl}/attachments/${attachment.id})`
        }))
      };
    }
  • src/index.ts:403-425 (registration)
    MCP tool registration for 'get_attachments' and the handler implementation that calls the client.
    server.registerTool(
      "get_attachments",
      {
        title: "List Attachments",
        description: "List attachments (files and links) with filtering and sorting",
        inputSchema: {
          offset: z.coerce.number().default(0).describe("Pagination offset"),
          count: z.coerce.number().max(500).default(50).describe("Number of results to return"),
          sort: z.string().optional().describe("Sort field"),
          filter: z.record(z.any()).optional().describe("Filter criteria")
        }
      },
      async (args) => {
        const attachments = await client.getAttachments({
          offset: args.offset,
          count: args.count,
          sort: args.sort,
          filter: args.filter
        });
        return {
          content: [{ type: "text", text: JSON.stringify(attachments, null, 2) }]
        };
      }
  • Input schema definition for the 'get_attachments' tool.
    inputSchema: {
      offset: z.coerce.number().default(0).describe("Pagination offset"),
      count: z.coerce.number().max(500).default(50).describe("Number of results to return"),
      sort: z.string().optional().describe("Sort field"),
      filter: z.record(z.any()).optional().describe("Filter criteria")
    }
Behavior2/5

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

With no annotations provided, the description carries full burden but lacks behavioral details. It doesn't disclose whether this is a read-only operation, potential rate limits, authentication requirements, or what happens with large result sets beyond the schema's pagination hints. The mention of 'filtering and sorting' is minimal and doesn't explain implementation constraints.

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 front-loads the core purpose ('List attachments') and succinctly adds key features ('files and links' and 'with filtering and sorting'). Every element earns its place.

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 tool with 4 parameters, no annotations, and no output schema, the description is inadequate. It doesn't explain return values, error conditions, or behavioral nuances like how filtering works (the 'filter' object has no schema). The context signals indicate complexity (nested objects, 100% schema coverage), but the description fails to compensate for missing structured data.

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 parameters are well-documented in the schema itself. The description adds marginal value by implying 'filtering and sorting' map to the 'filter' and 'sort' parameters, but doesn't provide additional semantics like filterable fields, sort options, or usage examples beyond what the schema offers.

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 ('List') and resource ('attachments'), specifying they include 'files and links'. It distinguishes from sibling 'get_attachment' (singular) by implying a collection operation. However, it doesn't explicitly differentiate from other list-like siblings like 'get_books' or 'get_chapters' beyond the resource type.

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 mentions 'with filtering and sorting', which implies usage for refined queries, but provides no explicit guidance on when to use this tool versus alternatives like 'search_content' or 'get_recent_changes'. No prerequisites, exclusions, or comparative context are stated.

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/ttpears/bookstack-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server