Skip to main content
Glama
danjdewhurst

Todo Markdown MCP Server

by danjdewhurst

update_todo

Modify existing todo items by updating text or marking them as completed in a markdown-based todo list.

Instructions

Update an existing todo item

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe todo item ID
textNoNew text for the todo item
completedNoWhether the todo is completed

Implementation Reference

  • The handler function for the 'update_todo' tool within the CallToolRequestSchema request handler. It validates the input arguments, calls the todoManager.updateTodo method, and formats the response.
    case 'update_todo': {
      const args = request.params
        .arguments as unknown as UpdateTodoRequest;
      if (!args?.id || typeof args.id !== 'string') {
        throw new Error('ID is required and must be a string');
      }
    
      const todo = await this.todoManager.updateTodo(args);
      return {
        content: [
          {
            type: 'text',
            text: `Todo updated successfully: ${JSON.stringify(todo, null, 2)}`,
          },
        ],
      };
    }
  • src/index.ts:64-86 (registration)
    Registration of the 'update_todo' tool in the ListToolsRequestSchema handler, including name, description, and input schema.
    {
      name: 'update_todo',
      description: 'Update an existing todo item',
      inputSchema: {
        type: 'object',
        properties: {
          id: {
            type: 'string',
            description: 'The todo item ID',
          },
          text: {
            type: 'string',
            description: 'New text for the todo item',
          },
          completed: {
            type: 'boolean',
            description: 'Whether the todo is completed',
          },
        },
        required: ['id'],
        additionalProperties: false,
      },
    },
  • The core implementation of updating a todo item in the TodoManager class. Finds the todo by ID, applies updates to text and/or completed status, regenerates the markdown file, and saves it.
    async updateTodo(request: UpdateTodoRequest): Promise<TodoItem> {
      const todos = (await this.listTodos()).todos;
      const todoIndex = todos.findIndex((todo) => todo.id === request.id);
    
      if (todoIndex === -1) {
        throw new Error(`Todo with id ${request.id} not found`);
      }
    
      const todo = todos[todoIndex]!;
    
      if (request.text !== undefined) {
        todo.text = request.text.trim();
      }
    
      if (request.completed !== undefined) {
        todo.completed = request.completed;
        if (request.completed && !todo.completedAt) {
          todo.completedAt = new Date();
        } else if (!request.completed) {
          delete todo.completedAt;
        }
      }
    
      todos[todoIndex] = todo;
    
      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 todo;
    }
  • TypeScript type definition for the UpdateTodoRequest used for type-checking the tool arguments.
    export interface UpdateTodoRequest {
      id: string;
      text?: string;
      completed?: boolean;
    }
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 'update' implies mutation but doesn't cover permissions, side effects, error handling, or response format. This leaves significant gaps for a mutation tool with zero annotation coverage.

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 appropriately sized and front-loaded, making it easy to parse quickly without unnecessary elaboration.

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 with no annotations and no output schema, the description is incomplete. It doesn't explain what happens on success or failure, how partial updates work, or any constraints beyond the basic purpose, leaving the agent with insufficient context.

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 schema description coverage is 100%, so the schema already documents all three parameters (id, text, completed) with clear descriptions. The description adds no additional meaning beyond what the schema provides, resulting in a baseline score of 3.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Update an existing todo item' clearly states the verb ('update') and resource ('todo item'), but it's vague about what specifically gets updated and doesn't differentiate from sibling tools like 'add_todo' or 'delete_todo'. It meets the basic requirement but lacks specificity.

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 'add_todo' for creation or 'delete_todo' for removal. There's no mention of prerequisites, such as needing an existing todo ID, or context for when updates are appropriate.

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