Skip to main content
Glama
OrionPotter

Meilisearch MCP Server

by OrionPotter

cancel-tasks

Cancel queued or processing tasks in Meilisearch by filtering by status, type, index, or task ID to manage task execution.

Instructions

Cancel tasks based on provided filters

Input Schema

NameRequiredDescriptionDefault
statusesNoStatuses of tasks to cancel
typesNoTypes of tasks to cancel
indexUidsNoUIDs of the indexes on which tasks to cancel were performed
uidsNoUIDs of the tasks to cancel

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "indexUids": { "description": "UIDs of the indexes on which tasks to cancel were performed", "items": { "type": "string" }, "type": "array" }, "statuses": { "description": "Statuses of tasks to cancel", "items": { "enum": [ "enqueued", "processing" ], "type": "string" }, "type": "array" }, "types": { "description": "Types of tasks to cancel", "items": { "enum": [ "indexCreation", "indexUpdate", "indexDeletion", "documentAddition", "documentUpdate", "documentDeletion", "settingsUpdate", "dumpCreation", "taskCancelation" ], "type": "string" }, "type": "array" }, "uids": { "description": "UIDs of the tasks to cancel", "items": { "type": "number" }, "type": "array" } }, "type": "object" }

Implementation Reference

  • Handler function that implements the cancel-tasks tool logic. It builds a request body from the input parameters (statuses, types, indexUids, uids) and sends a POST request to the '/tasks/cancel' endpoint via apiClient. Returns the JSON response or an error response.
    async ({ statuses, types, indexUids, uids }: CancelTasksParams) => { 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; const response = await apiClient.post('/tasks/cancel', body); return { content: [{ type: "text", text: JSON.stringify(response.data, null, 2) }], }; } catch (error) { return createErrorResponse(error); } }
  • Zod input schema for the cancel-tasks tool, defining optional array parameters for filtering tasks to cancel.
    { statuses: z.array(z.enum(["enqueued", "processing"])).optional().describe("Statuses of tasks to cancel"), types: z.array(z.enum(["indexCreation", "indexUpdate", "indexDeletion", "documentAddition", "documentUpdate", "documentDeletion", "settingsUpdate", "dumpCreation", "taskCancelation"])).optional().describe("Types of tasks to cancel"), indexUids: z.array(z.string()).optional().describe("UIDs of the indexes on which tasks to cancel were performed"), uids: z.array(z.number()).optional().describe("UIDs of the tasks to cancel"), },
  • Registration of the cancel-tasks tool on the MCP server using server.tool(), including name, description, input schema, and handler.
    server.tool( "cancel-tasks", "Cancel tasks based on provided filters", { statuses: z.array(z.enum(["enqueued", "processing"])).optional().describe("Statuses of tasks to cancel"), types: z.array(z.enum(["indexCreation", "indexUpdate", "indexDeletion", "documentAddition", "documentUpdate", "documentDeletion", "settingsUpdate", "dumpCreation", "taskCancelation"])).optional().describe("Types of tasks to cancel"), indexUids: z.array(z.string()).optional().describe("UIDs of the indexes on which tasks to cancel were performed"), uids: z.array(z.number()).optional().describe("UIDs of the tasks to cancel"), }, async ({ statuses, types, indexUids, uids }: CancelTasksParams) => { 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; const response = await apiClient.post('/tasks/cancel', body); return { content: [{ type: "text", text: JSON.stringify(response.data, null, 2) }], }; } catch (error) { return createErrorResponse(error); } } );
  • TypeScript interface defining the parameters for the cancel-tasks handler.
    interface CancelTasksParams { statuses?: string[]; types?: string[]; indexUids?: string[]; uids?: number[]; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/OrionPotter/iflow-mcp_meilisearch-ts-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server