UNPKG

mini-todo-list-mcp

Version:

A streamlined Model Context Protocol (MCP) server for todo management with essential CRUD operations, bulk functionality, and workflow support

77 lines (76 loc) 2.08 kB
/** * TodoService.ts - Mini Version * * Core business logic for managing todos with only essential methods. * Includes: CRUD operations, bulk add, bulk clear, and get next todo. */ import { Todo, CreateTodoSchema, UpdateTodoSchema, BulkAddTodosSchema } from '../models/Todo.js'; import { z } from 'zod'; /** * TodoService Class - Mini Version * Only includes essential methods for the mini MCP server */ declare class TodoService { /** * Create a new todo */ createTodo(data: z.infer<typeof CreateTodoSchema>, passedFilePath?: string, taskNumber?: number): Todo; /** * Get a todo by ID */ getTodo(id: number): Todo | undefined; /** * Update a todo */ updateTodo(data: z.infer<typeof UpdateTodoSchema>): Todo | undefined; /** * Mark a todo as completed */ completeTodo(id: number): Todo | undefined; /** * Delete a todo */ deleteTodo(id: number): boolean; /** * Get next todo that is not marked as 'Done' */ getNextTodo(): Todo | undefined; /** * Get next todo number only */ getNextTodoNumber(): number | null; /** * Get next todo ID and task number */ getNextTodoId(): { id: number; taskNumber: number; } | null; /** * Bulk add todos by reading file contents directly (optimized with parallel processing) */ bulkAddTodos(data: z.infer<typeof BulkAddTodosSchema>): Promise<Todo[]>; /** * Clear all todos from the database */ clearAllTodos(): number; /** * Helper to convert a database row to a Todo object */ private rowToTodo; /** * Validate file paths for duplicate detection */ private validateFilePaths; /** * Recursively get all files in a directory */ private getAllFilesRecursively; /** * Natural/alphanumeric sorting function that handles numbers correctly * Ensures task_01.2 comes before task_01.12 */ private naturalSort; } export declare const todoService: TodoService; export {};