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
| Name | Required | Description | Default |
|---|---|---|---|
| indexUid | Yes | Unique identifier of the index |
Implementation Reference
- src/tools/document-tools.ts:251-260 (handler)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); } }
- src/tools/document-tools.ts:248-250 (schema)Zod input schema for the delete-all-documents tool, defining the required indexUid parameter.{ indexUid: z.string().describe('Unique identifier of the index'), },
- src/tools/document-tools.ts:246-261 (registration)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);
- src/tools/document-tools.ts:50-52 (schema)TypeScript interface defining the parameters for the delete-all-documents tool handler.interface DeleteAllDocumentsParams { indexUid: string; }