delete-all-documents
Remove all documents from a specified Meilisearch index to clear data or reset content, ensuring precise index management through the Meilisearch MCP Server.
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 deletes all documents from the specified Meilisearch index by calling the API delete 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 validating the indexUid parameter for the tool.{ indexUid: z.string().describe('Unique identifier of the index'), },
- src/tools/document-tools.ts:245-261 (registration)MCP server.tool registration for the 'delete-all-documents' tool, including name, description, schema, and handler.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/tools/document-tools.ts:50-52 (schema)TypeScript interface defining parameters for the delete-all-documents handler.interface DeleteAllDocumentsParams { indexUid: string; }
- src/index.ts:65-65 (registration)Invocation of document tools registration function which includes the delete-all-documents tool.registerDocumentTools(server);