delete-tasks
Remove completed or filtered tasks from the Meilisearch MCP Server to manage task history and optimize system performance.
Instructions
Delete tasks based on provided filters
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| statuses | No | Statuses of tasks to delete | |
| types | No | Types of tasks to delete | |
| indexUids | No | UIDs of the indexes on which tasks to delete were performed | |
| uids | No | UIDs of the tasks to delete | |
| canceledBy | No | UIDs of the tasks that canceled tasks to delete | |
| beforeUid | No | Delete tasks whose uid is before this value | |
| beforeStartedAt | No | Delete tasks that started processing before this date (ISO 8601 format) | |
| beforeFinishedAt | No | Delete tasks that finished processing before this date (ISO 8601 format) |
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)Handler function that builds a filter body from input parameters and POSTs it to the Meilisearch '/tasks/delete' endpoint, 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)Zod schema defining the optional input parameters for filtering which tasks to delete.{ 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:121-154 (registration)MCP server.tool registration for 'delete-tasks', specifying name, description, input schema, and inline handler function.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); } } );
- src/index.ts:69-69 (registration)Invocation of registerSystemTools which includes registration of the 'delete-tasks' tool among system tools.registerSystemTools(server);