Skip to main content
Glama
OrionPotter

Meilisearch MCP Server

by OrionPotter

delete-document

Remove a specific document from a Meilisearch index using its unique ID to maintain data accuracy and index cleanliness.

Instructions

Delete a document by its ID from a Meilisearch index

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
indexUidYesUnique identifier of the index
documentIdYesID of the document to delete

Implementation Reference

  • Handler function that performs the deletion of a document by ID from the specified Meilisearch index using the apiClient.
    async ({ indexUid, documentId }: DeleteDocumentParams) => {
      try {
        const response = await apiClient.delete(`/indexes/${indexUid}/documents/${documentId}`);
        return {
          content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }],
        };
      } catch (error) {
        return createErrorResponse(error);
      }
    }
  • Zod schema for input parameters of the delete-document tool: indexUid and documentId.
    {
      indexUid: z.string().describe('Unique identifier of the index'),
      documentId: z.string().describe('ID of the document to delete'),
    },
  • Registration of the 'delete-document' tool on the MCP server.
    server.tool(
      'delete-document',
      'Delete 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 delete'),
      },
      async ({ indexUid, documentId }: DeleteDocumentParams) => {
        try {
          const response = await apiClient.delete(`/indexes/${indexUid}/documents/${documentId}`);
          return {
            content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }],
          };
        } catch (error) {
          return createErrorResponse(error);
        }
      }
    );
  • TypeScript type definition for the parameters used in the delete-document handler.
    interface DeleteDocumentParams {
      indexUid: string;
      documentId: 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