Skip to main content
Glama
OrionPotter

Meilisearch MCP Server

by OrionPotter

get-documents

Retrieve documents from a Meilisearch index using filters, pagination, and field selection to access stored data.

Instructions

Get documents from a Meilisearch index

Input 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

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "fields": { "description": "Fields to return in the documents", "items": { "type": "string" }, "type": "array" }, "filter": { "description": "Filter query to apply", "type": "string" }, "indexUid": { "description": "Unique identifier of the index", "type": "string" }, "limit": { "description": "Maximum number of documents to return (default: 20)", "maximum": 1000, "minimum": 1, "type": "number" }, "offset": { "description": "Number of documents to skip (default: 0)", "minimum": 0, "type": "number" } }, "required": [ "indexUid" ], "type": "object" }

Implementation Reference

  • The handler function that fetches documents from the specified Meilisearch index using apiClient.get with optional limit, offset, fields, and filter parameters. Returns the JSON response or handles errors with createErrorResponse.
    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 input schema defining parameters for the get-documents tool: required indexUid and optional limit (1-1000), offset (>=0), fields (array of strings), filter (string).
    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'), },
  • The server.tool() call that registers the 'get-documents' tool with MCP server, including name, description, input schema, and handler function.
    '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)
    Invocation of registerDocumentTools(server) in the main server setup, which registers all document management tools including 'get-documents'.
    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; }

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/OrionPotter/iflow-mcp_meilisearch-ts-mcp'

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