list-tasks
Retrieve and filter tasks from Meilisearch MCP Server by status, type, index UID, or specific task UID, enabling detailed task tracking and management.
Instructions
List tasks with optional filtering
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| from | No | Task uid from which to start fetching | |
| indexUids | No | UIDs of the indexes on which tasks were performed | |
| limit | No | Maximum number of tasks to return | |
| statuses | No | Statuses of tasks to return | |
| types | No | Types of tasks to return | |
| uids | No | UIDs of specific tasks to return |
Implementation Reference
- src/tools/task-tools.ts:58-75 (handler)The handler function for the 'list-tasks' tool. It builds query parameters from the input filters and calls the Meilisearch /tasks API endpoint to retrieve and return the list of tasks as JSON.async ({ limit, from, statuses, types, indexUids, uids }: ListTasksParams) => { try { const params: Record<string, any> = {}; if (limit !== undefined) params.limit = limit; if (from !== undefined) params.from = from; if (statuses && statuses.length > 0) params.statuses = statuses.join(','); if (types && types.length > 0) params.types = types.join(','); if (indexUids && indexUids.length > 0) params.indexUids = indexUids.join(','); if (uids && uids.length > 0) params.uids = uids.join(','); const response = await apiClient.get('/tasks', { params }); return { content: [{ type: "text", text: JSON.stringify(response.data, null, 2) }], }; } catch (error) { return createErrorResponse(error); } }
- src/tools/task-tools.ts:51-57 (schema)Zod input schema defining the parameters for the 'list-tasks' tool, including optional filters for limit, offset, statuses, types, indexUids, and uids.limit: z.number().min(0).optional().describe("Maximum number of tasks to return"), from: z.number().min(0).optional().describe("Task uid from which to start fetching"), statuses: z.array(z.enum(["enqueued", "processing", "succeeded", "failed", "canceled"])).optional().describe("Statuses of tasks to return"), types: z.array(z.enum(["indexCreation", "indexUpdate", "indexDeletion", "documentAddition", "documentUpdate", "documentDeletion", "settingsUpdate", "dumpCreation", "taskCancelation"])).optional().describe("Types of tasks to return"), indexUids: z.array(z.string()).optional().describe("UIDs of the indexes on which tasks were performed"), uids: z.array(z.number()).optional().describe("UIDs of specific tasks to return"), },
- src/tools/task-tools.ts:48-76 (registration)Direct registration of the 'list-tasks' MCP tool on the server, including name, description, input schema, and handler function."list-tasks", "List tasks with optional filtering", { limit: z.number().min(0).optional().describe("Maximum number of tasks to return"), from: z.number().min(0).optional().describe("Task uid from which to start fetching"), statuses: z.array(z.enum(["enqueued", "processing", "succeeded", "failed", "canceled"])).optional().describe("Statuses of tasks to return"), types: z.array(z.enum(["indexCreation", "indexUpdate", "indexDeletion", "documentAddition", "documentUpdate", "documentDeletion", "settingsUpdate", "dumpCreation", "taskCancelation"])).optional().describe("Types of tasks to return"), indexUids: z.array(z.string()).optional().describe("UIDs of the indexes on which tasks were performed"), uids: z.array(z.number()).optional().describe("UIDs of specific tasks to return"), }, async ({ limit, from, statuses, types, indexUids, uids }: ListTasksParams) => { try { const params: Record<string, any> = {}; if (limit !== undefined) params.limit = limit; if (from !== undefined) params.from = from; if (statuses && statuses.length > 0) params.statuses = statuses.join(','); if (types && types.length > 0) params.types = types.join(','); if (indexUids && indexUids.length > 0) params.indexUids = indexUids.join(','); if (uids && uids.length > 0) params.uids = uids.join(','); const response = await apiClient.get('/tasks', { params }); return { content: [{ type: "text", text: JSON.stringify(response.data, null, 2) }], }; } catch (error) { return createErrorResponse(error); } } );
- src/index.ts:70-70 (registration)High-level registration call to registerTaskTools(server), which includes the 'list-tasks' tool among task management tools.registerTaskTools(server);
- src/tools/task-tools.ts:14-21 (schema)TypeScript interface defining the parameter types for the list-tasks handler function.interface ListTasksParams { limit?: number; from?: number; statuses?: string[]; types?: string[]; indexUids?: string[]; uids?: number[]; }