list-tasks
Retrieve and filter task records from Meilisearch, including status, type, and index information for monitoring operations.
Instructions
List tasks with optional filtering
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "list-tasks"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of tasks to return | |
| from | No | Task uid from which to start fetching | |
| statuses | No | Statuses of tasks to return | |
| types | No | Types of tasks to return | |
| indexUids | No | UIDs of the indexes on which tasks were performed | |
| uids | No | UIDs of specific tasks to return |
Implementation Reference
- src/tools/task-tools.ts:58-75 (handler)The handler function that implements the list-tasks tool logic: constructs query params from inputs, calls apiClient.get('/tasks'), formats response as JSON text, handles errors.
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:50-57 (schema)Zod schema defining input parameters for the list-tasks tool.
{ 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:47-76 (registration)Direct registration of the list-tasks tool on the MCP server, including name, description, input schema, and handler function.
server.tool( "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)Top-level registration call that invokes registerTaskTools(server), thereby registering the list-tasks tool among others.
registerTaskTools(server); - src/tools/task-tools.ts:14-21 (helper)TypeScript interface defining parameters for list-tasks, matching the schema and used for type annotation in handler.
interface ListTasksParams { limit?: number; from?: number; statuses?: string[]; types?: string[]; indexUids?: string[]; uids?: number[]; }