Skip to main content
Glama

batch_remove_items

Bulk delete multiple tasks or projects from OmniFocus in a single operation, streamlining task management and reducing manual effort.

Instructions

Remove multiple tasks or projects from OmniFocus in a single operation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
itemsYesArray of items (tasks or projects) to remove

Implementation Reference

  • Tool handler for batch_remove_items that validates input and calls the primitive batchRemoveItems function
    export async function handler(args: z.infer<typeof schema>, extra: RequestHandlerExtra) {
      try {
        // Validate that each item has at least an ID or name
        for (const item of args.items) {
          if (!item.id && !item.name) {
            return {
              content: [{
                type: "text" as const,
                text: "Each item must have either id or name provided to remove it."
              }],
              isError: true
            };
          }
        }
        
        // Call the batchRemoveItems function
        const result = await batchRemoveItems(args.items as BatchRemoveItemsParams[]);
        
        if (result.success) {
          const successCount = result.results.filter(r => r.success).length;
          const failureCount = result.results.filter(r => !r.success).length;
          
          let message = `✅ Successfully removed ${successCount} items.`;
          
          if (failureCount > 0) {
            message += ` ⚠️ Failed to remove ${failureCount} items.`;
          }
          
          // Include details about removed items
          const details = result.results.map((item, index) => {
            if (item.success) {
              const itemType = args.items[index].itemType;
              return `- ✅ ${itemType}: "${item.name}"`;
            } else {
              const itemType = args.items[index].itemType;
              const identifier = args.items[index].id || args.items[index].name;
              return `- ❌ ${itemType}: ${identifier} - Error: ${item.error}`;
            }
          }).join('\n');
          
          return {
            content: [{
              type: "text" as const,
              text: `${message}\n\n${details}`
            }]
          };
        } else {
          // Batch operation failed completely
          return {
            content: [{
              type: "text" as const,
              text: `Failed to process batch removal: ${result.error}`
            }],
            isError: true
          };
        }
      } catch (err: unknown) {
        const error = err as Error;
        console.error(`Tool execution error: ${error.message}`);
        return {
          content: [{
            type: "text" as const,
            text: `Error processing batch removal: ${error.message}`
          }],
          isError: true
        };
      }
    } 
  • Zod schema defining the input parameters for batch_remove_items tool
    export const schema = z.object({
      items: z.array(z.object({
        id: z.string().optional().describe("The ID of the task or project to remove"),
        name: z.string().optional().describe("The name of the task or project to remove (as fallback if ID not provided)"),
        itemType: z.enum(['task', 'project']).describe("Type of item to remove ('task' or 'project')")
      })).describe("Array of items (tasks or projects) to remove")
    });
  • src/server.ts:76-81 (registration)
    Registers the batch_remove_items tool using schema and handler from batchRemoveItemsTool
    server.tool(
      "batch_remove_items",
      "Remove multiple tasks or projects from OmniFocus in a single operation",
      batchRemoveItemsTool.schema.shape,
      batchRemoveItemsTool.handler
    );
  • Core implementation of batch removal logic, processing multiple items by calling removeItem sequentially
    export async function batchRemoveItems(items: BatchRemoveItemsParams[]): Promise<BatchResult> {
      try {
        // Results array to track individual operation outcomes
        const results: ItemResult[] = [];
        
        // Process each item in sequence
        for (const item of items) {
          try {
            // Remove item
            const itemResult = await removeItem(item);
            results.push({
              success: itemResult.success,
              id: itemResult.id,
              name: itemResult.name,
              error: itemResult.error
            });
          } catch (itemError: any) {
            // Handle individual item errors
            results.push({
              success: false,
              error: itemError.message || "Unknown error processing item"
            });
          }
        }
        
        // Determine overall success (true if at least one item was removed successfully)
        const overallSuccess = results.some(result => result.success);
        
        return {
          success: overallSuccess,
          results: results
        };
      } catch (error: any) {
        console.error("Error in batchRemoveItems:", error);
        return {
          success: false,
          results: [],
          error: error.message || "Unknown error in batchRemoveItems"
        };
      }
    } 
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. It states 'Remove' which implies a destructive mutation, but lacks details on permissions, reversibility, confirmation prompts, or error handling for partial failures. For a batch deletion tool with no annotation coverage, this is a significant gap in behavioral disclosure.

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

Conciseness5/5

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

The description is a single, efficient sentence that front-loads the core action and resource. Every word earns its place with no redundancy or fluff, making it highly concise and well-structured for quick comprehension.

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?

Given the tool's complexity (batch destructive operation) and lack of annotations and output schema, the description is insufficient. It doesn't cover critical aspects like return values, error conditions, or side effects. For a mutation tool with no structured safety hints, more completeness is needed to guide safe agent usage.

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 the schema fully documents the 'items' parameter and its nested properties (id, itemType, name). The description adds no additional parameter semantics beyond implying batch processing. With high schema coverage, the baseline is 3, as the description doesn't compensate but doesn't need to heavily.

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

Purpose4/5

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

The description clearly states the action ('Remove multiple tasks or projects') and resource ('from OmniFocus') with the scope of 'in a single operation'. It distinguishes from the sibling 'remove_item' by emphasizing batch capability, though it doesn't explicitly name that sibling. The purpose is specific but could be more precise about differentiation.

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 like 'remove_item' or other deletion methods. It mentions batch removal but doesn't specify scenarios (e.g., efficiency for bulk cleanup) or prerequisites. Without explicit when/when-not instructions, usage context is implied at best.

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

Install Server

Other Tools

Related Tools

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/jqlts1/omnifocus-mcp-enhanced'

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