Skip to main content
Glama

update_tasks

Modify multiple tasks by updating descriptions, statuses, priorities, due dates, or tags in a single operation using structured input. Streamlines task management for enhanced productivity.

Instructions

Update multiple tasks with new values.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
updatesYesList of task updates to apply

Implementation Reference

  • The main handler function for the 'update_tasks' tool. It validates input using UpdateTasksSchema, iterates over updates, checks task existence and dependencies, updates via taskStorage.update, collects results, and returns JSON with success/failure counts.
    execute: async (params: any) => { try { // Validate input parameters const validatedParams = UpdateTasksSchema.parse(params); const results = []; for (const { id, ...changes } of validatedParams.updates) { try { // Verify task exists const task = taskStorage.get(id); if (!task) { results.push({ id, success: false, error: `Task with ID ${id} not found` }); continue; } // Validate dependencies if they exist if (changes.dependsOn) { const missingDependencies = changes.dependsOn.filter(depId => !taskStorage.get(depId)); if (missingDependencies.length > 0) { results.push({ id, success: false, error: `Dependencies not found: ${missingDependencies.join(', ')}` }); continue; } } // Update task const updatedTask = taskStorage.update(id, changes); results.push({ id, success: true, task: updatedTask }); } catch (error) { results.push({ id, success: false, error: `Error updating task: ${error instanceof Error ? error.message : String(error)}` }); } } return JSON.stringify({ updates: results, success: results.filter((r: any) => r.success).length, failed: results.filter((r: any) => !r.success).length }); } catch (error) { return JSON.stringify({ error: `Invalid update_tasks parameters: ${error instanceof Error ? error.message : String(error)}` }); } }
  • Zod schema definition for validating the input parameters of the update_tasks tool, defining an array of updates each with id and optional fields.
    // Schema for update_tasks parameters const UpdateTasksSchema = z.object({ updates: z.array( z.object({ id: z.string().uuid(), description: z.string().min(3, "Description must be at least 3 characters").optional(), status: TaskStatusEnum.optional(), priority: TaskPriorityEnum.optional(), due: z.string().datetime().optional(), tags: z.array(z.string()).optional(), dependsOn: z.array(z.string().uuid()).optional() }) ) });
  • The server.addTool call that registers the update_tasks tool within the registerTaskTools function.
    server.addTool({ name: "update_tasks", description: "Update multiple tasks with new values.", execute: async (params: any) => { try { // Validate input parameters const validatedParams = UpdateTasksSchema.parse(params); const results = []; for (const { id, ...changes } of validatedParams.updates) { try { // Verify task exists const task = taskStorage.get(id); if (!task) { results.push({ id, success: false, error: `Task with ID ${id} not found` }); continue; } // Validate dependencies if they exist if (changes.dependsOn) { const missingDependencies = changes.dependsOn.filter(depId => !taskStorage.get(depId)); if (missingDependencies.length > 0) { results.push({ id, success: false, error: `Dependencies not found: ${missingDependencies.join(', ')}` }); continue; } } // Update task const updatedTask = taskStorage.update(id, changes); results.push({ id, success: true, task: updatedTask }); } catch (error) { results.push({ id, success: false, error: `Error updating task: ${error instanceof Error ? error.message : String(error)}` }); } } return JSON.stringify({ updates: results, success: results.filter((r: any) => r.success).length, failed: results.filter((r: any) => !r.success).length }); } catch (error) { return JSON.stringify({ error: `Invalid update_tasks parameters: ${error instanceof Error ? error.message : String(error)}` }); } } });
  • Higher-level call to registerTaskTools from registerAllTools, which includes the update_tasks tool registration.
    registerTaskTools(server);

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/flight505/mcp-think-tank'

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