Skip to main content
Glama
danjdewhurst

Todo Markdown MCP Server

by danjdewhurst

add_todo

Add a new todo item to a markdown file. The tool accepts the todo text as input, enabling AI assistants to manage task lists efficiently.

Instructions

Add a new todo item

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYesThe todo item text

Implementation Reference

  • Core implementation of the add_todo tool: loads existing todos from markdown file, creates a new TodoItem with generated UUID, appends it, reformats and writes back 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; }
  • TypeScript interface defining the input schema for the add_todo tool: requires a 'text' string.
    export interface AddTodoRequest { text: string; }
  • src/index.ts:49-62 (registration)
    Tool registration in the ListTools response: defines name 'add_todo', description, and inputSchema matching AddTodoRequest.
    { 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 dispatcher case for 'add_todo': performs basic validation and delegates to TodoManager.addTodo, 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)}`, }, ], }; }

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