Skip to main content
Glama
guifelix

MCP Todo.txt Integration

sort-tasks

Organize tasks in Todo.txt files by priority, creation date, or completion date to improve task management workflow.

Instructions

Sort tasks by priority, creation date, or completion date.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
byYes

Implementation Reference

  • src/tools.ts:165-189 (registration)
    Registration of the 'sort-tasks' tool, including description, input schema, and inline handler function.
    server.tool(
        "sort-tasks",
        "Sort tasks by priority, creation date, or completion date.",
        { by: z.enum(["priority", "creationDate", "completionDate"]) },
        async ({ by }) => {
            const tasks = await loadTasks();
            let sortedTasks = tasks.slice();
            switch (by) {
                case "priority":
                    sortedTasks = sortedTasks.sort((a, b) => (a.priority() || "").localeCompare(b.priority() || ""));
                    break;
                case "creationDate":
                    sortedTasks = sortedTasks.sort((a, b) => new Date(a.created()?.toISOString() || 0).getTime() - new Date(b.created()?.toISOString() || 0).getTime());
                    break;
                case "completionDate":
                    sortedTasks = sortedTasks.sort((a, b) => new Date(a.completed()?.toISOString() || 0).getTime() - new Date(b.completed()?.toISOString() || 0).getTime());
                    break;
            }
            return {
                content: [
                    { type: "text", text: sortedTasks.map(task => task.toString()).join("\n") },
                ],
            };
        }
    );
  • The handler function that implements the sorting logic for tasks based on priority, creation date, or completion date.
    async ({ by }) => {
        const tasks = await loadTasks();
        let sortedTasks = tasks.slice();
        switch (by) {
            case "priority":
                sortedTasks = sortedTasks.sort((a, b) => (a.priority() || "").localeCompare(b.priority() || ""));
                break;
            case "creationDate":
                sortedTasks = sortedTasks.sort((a, b) => new Date(a.created()?.toISOString() || 0).getTime() - new Date(b.created()?.toISOString() || 0).getTime());
                break;
            case "completionDate":
                sortedTasks = sortedTasks.sort((a, b) => new Date(a.completed()?.toISOString() || 0).getTime() - new Date(b.completed()?.toISOString() || 0).getTime());
                break;
        }
        return {
            content: [
                { type: "text", text: sortedTasks.map(task => task.toString()).join("\n") },
            ],
        };
    }
  • Input schema defining the 'by' parameter as an enum for sorting criteria.
    { by: z.enum(["priority", "creationDate", "completionDate"]) },
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. It states the sorting action but doesn't disclose behavioral traits such as whether this modifies tasks in-place, returns a sorted list, requires specific permissions, has side effects, or handles errors. For a tool with zero annotation coverage, this is a significant gap.

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 waste. It's front-loaded with the core purpose and lists the sorting options clearly, making it easy to parse and understand quickly.

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

Completeness3/5

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

Given the tool's low complexity (1 parameter, no output schema, no annotations), the description is minimally adequate. It covers the basic purpose and parameter semantics but lacks usage guidelines and behavioral transparency, leaving gaps in how the agent should interact with it effectively.

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

Parameters4/5

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

The description adds meaningful context beyond the input schema. The schema has 1 parameter with 0% description coverage (just an enum), but the description explains that 'by' specifies sorting criteria ('priority, creation date, or completion date'), which clarifies the enum values. This compensates well for the low schema coverage.

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's purpose: 'Sort tasks by priority, creation date, or completion date.' It specifies the verb 'sort' and resource 'tasks' with the sorting criteria. However, it doesn't explicitly differentiate from sibling tools like 'filter-tasks' or 'list-tasks', which might also involve task organization.

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 siblings like 'filter-tasks', 'list-tasks', and 'search-tasks' available, there's no indication of when sorting is preferred over filtering or searching, or if this tool works in conjunction with others.

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