Skip to main content
Glama
OrionPotter

Meilisearch MCP Server

by OrionPotter

get-document

Retrieve a specific document from a Meilisearch index using its unique ID, optionally selecting which fields to return in the result.

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 retrieves a specific document from a Meilisearch index by ID using the configured API client and returns the JSON-formatted response or an error response.
      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 defining the input parameters for the 'get-document' tool: required indexUid and documentId, optional fields array.
      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) => {
  • Registration of the 'get-document' MCP tool on the server, specifying name, description, input schema, and handler function.
      '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);
        }
      }
    );
  • TypeScript interface defining the parameters for the get-document tool, used in the handler type annotation.
    interface GetDocumentParams {
      indexUid: string;
      documentId: string;
      fields?: string[];
    }
  • src/index.ts:65-65 (registration)
    Call to registerDocumentTools function which includes registration of the 'get-document' tool.
    registerDocumentTools(server);
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states it retrieves a document but doesn't disclose behavioral aspects like error handling (e.g., what happens if the ID doesn't exist), performance characteristics, authentication requirements, or return format. This leaves significant gaps for an agent to understand how the tool behaves.

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 front-loads the core purpose without unnecessary words. Every part of the sentence contributes directly to understanding what the tool does, making it appropriately concise and well-structured.

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 lack of annotations and output schema, the description is incomplete for a retrieval tool. It doesn't explain what is returned (e.g., document fields, error responses), how to handle missing documents, or any system constraints. For a tool with 3 parameters and no structured output documentation, more contextual information is needed.

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 all parameters clearly documented in the schema itself. The description adds no additional parameter semantics beyond implying the tool uses an ID for retrieval. This meets the baseline of 3 when the schema does the heavy lifting, though no value is added beyond the structured data.

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 ('document by its ID from a Meilisearch index'), making the purpose immediately understandable. It doesn't explicitly distinguish from sibling tools like 'get-documents' (plural) or 'search', but the specificity of retrieving by ID provides some implicit 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?

The description provides no guidance on when to use this tool versus alternatives. With siblings like 'get-documents' (plural retrieval), 'search' (query-based), and 'delete-document' (removal), there's no indication of appropriate contexts, prerequisites, or exclusions for this specific ID-based retrieval.

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

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