Skip to main content
Glama
danjdewhurst

Todo Markdown MCP Server

by danjdewhurst

list_todos

Retrieve all todo items from a markdown file for viewing and management within AI assistant workflows.

Instructions

List all todos from the markdown file

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core handler function that lists todos by checking if the todo file exists, reading and parsing its markdown content, calculating statistics (total, completed, pending), and returning a ListTodosResponse.
    async listTodos(): Promise<ListTodosResponse> {
      if (!(await this.fileExists())) {
        return {
          todos: [],
          total: 0,
          completed: 0,
          pending: 0,
        };
      }
    
      const content = await readFile(this.todoFilePath, 'utf-8');
      const todos = this.parseTodoMarkdown(content);
    
      const completed = todos.filter((todo) => todo.completed).length;
      const pending = todos.length - completed;
    
      return {
        todos,
        total: todos.length,
        completed,
        pending,
      };
    }
  • MCP CallToolRequest handler case for 'list_todos' that delegates to todoManager.listTodos() and returns the result as JSON-formatted text content.
    case 'list_todos': {
      const result = await this.todoManager.listTodos();
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • src/index.ts:40-48 (registration)
    Tool registration in ListToolsRequest handler, defining the 'list_todos' tool name, description, and empty input schema (no parameters required).
    {
      name: 'list_todos',
      description: 'List all todos from the markdown file',
      inputSchema: {
        type: 'object',
        properties: {},
        additionalProperties: false,
      },
    },
  • TypeScript interface defining the structure of the response returned by the list_todos tool.
    export interface ListTodosResponse {
      todos: TodoItem[];
      total: number;
      completed: number;
      pending: number;
    }
  • Helper function to parse TodoItem objects from markdown file content by matching checkbox lines and extracting ID comments.
    private parseTodoMarkdown(content: string): TodoItem[] {
      const lines = content.split('\n');
      const todos: TodoItem[] = [];
    
      for (const line of lines) {
        const trimmed = line.trim();
    
        // Match markdown checkbox format: - [ ] text or - [x] text
        const checkboxMatch = trimmed.match(/^-\s*\[([x\s])\]\s*(.+)$/i);
        if (checkboxMatch) {
          const [, checkbox, text] = checkboxMatch;
          if (!checkbox || !text) continue;
    
          const completed = checkbox.toLowerCase() === 'x';
    
          // Extract ID from text if it exists (format: text <!-- id:uuid -->)
          const idMatch = text.match(/^(.*?)\s*<!--\s*id:([a-f0-9-]+)\s*-->$/);
          let todoText: string;
          let id: string;
    
          if (idMatch) {
            todoText = idMatch[1]?.trim() || '';
            id = idMatch[2] || randomUUID();
          } else {
            todoText = text.trim();
            id = randomUUID();
          }
    
          todos.push({
            id,
            text: todoText,
            completed,
            createdAt: new Date(),
            ...(completed && { completedAt: new Date() }),
          });
        }
      }
    
      return todos;
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states it 'List all todos' but doesn't specify if this is a safe read operation, how it handles errors (e.g., if the file is missing), or what the output format might be (e.g., structured list vs. raw text). This leaves significant gaps for an agent to understand the tool's behavior.

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, clear sentence that directly states the tool's function with zero waste. It's front-loaded and appropriately sized for a simple tool, earning full marks for conciseness and structure.

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 simplicity (0 parameters, no output schema, no annotations), the description is adequate but has clear gaps. It covers the basic purpose but lacks behavioral details (e.g., error handling, output format) and usage context, which are important for completeness even in simple cases.

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 tool has 0 parameters, and schema description coverage is 100%, so no parameter documentation is needed. The description appropriately doesn't discuss parameters, making it efficient and focused on the tool's purpose without unnecessary details.

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 ('List') and resource ('all todos from the markdown file'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'clear_completed' or 'update_todo', which would require mentioning it's a read-only operation versus those mutation tools.

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., if a markdown file must exist), exclusions, or comparisons to siblings like 'add_todo' for creating todos or 'delete_todo' for removal, leaving usage context 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

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/danjdewhurst/todo-md-mcp'

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