Skip to main content
Glama
guifelix

MCP Todo.txt Integration

update-task

Modify existing tasks in Todo.txt files by updating descriptions, priorities, contexts, projects, or metadata using task IDs.

Instructions

Update a task's fields (description, priority, contexts, projects, metadata) by ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
taskIdYes
updatesYes

Implementation Reference

  • Executes the update-task tool: loads tasks, validates task ID, updates description, priority, replaces contexts and projects, sets extensions, saves, and returns success or error.
    async ({ taskId, updates }) => {
        const tasks = await loadTasks();
        const idx = getTaskIndex(taskId, tasks);
        if (idx === null) {
            return {
                content: [
                    { type: "text", text: "Invalid task ID." },
                ],
                isError: true,
            };
        }
        const task = tasks[idx];
        if (updates.description) task.setBody(updates.description);
        if (updates.priority) task.setPriority(updates.priority);
        if (updates.contexts) {
            task.contexts().forEach((context: string) => task.removeContext(context));
            updates.contexts.forEach((context: string) => task.addContext(context));
        }
        if (updates.projects) {
            task.projects().forEach((project: string) => task.removeProject(project));
            updates.projects.forEach((project: string) => task.addProject(project));
        }
        if (updates.extensions) {
            Object.entries(updates.extensions).forEach(([key, value]) => task.setExtension(key as string, value as string));
        }
        await saveTasks(tasks);
        return {
            content: [
                { type: "text", text: "Task updated successfully." },
            ],
        };
    }
  • Zod input schema defining parameters for update-task: required taskId (number), optional updates object with description, priority, contexts array, projects array, extensions record.
    {
        taskId: z.number(),
        updates: z.object({
            description: z.string().optional(),
            priority: z.string().optional(),
            contexts: z.array(z.string()).optional(),
            projects: z.array(z.string()).optional(),
            extensions: z.record(z.string(), z.string()).optional(),
        }),
    },
  • src/tools.ts:368-413 (registration)
    Registers the 'update-task' tool on the MCP server with name, description, input schema, and handler function.
    server.tool(
        "update-task",
        "Update a task's fields (description, priority, contexts, projects, metadata) by ID.",
        {
            taskId: z.number(),
            updates: z.object({
                description: z.string().optional(),
                priority: z.string().optional(),
                contexts: z.array(z.string()).optional(),
                projects: z.array(z.string()).optional(),
                extensions: z.record(z.string(), z.string()).optional(),
            }),
        },
        async ({ taskId, updates }) => {
            const tasks = await loadTasks();
            const idx = getTaskIndex(taskId, tasks);
            if (idx === null) {
                return {
                    content: [
                        { type: "text", text: "Invalid task ID." },
                    ],
                    isError: true,
                };
            }
            const task = tasks[idx];
            if (updates.description) task.setBody(updates.description);
            if (updates.priority) task.setPriority(updates.priority);
            if (updates.contexts) {
                task.contexts().forEach((context: string) => task.removeContext(context));
                updates.contexts.forEach((context: string) => task.addContext(context));
            }
            if (updates.projects) {
                task.projects().forEach((project: string) => task.removeProject(project));
                updates.projects.forEach((project: string) => task.addProject(project));
            }
            if (updates.extensions) {
                Object.entries(updates.extensions).forEach(([key, value]) => task.setExtension(key as string, value as string));
            }
            await saveTasks(tasks);
            return {
                content: [
                    { type: "text", text: "Task updated successfully." },
                ],
            };
        }
    );
  • Helper utility used by update-task (and others) to map 1-based taskId to 0-based array index, returns null if invalid.
    function getTaskIndex(taskId: number, tasks: Item[]): number | null {
        const idx = taskId - 1;
        if (idx < 0 || idx >= tasks.length) return null;
        return idx;
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states this is an update operation, implying mutation, but doesn't cover critical aspects like required permissions, whether changes are reversible, error handling (e.g., invalid taskId), or response format. For a mutation tool with zero annotation coverage, this leaves significant gaps in understanding how it behaves.

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 ('Update a task's fields') and specifies key details without waste. Every word contributes to understanding the tool's purpose and scope, making it appropriately sized and well-structured.

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 (mutation with nested objects), lack of annotations, and no output schema, the description is incomplete. It covers the basic purpose and fields but misses behavioral details (e.g., side effects, error cases), parameter semantics (e.g., valid values), and output information. For a tool that modifies data, this leaves too much undefined for reliable agent use.

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?

The description lists the updatable fields (description, priority, contexts, projects, metadata), which maps to the nested 'updates' object properties in the schema. With 0% schema description coverage, the schema provides no parameter details, so the description adds meaningful context about what can be updated. However, it doesn't explain parameter formats (e.g., what 'priority' values are valid) or the 'taskId' requirement, leaving some ambiguity.

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 ('Update') and resource ('a task's fields'), specifying the updatable fields (description, priority, contexts, projects, metadata) and identifier (by ID). It distinguishes from siblings like 'add-task' or 'complete-task' by focusing on field updates rather than creation or status changes. However, it doesn't explicitly differentiate from 'add-metadata' or 'remove-metadata' for metadata operations.

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 (e.g., needing an existing task ID), exclusions (e.g., not for creating new tasks), or comparisons to siblings like 'add-metadata' for metadata-only updates or 'batch-operations' for multiple tasks. Usage is implied by the action but lacks explicit context.

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