Skip to main content
Glama
devlimelabs

Meilisearch MCP Server

by devlimelabs

delete-all-documents

Remove all documents from a Meilisearch index to clear data or reset content. Specify the index identifier to perform this bulk deletion operation.

Instructions

Delete all documents in a Meilisearch index

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
indexUidYesUnique identifier of the index

Implementation Reference

  • Handler function that performs the deletion of all documents in the specified Meilisearch index by calling apiClient.delete on the `/indexes/{indexUid}/documents` endpoint.
    async ({ indexUid }: DeleteAllDocumentsParams) => {
      try {
        const response = await apiClient.delete(`/indexes/${indexUid}/documents`);
        return {
          content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }],
        };
      } catch (error) {
        return createErrorResponse(error);
      }
    }
  • Zod input schema for the delete-all-documents tool, defining the required indexUid parameter.
    {
      indexUid: z.string().describe('Unique identifier of the index'),
    },
  • Direct registration of the 'delete-all-documents' tool on the MCP server, including name, description, schema, and handler.
      'delete-all-documents',
      'Delete all documents in a Meilisearch index',
      {
        indexUid: z.string().describe('Unique identifier of the index'),
      },
      async ({ indexUid }: DeleteAllDocumentsParams) => {
        try {
          const response = await apiClient.delete(`/indexes/${indexUid}/documents`);
          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(server), which includes registration of the delete-all-documents tool.
    registerDocumentTools(server);
  • TypeScript interface defining the parameters for the delete-all-documents tool handler.
    interface DeleteAllDocumentsParams {
      indexUid: 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/devlimelabs/meilisearch-ts-mcp'

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