delete-tasks
Remove tasks from Meilisearch MCP Server by filtering based on status, type, index UID, task UID, or date range to manage task history and optimize server performance.
Instructions
Delete tasks based on provided filters
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| beforeFinishedAt | No | Delete tasks that finished processing before this date (ISO 8601 format) | |
| beforeStartedAt | No | Delete tasks that started processing before this date (ISO 8601 format) | |
| beforeUid | No | Delete tasks whose uid is before this value | |
| canceledBy | No | UIDs of the tasks that canceled tasks to delete | |
| indexUids | No | UIDs of the indexes on which tasks to delete were performed | |
| statuses | No | Statuses of tasks to delete | |
| types | No | Types of tasks to delete | |
| uids | No | UIDs of the tasks to delete |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"beforeFinishedAt": {
"description": "Delete tasks that finished processing before this date (ISO 8601 format)",
"type": "string"
},
"beforeStartedAt": {
"description": "Delete tasks that started processing before this date (ISO 8601 format)",
"type": "string"
},
"beforeUid": {
"description": "Delete tasks whose uid is before this value",
"type": "number"
},
"canceledBy": {
"description": "UIDs of the tasks that canceled tasks to delete",
"items": {
"type": "number"
},
"type": "array"
},
"indexUids": {
"description": "UIDs of the indexes on which tasks to delete were performed",
"items": {
"type": "string"
},
"type": "array"
},
"statuses": {
"description": "Statuses of tasks to delete",
"items": {
"enum": [
"succeeded",
"failed",
"canceled"
],
"type": "string"
},
"type": "array"
},
"types": {
"description": "Types of tasks to delete",
"items": {
"enum": [
"indexCreation",
"indexUpdate",
"indexDeletion",
"documentAddition",
"documentUpdate",
"documentDeletion",
"settingsUpdate",
"dumpCreation",
"taskCancelation"
],
"type": "string"
},
"type": "array"
},
"uids": {
"description": "UIDs of the tasks to delete",
"items": {
"type": "number"
},
"type": "array"
}
},
"type": "object"
}
Implementation Reference
- src/tools/system-tools.ts:134-153 (handler)The handler function for the 'delete-tasks' tool. It builds a request body from the input parameters and sends a POST request to '/tasks/delete' using apiClient, returning the response or error.async ({ statuses, types, indexUids, uids, canceledBy, beforeUid, beforeStartedAt, beforeFinishedAt }) => { try { const body: Record<string, any> = {}; if (statuses && statuses.length > 0) body.statuses = statuses; if (types && types.length > 0) body.types = types; if (indexUids && indexUids.length > 0) body.indexUids = indexUids; if (uids && uids.length > 0) body.uids = uids; if (canceledBy && canceledBy.length > 0) body.canceledBy = canceledBy; if (beforeUid !== undefined) body.beforeUid = beforeUid; if (beforeStartedAt) body.beforeStartedAt = beforeStartedAt; if (beforeFinishedAt) body.beforeFinishedAt = beforeFinishedAt; const response = await apiClient.post('/tasks/delete', body); return { content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }], }; } catch (error) { return createErrorResponse(error); } }
- src/tools/system-tools.ts:124-133 (schema)Input schema using Zod for the parameters accepted by the 'delete-tasks' tool.{ statuses: z.array(z.enum(['succeeded', 'failed', 'canceled'])).optional().describe('Statuses of tasks to delete'), types: z.array(z.enum(['indexCreation', 'indexUpdate', 'indexDeletion', 'documentAddition', 'documentUpdate', 'documentDeletion', 'settingsUpdate', 'dumpCreation', 'taskCancelation'])).optional().describe('Types of tasks to delete'), indexUids: z.array(z.string()).optional().describe('UIDs of the indexes on which tasks to delete were performed'), uids: z.array(z.number()).optional().describe('UIDs of the tasks to delete'), canceledBy: z.array(z.number()).optional().describe('UIDs of the tasks that canceled tasks to delete'), beforeUid: z.number().optional().describe('Delete tasks whose uid is before this value'), beforeStartedAt: z.string().optional().describe('Delete tasks that started processing before this date (ISO 8601 format)'), beforeFinishedAt: z.string().optional().describe('Delete tasks that finished processing before this date (ISO 8601 format)'), },
- src/tools/system-tools.ts:120-154 (registration)The MCP server.tool call that registers the 'delete-tasks' tool, including name, description, input schema, and handler function.// Delete tasks server.tool( 'delete-tasks', 'Delete tasks based on provided filters', { statuses: z.array(z.enum(['succeeded', 'failed', 'canceled'])).optional().describe('Statuses of tasks to delete'), types: z.array(z.enum(['indexCreation', 'indexUpdate', 'indexDeletion', 'documentAddition', 'documentUpdate', 'documentDeletion', 'settingsUpdate', 'dumpCreation', 'taskCancelation'])).optional().describe('Types of tasks to delete'), indexUids: z.array(z.string()).optional().describe('UIDs of the indexes on which tasks to delete were performed'), uids: z.array(z.number()).optional().describe('UIDs of the tasks to delete'), canceledBy: z.array(z.number()).optional().describe('UIDs of the tasks that canceled tasks to delete'), beforeUid: z.number().optional().describe('Delete tasks whose uid is before this value'), beforeStartedAt: z.string().optional().describe('Delete tasks that started processing before this date (ISO 8601 format)'), beforeFinishedAt: z.string().optional().describe('Delete tasks that finished processing before this date (ISO 8601 format)'), }, async ({ statuses, types, indexUids, uids, canceledBy, beforeUid, beforeStartedAt, beforeFinishedAt }) => { try { const body: Record<string, any> = {}; if (statuses && statuses.length > 0) body.statuses = statuses; if (types && types.length > 0) body.types = types; if (indexUids && indexUids.length > 0) body.indexUids = indexUids; if (uids && uids.length > 0) body.uids = uids; if (canceledBy && canceledBy.length > 0) body.canceledBy = canceledBy; if (beforeUid !== undefined) body.beforeUid = beforeUid; if (beforeStartedAt) body.beforeStartedAt = beforeStartedAt; if (beforeFinishedAt) body.beforeFinishedAt = beforeFinishedAt; const response = await apiClient.post('/tasks/delete', body); return { content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }], }; } catch (error) { return createErrorResponse(error); } } );