Skip to main content
Glama
OrionPotter

Meilisearch MCP Server

by OrionPotter

delete-tasks

Remove completed, failed, or canceled tasks from Meilisearch by filtering based on status, type, index, UID, or date to manage task history and optimize system performance.

Instructions

Delete tasks based on provided filters

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
statusesNoStatuses of tasks to delete
typesNoTypes of tasks to delete
indexUidsNoUIDs of the indexes on which tasks to delete were performed
uidsNoUIDs of the tasks to delete
canceledByNoUIDs of the tasks that canceled tasks to delete
beforeUidNoDelete tasks whose uid is before this value
beforeStartedAtNoDelete tasks that started processing before this date (ISO 8601 format)
beforeFinishedAtNoDelete tasks that finished processing before this date (ISO 8601 format)

Implementation Reference

  • The handler function for the 'delete-tasks' tool. It builds a request body from the input parameters and performs a POST request to the Meilisearch '/tasks/delete' endpoint via apiClient, returning the JSON response or an error response.
    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);
      }
    }
  • Zod schema defining the input parameters for the 'delete-tasks' tool, including optional filters like statuses, types, indexUids, uids, etc.
    {
      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)'),
    },
  • The server.tool() call that registers the 'delete-tasks' tool with the MCP server, specifying name, description, input schema, and 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);
        }
      }
    );

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

C2.6/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. 'Delete' implies a destructive operation, but the description doesn't disclose critical behavioral traits: whether deletion is permanent, what permissions are required, whether there are rate limits, what happens if no filters match, or what the response looks like. For a destructive tool with zero annotation coverage, this is inadequate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise - a single 6-word sentence. While efficient, it may be too brief given the tool's complexity (8 parameters, destructive operation). Every word earns its place, but more context might be warranted.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a destructive tool with 8 parameters, no annotations, and no output schema, the description is incomplete. It doesn't explain what 'tasks' are, doesn't warn about permanence, doesn't describe response format, and doesn't provide usage context. The combination of complexity and lack of structured documentation demands more from the description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so all 8 parameters are documented in the schema. The description adds no parameter semantics beyond 'based on provided filters', which is already implied by the parameter structure. With complete schema coverage, the baseline of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Delete tasks based on provided filters' clearly states the action (delete) and resource (tasks), but it's vague about scope and doesn't distinguish from sibling tools like 'delete-documents' or 'delete-index'. It lacks specificity about what 'tasks' are in this context.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With sibling tools like 'cancel-tasks', 'delete-documents', and 'delete-index', there's no indication of when this bulk deletion tool is appropriate versus those other deletion operations.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.