Skip to main content
Glama
devlimelabs

Meilisearch MCP Server

by devlimelabs

get-documents

Retrieve documents from a Meilisearch index by specifying filters, fields, and pagination parameters to access stored data.

Instructions

Get documents from a Meilisearch index

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
indexUidYesUnique identifier of the index
limitNoMaximum number of documents to return (default: 20)
offsetNoNumber of documents to skip (default: 0)
fieldsNoFields to return in the documents
filterNoFilter query to apply

Implementation Reference

  • Handler function that implements the core logic of the 'get-documents' tool by querying the Meilisearch API for documents in the specified index with optional pagination, field selection, and filtering.
    async ({ indexUid, limit, offset, fields, filter }: GetDocumentsParams) => {
      try {
        const response = await apiClient.get(`/indexes/${indexUid}/documents`, {
          params: {
            limit,
            offset,
            fields: fields?.join(','),
            filter,
          },
        });
        return {
          content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }],
        };
      } catch (error) {
        return createErrorResponse(error);
      }
    }
  • Zod schema defining the input parameters for the 'get-documents' tool: indexUid (required), limit, offset, fields, filter (optional).
    {
      indexUid: z.string().describe('Unique identifier of the index'),
      limit: z.number().min(1).max(1000).optional().describe('Maximum number of documents to return (default: 20)'),
      offset: z.number().min(0).optional().describe('Number of documents to skip (default: 0)'),
      fields: z.array(z.string()).optional().describe('Fields to return in the documents'),
      filter: z.string().optional().describe('Filter query to apply'),
    },
  • Registration of the 'get-documents' tool using server.tool(), specifying the tool name, description, input schema, and handler function within the registerDocumentTools module.
      'get-documents',
      'Get documents from a Meilisearch index',
      {
        indexUid: z.string().describe('Unique identifier of the index'),
        limit: z.number().min(1).max(1000).optional().describe('Maximum number of documents to return (default: 20)'),
        offset: z.number().min(0).optional().describe('Number of documents to skip (default: 0)'),
        fields: z.array(z.string()).optional().describe('Fields to return in the documents'),
        filter: z.string().optional().describe('Filter query to apply'),
      },
      async ({ indexUid, limit, offset, fields, filter }: GetDocumentsParams) => {
        try {
          const response = await apiClient.get(`/indexes/${indexUid}/documents`, {
            params: {
              limit,
              offset,
              fields: fields?.join(','),
              filter,
            },
          });
          return {
            content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }],
          };
        } catch (error) {
          return createErrorResponse(error);
        }
      }
    );
  • src/index.ts:65-65 (registration)
    Top-level call to registerDocumentTools(server) in the main MCP server initialization, which includes the 'get-documents' tool among others.
    registerDocumentTools(server);
  • TypeScript interface defining the parameters for the get-documents handler function.
    interface GetDocumentsParams {
      indexUid: string;
      limit?: number;
      offset?: number;
      fields?: string[];
      filter?: string;
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It states 'Get documents' but doesn't disclose behavioral traits like whether this is a read-only operation, potential rate limits, authentication needs, or what happens on errors. The description is minimal and lacks critical operational context for safe invocation.

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

Conciseness4/5

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

The description is a single, efficient sentence with no wasted words. It's front-loaded with the core action and resource. However, it's overly concise to the point of under-specification, missing necessary details for a tool with 5 parameters and no annotations.

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?

Given the tool's complexity (5 parameters, no annotations, no output schema), the description is incomplete. It doesn't explain return values, error handling, or how it fits among many sibling tools. For a retrieval tool in a search system, more context is needed to ensure correct usage.

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%, with clear documentation for all 5 parameters (e.g., indexUid, limit, offset). The description adds no additional meaning beyond the schema, such as explaining parameter interactions or typical use cases. Baseline score of 3 is appropriate since the schema does the heavy lifting.

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

Purpose3/5

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

The description 'Get documents from a Meilisearch index' states the action (get) and resource (documents) but is vague about scope and behavior. It doesn't specify whether this retrieves all documents, a subset, or how it differs from sibling tools like 'search' or 'get-document'. The purpose is clear at a basic level but lacks specificity for differentiation.

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?

No guidance is provided on when to use this tool versus alternatives like 'search', 'get-document', or 'list-indexes'. The description implies retrieval but doesn't specify use cases such as batch fetching, pagination, or filtering scenarios. Without context, an agent might misuse it where other tools are more appropriate.

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/devlimelabs/meilisearch-ts-mcp'

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