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
| Name | Required | Description | Default |
|---|---|---|---|
| indexUid | Yes | Unique identifier of the index |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"indexUid": {
"description": "Unique identifier of the index",
"type": "string"
}
},
"required": [
"indexUid"
],
"type": "object"
}
Implementation Reference
- src/tools/document-tools.ts:251-260 (handler)Executes the deletion of all documents in the specified Meilisearch index via API call and handles response or error.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)Type definition for the input parameters of the delete-all-documents tool.interface DeleteAllDocumentsParams { indexUid: string; }
- src/tools/document-tools.ts:248-250 (schema)Zod schema for input validation of the tool.{ indexUid: z.string().describe('Unique identifier of the index'), },
- src/tools/document-tools.ts:245-261 (registration)Registers the delete-all-documents tool with the MCP server, providing name, description, input 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/index.ts:65-65 (registration)Invokes the document tools registration function in the main MCP server setup, which includes delete-all-documents.registerDocumentTools(server);