Skip to main content
Glama
guifelix

MCP Todo.txt Integration

batch-operations

Update, delete, or mark tasks as complete in bulk based on priority, context, or project criteria to manage Todo.txt files efficiently.

Instructions

Perform batch operations (update, delete, mark-complete) on tasks matching criteria.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
operationsYes

Implementation Reference

  • The handler function executes batch operations (delete, update, mark-complete) on tasks matching specified criteria. It loads tasks, applies each operation in sequence, saves changes, and returns success message.
    async ({ operations }) => {
        let tasks = await loadTasks();
        for (const operation of operations) {
            if (operation.action === "delete") {
                tasks = tasks.filter(task => {
                    if (!operation.criteria) return true;
                    return !(
                        (operation.criteria.priority && task.priority() === operation.criteria.priority) ||
                        (operation.criteria.context && task.contexts().includes(operation.criteria.context)) ||
                        (operation.criteria.project && task.projects().includes(operation.criteria.project))
                    );
                });
            } else if (operation.action === "update") {
                tasks.forEach(task => {
                    if (operation.criteria) {
                        if (
                            (operation.criteria.priority && task.priority() === operation.criteria.priority) ||
                            (operation.criteria.context && task.contexts().includes(operation.criteria.context)) ||
                            (operation.criteria.project && task.projects().includes(operation.criteria.project))
                        ) {
                            if (operation.updates) {
                                if (operation.updates.priority) {
                                    task.setPriority(operation.updates.priority);
                                }
                                if (operation.updates.addContexts) {
                                    operation.updates.addContexts.forEach((context: string) => task.addContext(context));
                                }
                                if (operation.updates.removeContexts) {
                                    operation.updates.removeContexts.forEach((context: string) => task.removeContext(context));
                                }
                                if (operation.updates.addProjects) {
                                    operation.updates.addProjects.forEach((project: string) => task.addProject(project));
                                }
                                if (operation.updates.removeProjects) {
                                    operation.updates.removeProjects.forEach((project: string) => task.removeProject(project));
                                }
                                if (operation.updates.extensions) {
                                    Object.entries(operation.updates.extensions).forEach(([key, value]) => task.setExtension(key as string, value as string));
                                }
                            }
                        }
                    }
                });
            } else if (operation.action === "mark-complete") {
                tasks.forEach(task => {
                    if (operation.criteria) {
                        if (
                            (operation.criteria.priority && task.priority() === operation.criteria.priority) ||
                            (operation.criteria.context && task.contexts().includes(operation.criteria.context)) ||
                            (operation.criteria.project && task.projects().includes(operation.criteria.project))
                        ) {
                            task.setCompleted(new Date().toISOString().split("T")[0]);
                        }
                    }
                });
            }
        }
        await saveTasks(tasks);
        return {
            content: [
                { type: "text", text: "Batch operations completed successfully." },
            ],
        };
    }
  • Zod schema for the tool's input parameters, defining an array of operations each with action type, optional criteria for matching tasks, and optional updates for 'update' actions.
    {
        operations: z.array(z.object({
            action: z.enum(["update", "delete", "mark-complete"]),
            criteria: z.object({
                priority: z.string().optional(),
                context: z.string().optional(),
                project: z.string().optional(),
            }).optional(),
            updates: z.object({
                priority: z.string().optional(),
                addContexts: z.array(z.string()).optional(),
                removeContexts: z.array(z.string()).optional(),
                addProjects: z.array(z.string()).optional(),
                removeProjects: z.array(z.string()).optional(),
                extensions: z.record(z.string(), z.string()).optional(),
            }).optional(),
        })),
    },
  • src/tools.ts:281-366 (registration)
    MCP server tool registration for 'batch-operations', including name, description, input schema, and handler function.
    server.tool(
        "batch-operations",
        "Perform batch operations (update, delete, mark-complete) on tasks matching criteria.",
        {
            operations: z.array(z.object({
                action: z.enum(["update", "delete", "mark-complete"]),
                criteria: z.object({
                    priority: z.string().optional(),
                    context: z.string().optional(),
                    project: z.string().optional(),
                }).optional(),
                updates: z.object({
                    priority: z.string().optional(),
                    addContexts: z.array(z.string()).optional(),
                    removeContexts: z.array(z.string()).optional(),
                    addProjects: z.array(z.string()).optional(),
                    removeProjects: z.array(z.string()).optional(),
                    extensions: z.record(z.string(), z.string()).optional(),
                }).optional(),
            })),
        },
        async ({ operations }) => {
            let tasks = await loadTasks();
            for (const operation of operations) {
                if (operation.action === "delete") {
                    tasks = tasks.filter(task => {
                        if (!operation.criteria) return true;
                        return !(
                            (operation.criteria.priority && task.priority() === operation.criteria.priority) ||
                            (operation.criteria.context && task.contexts().includes(operation.criteria.context)) ||
                            (operation.criteria.project && task.projects().includes(operation.criteria.project))
                        );
                    });
                } else if (operation.action === "update") {
                    tasks.forEach(task => {
                        if (operation.criteria) {
                            if (
                                (operation.criteria.priority && task.priority() === operation.criteria.priority) ||
                                (operation.criteria.context && task.contexts().includes(operation.criteria.context)) ||
                                (operation.criteria.project && task.projects().includes(operation.criteria.project))
                            ) {
                                if (operation.updates) {
                                    if (operation.updates.priority) {
                                        task.setPriority(operation.updates.priority);
                                    }
                                    if (operation.updates.addContexts) {
                                        operation.updates.addContexts.forEach((context: string) => task.addContext(context));
                                    }
                                    if (operation.updates.removeContexts) {
                                        operation.updates.removeContexts.forEach((context: string) => task.removeContext(context));
                                    }
                                    if (operation.updates.addProjects) {
                                        operation.updates.addProjects.forEach((project: string) => task.addProject(project));
                                    }
                                    if (operation.updates.removeProjects) {
                                        operation.updates.removeProjects.forEach((project: string) => task.removeProject(project));
                                    }
                                    if (operation.updates.extensions) {
                                        Object.entries(operation.updates.extensions).forEach(([key, value]) => task.setExtension(key as string, value as string));
                                    }
                                }
                            }
                        }
                    });
                } else if (operation.action === "mark-complete") {
                    tasks.forEach(task => {
                        if (operation.criteria) {
                            if (
                                (operation.criteria.priority && task.priority() === operation.criteria.priority) ||
                                (operation.criteria.context && task.contexts().includes(operation.criteria.context)) ||
                                (operation.criteria.project && task.projects().includes(operation.criteria.project))
                            ) {
                                task.setCompleted(new Date().toISOString().split("T")[0]);
                            }
                        }
                    });
                }
            }
            await saveTasks(tasks);
            return {
                content: [
                    { type: "text", text: "Batch operations completed successfully." },
                ],
            };
        }
    );
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions the actions (update, delete, mark-complete) but doesn't describe side effects, permissions needed, whether operations are atomic or reversible, error handling, or what happens to tasks matching criteria. For a mutation tool with multiple destructive actions, this is a significant gap in transparency.

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 a single, efficient sentence that front-loads the core functionality. There's no wasted verbiage or redundancy. However, it could be more structured by separating purpose from usage guidelines.

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 complex mutation tool with no annotations, no output schema, and 0% schema description coverage, the description is inadequate. It doesn't explain return values, error conditions, or behavioral nuances needed for safe invocation. The agent lacks critical context about this powerful batch operation tool.

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

Parameters2/5

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

The input schema has 0% description coverage, so the description must compensate. It mentions 'operations' and 'criteria' but provides no details about parameter structure, what criteria fields mean, or how updates work. The schema shows complex nested objects with enums and arrays, but the description adds minimal semantic value beyond the tool name.

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 tool performs batch operations (update, delete, mark-complete) on tasks matching criteria, which is a specific verb+resource combination. It distinguishes itself from single-operation siblings like update-task, delete-task, and complete-task by emphasizing batch processing. However, it doesn't explicitly contrast with filter-tasks or search-tasks which might also match criteria.

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. It doesn't mention prerequisites, when batch operations are preferable to individual operations, or any limitations compared to siblings like filter-tasks or search-tasks. The agent must infer usage from the name and description alone.

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

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/guifelix/mcp-server-todotxt'

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