Skip to main content
Glama
danjdewhurst

Todo Markdown MCP Server

by danjdewhurst

add_todo

Create a new todo item by adding text to a markdown-based todo list managed through an MCP server.

Instructions

Add a new todo item

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYesThe todo item text

Implementation Reference

  • Core handler function that implements the logic for adding a new todo item: generates ID, appends to list, formats markdown, and writes to file with error handling for permissions.
    async addTodo(request: AddTodoRequest): Promise<TodoItem> {
      const todos = (await this.listTodos()).todos;
    
      const newTodo: TodoItem = {
        id: randomUUID(),
        text: request.text.trim(),
        completed: false,
        createdAt: new Date(),
      };
    
      todos.push(newTodo);
    
      const markdown = this.formatTodoMarkdown(todos);
    
      try {
        await writeFile(this.todoFilePath, markdown, 'utf-8');
      } catch (error) {
        if (error instanceof Error && error.message.includes('EACCES')) {
          throw new Error(
            `Permission denied: Cannot write to ${this.todoFilePath}. Check file permissions or set TODO_FILE_PATH environment variable to a writable location.`
          );
        } else if (error instanceof Error && error.message.includes('EROFS')) {
          throw new Error(
            `Read-only file system: Cannot write to ${this.todoFilePath}. Set TODO_FILE_PATH environment variable to a writable location.`
          );
        }
        throw error;
      }
    
      return newTodo;
    }
  • src/index.ts:49-63 (registration)
    Tool registration in ListToolsRequestHandler, defining name, description, and JSON input schema for 'add_todo'.
    {
      name: 'add_todo',
      description: 'Add a new todo item',
      inputSchema: {
        type: 'object',
        properties: {
          text: {
            type: 'string',
            description: 'The todo item text',
          },
        },
        required: ['text'],
        additionalProperties: false,
      },
    },
  • MCP CallToolRequest dispatch handler for 'add_todo': validates input, calls todoManager.addTodo, and formats success response.
    case 'add_todo': {
      const args = request.params.arguments as unknown as AddTodoRequest;
      if (!args?.text || typeof args.text !== 'string') {
        throw new Error('Text is required and must be a string');
      }
    
      const todo = await this.todoManager.addTodo(args);
      return {
        content: [
          {
            type: 'text',
            text: `Todo added successfully: ${JSON.stringify(todo, null, 2)}`,
          },
        ],
      };
    }
  • TypeScript interface used for type-checking the AddTodoRequest parameters in handlers.
    export interface AddTodoRequest {
      text: string;
    }
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. 'Add a new todo item' implies a write operation, but it doesn't specify whether this requires authentication, what happens on success (e.g., returns an ID), error conditions, or side effects like notifications. For a mutation tool with zero annotation coverage, this leaves significant gaps in understanding its behavior and safety profile.

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 directly states the tool's purpose without any unnecessary words. It's front-loaded with the core action and resource, making it easy to parse quickly. Every word earns its place, and there's no redundancy or fluff, which is ideal for conciseness in a tool definition.

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 complexity of a mutation tool (adding data) with no annotations and no output schema, the description is insufficiently complete. It doesn't explain what the tool returns upon success, error handling, or how it integrates with sibling tools like 'list_todos'. For a tool that likely modifies state, more context on behavior and outcomes is needed to be fully actionable for an AI agent.

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 input schema has 100% description coverage, with the 'text' parameter clearly documented as 'The todo item text'. The description doesn't add any additional meaning beyond what the schema provides, such as examples or constraints on text length. Since the schema does the heavy lifting, the baseline score of 3 is appropriate, as the description neither compensates for gaps nor enhances the existing documentation.

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') and resource ('a new todo item'), making the purpose immediately understandable. It distinguishes this from sibling tools like 'delete_todo' or 'update_todo' by focusing on creation rather than modification or deletion. However, it doesn't specify what system or context the todo is being added to, which prevents a perfect score.

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_todo' for modifying existing todos. It doesn't mention prerequisites, such as whether a user must be authenticated or if there are limits on how many todos can be added. The presence of sibling tools like 'clear_completed' suggests a broader todo management context, but the description fails to clarify relationships or usage scenarios.

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