Skip to main content
Glama
devlimelabs

Meilisearch MCP Server

by devlimelabs

delete-documents

Remove multiple documents by their IDs from a Meilisearch index to manage data and maintain search relevance.

Instructions

Delete multiple documents by their IDs from a Meilisearch index

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
indexUidYesUnique identifier of the index
documentIdsYesJSON array of document IDs to delete

Implementation Reference

  • Handler function that parses the JSON string of document IDs, validates it's an array, and sends a POST request to Meilisearch's delete-batch endpoint.
    async ({ indexUid, documentIds }: DeleteDocumentsParams) => {
      try {
        // Parse the document IDs string to ensure it's valid JSON
        const parsedDocumentIds = JSON.parse(documentIds);
        
        // Ensure document IDs is an array
        if (!Array.isArray(parsedDocumentIds)) {
          return {
            isError: true,
            content: [{ type: 'text', text: 'Document IDs must be a JSON array' }],
          };
        }
        
        const response = await apiClient.post(`/indexes/${indexUid}/documents/delete-batch`, parsedDocumentIds);
        return {
          content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }],
        };
      } catch (error) {
        return createErrorResponse(error);
      }
    }
  • Zod input schema defining parameters: indexUid (string) and documentIds (string representing JSON array).
    {
      indexUid: z.string().describe('Unique identifier of the index'),
      documentIds: z.string().describe('JSON array of document IDs to delete'),
    },
  • MCP server.tool registration for 'delete-documents', including name, description, input schema, and inline handler function.
    server.tool(
      'delete-documents',
      'Delete multiple documents by their IDs from a Meilisearch index',
      {
        indexUid: z.string().describe('Unique identifier of the index'),
        documentIds: z.string().describe('JSON array of document IDs to delete'),
      },
      async ({ indexUid, documentIds }: DeleteDocumentsParams) => {
        try {
          // Parse the document IDs string to ensure it's valid JSON
          const parsedDocumentIds = JSON.parse(documentIds);
          
          // Ensure document IDs is an array
          if (!Array.isArray(parsedDocumentIds)) {
            return {
              isError: true,
              content: [{ type: 'text', text: 'Document IDs must be a JSON array' }],
            };
          }
          
          const response = await apiClient.post(`/indexes/${indexUid}/documents/delete-batch`, parsedDocumentIds);
          return {
            content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }],
          };
        } catch (error) {
          return createErrorResponse(error);
        }
      }
    );
  • TypeScript interface defining parameters for the delete-documents tool handler.
    interface DeleteDocumentsParams {
      indexUid: string;
      documentIds: string;
    }
  • src/index.ts:65-65 (registration)
    Invocation of registerDocumentTools which registers the delete-documents tool among others.
    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 the full burden. It states the tool deletes documents, implying a destructive mutation, but doesn't disclose critical behavioral traits like whether deletions are permanent, if there's a confirmation step, rate limits, authentication requirements, or what happens if some IDs don't exist. For a destructive tool with zero annotation coverage, this is a significant gap.

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 action ('Delete multiple documents') and includes essential details ('by their IDs', 'from a Meilisearch index') without any wasted words. Every part 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 destructive mutation tool with no annotations and no output schema, the description is incomplete. It doesn't cover behavioral aspects (e.g., permanence, error handling), usage context (e.g., when to use vs. siblings), or output expectations. The high schema coverage helps with parameters, but overall context is lacking.

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 both parameters ('indexUid' and 'documentIds'). The description adds minimal value beyond the schema by mentioning 'IDs' and 'Meilisearch index', but doesn't provide additional context like ID format, array size limits, or error handling. Baseline 3 is appropriate when the schema does the heavy lifting.

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

Purpose5/5

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

The description clearly states the action ('Delete'), the target ('multiple documents'), the mechanism ('by their IDs'), and the location ('from a Meilisearch index'). It distinguishes itself from sibling tools like 'delete-document' (singular) and 'delete-all-documents' (all documents).

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 like 'delete-document' (for single documents) or 'delete-all-documents' (for all documents). It also doesn't mention prerequisites, such as needing an existing index or valid document IDs.

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