Skip to main content
Glama
guifelix

MCP Todo.txt Integration

add-metadata

Attach custom key-value metadata to specific tasks in Todo.txt files to enhance organization and filtering capabilities.

Instructions

Add custom metadata (key-value pairs) to a task by ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
taskIdYes
metadataYes

Implementation Reference

  • The main handler function for the 'add-metadata' tool. It loads tasks, validates the task ID using getTaskIndex, adds metadata as extensions to the task, saves the tasks, and returns success or error.
    async ({ taskId, metadata }) => {
        const tasks = await loadTasks();
        const idx = getTaskIndex(taskId, tasks);
        if (idx === null) {
            return {
                content: [
                    { type: "text", text: "Invalid task ID." },
                ],
                isError: true,
            };
        }
        Object.entries(metadata).forEach(([key, value]) => {
            tasks[idx].setExtension(key as string, value as string);
        });
        await saveTasks(tasks);
        return {
            content: [
                { type: "text", text: "Metadata added successfully." },
            ],
        };
  • Input schema definition using Zod: taskId as number, metadata as a record of string keys to string values.
    {
        taskId: z.number(),
        metadata: z.record(z.string()),
    },
  • src/tools.ts:221-249 (registration)
    Registration of the 'add-metadata' tool on the McpServer instance within the registerTools function.
    server.tool(
        "add-metadata",
        "Add custom metadata (key-value pairs) to a task by ID.",
        {
            taskId: z.number(),
            metadata: z.record(z.string()),
        },
        async ({ taskId, metadata }) => {
            const tasks = await loadTasks();
            const idx = getTaskIndex(taskId, tasks);
            if (idx === null) {
                return {
                    content: [
                        { type: "text", text: "Invalid task ID." },
                    ],
                    isError: true,
                };
            }
            Object.entries(metadata).forEach(([key, value]) => {
                tasks[idx].setExtension(key as string, value as string);
            });
            await saveTasks(tasks);
            return {
                content: [
                    { type: "text", text: "Metadata added successfully." },
                ],
            };
        }
    );
  • Helper function used by the handler to convert 1-based taskId to 0-based array index and validate bounds.
    function getTaskIndex(taskId: number, tasks: Item[]): number | null {
        const idx = taskId - 1;
        if (idx < 0 || idx >= tasks.length) return null;
        return idx;
  • Helper function used by the handler to persist the updated tasks to the TODO file.
    async function saveTasks(tasks: Item[]) {
        const content = tasks.map((task) => task.toString()).join("\n");
        await fs.writeFile(TODO_FILE_PATH, content, "utf-8");
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 states this is an 'add' operation (implying mutation) but doesn't disclose permission requirements, whether metadata overwrites existing keys, rate limits, error conditions, or what happens on success. For a mutation tool with zero annotation coverage, this leaves significant behavioral gaps.

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 with zero wasted words. It's appropriately sized for a simple tool and front-loads the essential information (action and target). Every word earns its place.

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 mutation tool with 2 parameters, 0% schema coverage, no annotations, and no output schema, the description is inadequate. It doesn't explain what happens after metadata addition, error handling, or provide enough context for safe and effective use. The description should do more given the complexity and lack of structured documentation.

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?

With 0% schema description coverage, the description adds some value by clarifying that 'metadata' refers to 'custom metadata (key-value pairs)' and 'taskId' identifies the target task. However, it doesn't explain parameter formats, constraints, or provide examples. The baseline is 3 since the description adds meaningful context beyond the bare schema but doesn't fully compensate for the coverage gap.

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 ('Add custom metadata') and target resource ('to a task by ID'), providing a specific verb+resource combination. It distinguishes from siblings like 'remove-metadata' by specifying addition rather than removal, but doesn't explicitly differentiate from other metadata-related tools if they existed.

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 'update-task' or 'remove-metadata'. It doesn't mention prerequisites, constraints, or appropriate contexts for metadata addition versus other task modification operations.

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