Skip to main content
Glama
OrionPotter

Meilisearch MCP Server

by OrionPotter

delete-all-documents

Remove all documents from a Meilisearch index to clear data or reset content for testing and maintenance purposes.

Instructions

Delete all documents in a Meilisearch index

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
indexUidYesUnique identifier of the index

Implementation Reference

  • Handler function that deletes all documents from the specified Meilisearch index using the API client.
    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.
    {
      indexUid: z.string().describe('Unique identifier of the index'),
    },
  • TypeScript interface for the tool parameters.
    interface DeleteAllDocumentsParams {
      indexUid: string;
    }
  • Registration of the 'delete-all-documents' tool on the MCP server.
    server.tool(
      '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 registration call that includes the document tools module.
    registerDocumentTools(server);

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