delete-index
Remove a Meilisearch index by specifying its unique identifier to free up resources and manage your search database structure.
Instructions
Delete a Meilisearch index
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| indexUid | Yes | Unique identifier of the index to delete |
Implementation Reference
- src/tools/index-tools.ts:143-152 (handler)The handler function for the 'delete-index' tool. It deletes the specified index using the apiClient and returns the response or handles errors.
async ({ indexUid }: DeleteIndexParams) => { try { const response = await apiClient.delete(`/indexes/${indexUid}`); return { content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }], }; } catch (error) { return createErrorResponse(error); } } - src/tools/index-tools.ts:140-142 (schema)Zod input schema for the 'delete-index' tool requiring indexUid.
{ indexUid: z.string().describe('Unique identifier of the index to delete'), }, - src/tools/index-tools.ts:137-153 (registration)Module-level registration of the 'delete-index' tool using server.tool() including schema and handler.
server.tool( 'delete-index', 'Delete a Meilisearch index', { indexUid: z.string().describe('Unique identifier of the index to delete'), }, async ({ indexUid }: DeleteIndexParams) => { try { const response = await apiClient.delete(`/indexes/${indexUid}`); return { content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }], }; } catch (error) { return createErrorResponse(error); } } ); - src/tools/index-tools.ts:33-35 (schema)TypeScript interface defining the input parameters for the delete-index handler.
interface DeleteIndexParams { indexUid: string; } - src/index.ts:64-64 (registration)Top-level registration call that invokes the index tools registration, including 'delete-index'.
registerIndexTools(server);