Skip to main content
Glama
danjdewhurst

Todo Markdown MCP Server

by danjdewhurst

clear_completed

Remove all completed tasks from a markdown-based todo list, streamlining your task management and keeping the list focused on active items.

Instructions

Remove all completed todo items

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function that implements the clear_completed tool logic. It loads todos, filters out completed ones, rewrites the markdown file with remaining todos, handles file write errors, and returns the count of cleared items.
    async clearCompleted(): Promise<number> { const todos = (await this.listTodos()).todos; const completedCount = todos.filter((todo) => todo.completed).length; const remainingTodos = todos.filter((todo) => !todo.completed); const markdown = this.formatTodoMarkdown(remainingTodos); 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 completedCount; }
  • Tool schema definition for 'clear_completed', including name, description, and empty input schema (no parameters required).
    { name: 'clear_completed', description: 'Remove all completed todo items', inputSchema: { type: 'object', properties: {}, additionalProperties: false, }, },
  • src/index.ts:182-192 (registration)
    Registration and dispatch handler for the 'clear_completed' tool in the CallToolRequestSchema switch statement. It invokes the todoManager.clearCompleted() method and formats the response.
    case 'clear_completed': { const count = await this.todoManager.clearCompleted(); return { content: [ { type: 'text', text: `Cleared ${count} completed todo(s)`, }, ], }; }

Other Tools

Related 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