Skip to main content
Glama
devlimelabs

Meilisearch MCP Server

by devlimelabs

get-document

Retrieve a specific document by its ID from a Meilisearch index, optionally selecting which fields to return for targeted data access.

Instructions

Get a document by its ID from a Meilisearch index

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
indexUidYesUnique identifier of the index
documentIdYesID of the document to retrieve
fieldsNoFields to return in the document

Implementation Reference

  • Handler function that fetches a single document by ID from a Meilisearch index using the apiClient, returns JSON stringified response or error.
    async ({ indexUid, documentId, fields }: GetDocumentParams) => {
      try {
        const response = await apiClient.get(`/indexes/${indexUid}/documents/${documentId}`, {
          params: {
            fields: fields?.join(','),
          },
        });
        return {
          content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }],
        };
      } catch (error) {
        return createErrorResponse(error);
      }
    }
  • Zod schema for tool input parameters: indexUid, documentId, and optional fields.
    {
      indexUid: z.string().describe('Unique identifier of the index'),
      documentId: z.string().describe('ID of the document to retrieve'),
      fields: z.array(z.string()).optional().describe('Fields to return in the document'),
    },
  • server.tool registration of the 'get-document' tool including name, description, schema, and handler.
    server.tool(
      'get-document',
      'Get a document by its ID from a Meilisearch index',
      {
        indexUid: z.string().describe('Unique identifier of the index'),
        documentId: z.string().describe('ID of the document to retrieve'),
        fields: z.array(z.string()).optional().describe('Fields to return in the document'),
      },
      async ({ indexUid, documentId, fields }: GetDocumentParams) => {
        try {
          const response = await apiClient.get(`/indexes/${indexUid}/documents/${documentId}`, {
            params: {
              fields: fields?.join(','),
            },
          });
          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 which registers the get-document tool among others.
    registerDocumentTools(server);
  • TypeScript interface defining parameters for the get-document handler.
    interface GetDocumentParams {
      indexUid: string;
      documentId: string;
      fields?: string[];
    }
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. It states it 'gets' a document but doesn't describe what happens if the document doesn't exist (error behavior), whether this is a read-only operation, performance characteristics, or what the return format looks like. For a retrieval tool with zero annotation coverage, this leaves significant behavioral questions unanswered.

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 that gets straight to the point with zero wasted words. It's appropriately sized for a straightforward retrieval operation and front-loads the essential information about what the tool does.

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 retrieval tool with no annotations and no output schema, the description is insufficient. It doesn't explain what gets returned (document fields, format, error cases), doesn't mention the optional 'fields' parameter's purpose, and provides no context about the Meilisearch system. Given the complexity of having sibling tools and no structured output information, this leaves too many gaps for effective tool selection and use.

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 already documents all three parameters thoroughly. The description doesn't add any meaningful parameter semantics beyond what's in the schema - it mentions 'by its ID' which aligns with documentId parameter, but provides no additional context about parameter usage, relationships, or examples. Baseline 3 is appropriate when 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 action ('Get') and resource ('a document by its ID from a Meilisearch index'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'get-documents' (plural) which retrieves multiple documents, or 'search' which finds documents via queries rather than direct ID lookup.

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. It doesn't mention that this is for retrieving a single known document by ID, as opposed to using 'get-documents' for multiple documents, 'search' for query-based retrieval, or 'facet-search' for filtered results. No context about prerequisites or typical use cases is provided.

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