Skip to main content
Glama
anortham

COA Goldfish MCP

by anortham

update_todo

Modify or add tasks in TODO lists on the COA Goldfish MCP server. Update statuses, priorities, or delete items to manage task progress efficiently. Supports integrating with AI agents and auto-expiring memories.

Instructions

Update task status or add new tasks to existing lists. Mark tasks done as you work.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deleteNoDelete the specified item (requires itemId)
itemIdNoItem ID to update (optional for adding new items)
listIdNoTODO list ID
newTaskNoNew task to add to the list (when not updating existing item)
priorityNoPriority level
statusNoNew status for the item

Implementation Reference

  • Main handler function executing the update_todo tool logic: validates args, resolves todo lists, handles status updates, new tasks, deletions, mark all complete, cleanup old lists, with comprehensive error handling and responses.
    export async function handleUpdateTodo(storage: Storage, args: UpdateTodoArgs): Promise<ToolResponse> {
      // Validate input
      const validation = validateCommonArgs(args);
      if (!validation.isValid) {
        return createErrorResponse(validation.error!, 'update_todo', args.format || 'emoji');
      }
    
      const { listId, itemId, status, newTask, priority, delete: deleteItem, workspace, markAllComplete, cleanupOldLists } = args;
    
      // Load TODO lists - if workspace specified, search across workspaces, otherwise current only
      const todoLists = workspace ? 
        await loadTodoListsWithScope(storage, 'all') : 
        await storage.loadAllTodoLists();
      
      // Handle cleanup of old/legacy lists
      if (cleanupOldLists) {
        let cleanedCount = 0;
        const thirtyDaysAgo = new Date(Date.now() - 30 * 24 * 60 * 60 * 1000);
        
        for (const list of todoLists) {
          // Auto-complete lists that:
          // 1. Have all items marked as 'done'
          // 2. Don't have explicit status (legacy lists) OR are older than 30 days
          // 3. Are not already marked as completed
          const allItemsDone = list.items.length > 0 && list.items.every(item => item.status === 'done');
          const isOldOrLegacy = !list.status || new Date(list.updatedAt) < thirtyDaysAgo;
          const notAlreadyCompleted = list.status !== 'completed';
          
          if (allItemsDone && isOldOrLegacy && notAlreadyCompleted) {
            list.status = 'completed';
            list.completedAt = new Date();
            list.updatedAt = new Date();
            await storage.saveTodoList(list);
            cleanedCount++;
          }
        }
        
        return createSuccessResponse(
          `๐Ÿงน Cleaned up ${cleanedCount} old TODO lists that had all tasks completed`,
          'update-todo',
          { cleanedCount },
          args.format || 'emoji'
        );
      }
      
      // Use the new resolver that handles "latest" and other special keywords
      const todoList = resolveSpecialTodoListId(listId, todoLists);
      
      if (!todoList) {
        if (listId) {
          // Provide helpful error message for special keywords
          const isSpecialKeyword = ['latest', 'recent', 'last', 'active', 'current'].includes(listId.toLowerCase().trim());
          if (isSpecialKeyword) {
            return createErrorResponse(`โ“ No ${listId} TODO list found. Create one first with create_todo_list.`, 'update_todo', args.format || 'emoji');
          }
          return createErrorResponse(`โ“ TODO list "${listId}" not found`, 'update_todo', args.format || 'emoji');
        } else {
          return createErrorResponse(`โ“ No TODO lists found. Create one first with create_todo_list.`, 'update_todo', args.format || 'emoji');
        }
      }
    
      // Handle markAllComplete operation
      if (markAllComplete) {
        if (!todoList) {
          return createErrorResponse(`โ“ No TODO list found to mark complete`, 'update_todo', args.format || 'emoji');
        }
    
        // Mark all items as done
        const pendingCount = todoList.items.filter((item: TodoItem) => item.status !== 'done').length;
        
        if (pendingCount === 0) {
          return createSuccessResponse(`โœ… All tasks in "${todoList.title}" are already complete`, 'update-todo', { listId: todoList.id }, args.format || 'emoji');
        }
    
        todoList.items.forEach((item: TodoItem) => {
          if (item.status !== 'done') {
            item.status = 'done';
            item.updatedAt = new Date();
          }
        });
    
        // Mark the list itself as completed
        todoList.status = 'completed';
        todoList.completedAt = new Date();
        todoList.updatedAt = new Date();
        
        await storage.saveTodoList(todoList);
    
        return createSuccessResponse(
          `๐ŸŽ‰ Marked all ${pendingCount} pending task${pendingCount !== 1 ? 's' : ''} as complete in "${todoList.title}"\n` +
          `โœ… TodoList "${todoList.title}" marked as completed`,
          'update-todo',
          { listId: todoList.id, pendingCount },
          args.format || 'emoji'
        );
      }
    
      if (itemId) {
        // Find the item first
        const item = todoList.items.find((i: TodoItem) => i.id === itemId);
        
        if (!item) {
          return createErrorResponse(`โ“ Task ${itemId} not found in list "${todoList.title}"`, 'update_todo', args.format || 'emoji');
        }
    
        // Handle delete operation
        if (deleteItem) {
          const taskText = truncateText(item.task, 40);
          todoList.items = todoList.items.filter((i: TodoItem) => i.id !== itemId);
          todoList.updatedAt = new Date();
          await storage.saveTodoList(todoList);
    
          return createSuccessResponse(`๐Ÿ—‘๏ธ Deleted [${itemId}] ${taskText}`, 'update-todo', { listId: todoList.id, itemId }, args.format || 'emoji');
        }
    
        const oldStatus = item.status;
        const oldTask = item.task;
        
        // Update task description if provided
        if (newTask) {
          item.task = newTask;
        }
        
        // Update status if provided
        if (status) {
          item.status = status;
        }
        
        item.updatedAt = new Date();
        
        if (priority) {
          item.priority = priority;
        }
        
        todoList.updatedAt = new Date();
        
        // NEW - Auto-completion: Mark TodoList as completed if all items are done
        const allItemsDone = todoList.items.length > 0 && 
                            todoList.items.every(item => item.status === 'done');
        
        if (allItemsDone && (!todoList.status || todoList.status === 'active')) {
          todoList.status = 'completed';
          todoList.completedAt = new Date();
        }
        
        await storage.saveTodoList(todoList);
    
        const changes = [];
        if (newTask && newTask !== oldTask) changes.push(`task: "${newTask}"`);
        if (status && status !== oldStatus) changes.push(`status: ${status}`);
        if (priority) changes.push(`priority: ${priority}`);
        
        const icon = getTaskStatusIcon(item.status);
        
        let message = `${icon} Updated [${itemId}] ${changes.join(', ')}`;
        
        // NEW - Add completion notification
        if (allItemsDone && todoList.status === 'completed') {
          message += `\n๐ŸŽ‰ All tasks completed! TodoList "${todoList.title}" marked as completed.`;
        }
    
        return createSuccessResponse(message, 'update-todo', { listId: todoList.id, itemId, changes }, args.format || 'emoji');
      }
    
      if (newTask) {
        // Add new task (only if no itemId provided)
        const newItem: TodoItem = {
          id: (todoList.items.length + 1).toString(),
          task: newTask,
          status: 'pending',
          priority: priority,
          createdAt: new Date()
        };
        
        todoList.items.push(newItem);
        todoList.updatedAt = new Date();
        
        // NEW - Reopen capability: If list was completed, reopen it when adding new tasks
        const wasCompleted = todoList.status === 'completed';
        if (wasCompleted) {
          todoList.status = 'active';
          todoList.completedAt = undefined;
        }
        
        await storage.saveTodoList(todoList);
    
        let message = `โž• Added "${newTask}" to "${todoList.title}"`;
        if (wasCompleted) {
          message += `\n๐Ÿ”„ Reopened completed list - new work detected`;
        }
    
        return createSuccessResponse(message, 'update-todo', { listId: todoList.id, itemId: newItem.id, reopened: wasCompleted }, args.format || 'emoji');
      }
    
      return createErrorResponse('โ“ Please specify either newTask to add, or itemId + status to update', 'update_todo', args.format || 'emoji');
    }
  • Tool schema definition for update_todo, including name, description, and detailed inputSchema with all parameters like listId, itemId, status, newTask, priority, delete, workspace, markAllComplete, etc.
    export function getUpdateTodoToolSchema() {
      return {
        name: 'update_todo',
        description: 'Update task status immediately as you complete work. ALWAYS mark tasks done when finished, add new tasks as discovered. Use markAllComplete to bulk-complete all tasks in a list.',
        inputSchema: {
          type: 'object',
          properties: {
            listId: {
              type: 'string',
              description: 'TODO list ID'
            },
            itemId: {
              type: 'string',
              description: 'Item ID to update (optional for adding new items)'
            },
            status: {
              type: 'string',
              enum: ['pending', 'active', 'done'],
              description: 'New status for the item'
            },
            newTask: {
              type: 'string',
              description: 'New task to add to the list (when not updating existing item)'
            },
            priority: {
              type: 'string',
              enum: ['low', 'normal', 'high'],
              description: 'Priority level'
            },
            delete: {
              type: 'boolean',
              description: 'Delete the specified item (requires itemId)'
            },
            workspace: {
              type: 'string',
              description: 'Workspace name or path (e.g., "coa-goldfish-mcp" or "C:\\source\\COA Goldfish MCP"). Will be normalized automatically. If provided, searches across all workspaces.'
            },
            markAllComplete: {
              type: 'boolean',
              description: 'Mark all tasks in the TODO list as complete (requires listId)'
            },
            cleanupOldLists: {
              type: 'boolean',
              description: 'Auto-complete old TODO lists that have all tasks marked as done (works across all workspaces)'
            },
            format: {
              type: 'string',
              enum: ['plain', 'emoji', 'json', 'dual'],
              description: 'Output format override (defaults to env GOLDFISH_OUTPUT_MODE or dual)'
            }
          }
        }
      };
    }
  • TypeScript interface defining the input arguments for the update_todo handler.
    export interface UpdateTodoArgs {
      listId?: string;
      itemId?: string;
      status?: 'pending' | 'active' | 'done';
      newTask?: string;
      priority?: 'low' | 'normal' | 'high';
      delete?: boolean;
      workspace?: string;  // NEW - Optional workspace (path or name)
      markAllComplete?: boolean;  // NEW - Mark all tasks in the list as complete
      cleanupOldLists?: boolean;  // NEW - Auto-complete old lists with all tasks done
      format?: import('../core/output-utils.js').OutputMode;
    }
  • In the unified 'todo' tool, the 'update' action maps arguments and delegates to handleUpdateTodo from update-todo.ts
    case 'update':
      // Map TodoArgs to UpdateTodoArgs
      const updateArgs: UpdateTodoArgs = {
        listId: args.listId,
        itemId: args.itemId,
        status: args.status as 'pending' | 'active' | 'done',
        newTask: args.newTask,
        priority: args.priority,
        delete: args.delete,
        workspace: args.workspace,
        markAllComplete: args.markAllComplete,
        cleanupOldLists: args.cleanupOldLists,
        format: args.format
      };
      return handleUpdateTodo(storage, updateArgs);
  • Note in index.ts indicating that update_todo has been replaced by the unified 'todo' tool in registration.
    // Unified TODO tool (replaces create_todo_list, view_todos, update_todo)
    getTodoToolSchema(),
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 mentions 'mark tasks done' which implies mutation, but doesn't address permissions, whether changes are reversible, error conditions, or what happens when multiple parameters conflict. The description lacks crucial behavioral context for a mutation tool with multiple parameters.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately concise with two sentences that get straight to the point. The first sentence states the core functionality, and the second provides a usage suggestion. There's no wasted language, though it could be slightly more structured with clearer separation of update vs. add operations.

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?

For a mutation tool with 6 parameters, no annotations, and no output schema, the description is incomplete. It doesn't explain the relationship between parameters (e.g., when to use 'newTask' vs. 'status'), doesn't mention the 'delete' parameter at all, and provides no information about return values or error conditions. The description should do more given the tool's complexity.

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?

Schema description coverage is 100%, so the schema already documents all 6 parameters thoroughly. The description mentions 'task status' and 'new tasks' which loosely map to 'status' and 'newTask' parameters, but adds minimal semantic value beyond what's already in the schema. The baseline of 3 is appropriate when the schema does the heavy lifting.

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 tool's purpose with specific verbs ('update task status', 'add new tasks') and resources ('existing lists'), making it easy to understand what the tool does. However, it doesn't explicitly distinguish this tool from sibling tools like 'create_todo_list' or 'view_todos', which would require more specific differentiation.

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 minimal usage guidance with the phrase 'as you work' suggesting context, but offers no explicit when-to-use rules, no when-not-to-use warnings, and no alternatives among sibling tools. For example, it doesn't clarify when to use this versus 'create_todo_list' for adding tasks or 'view_todos' for checking status.

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

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/anortham/coa-goldfish-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server