Skip to main content
Glama

task_batch_update

Idempotent

Update multiple tasks simultaneously to change status, priority, or assignee in bulk within the Saga MCP project tracker.

Instructions

Update multiple tasks at once. Useful for changing status of several tasks (e.g., mark 3 tasks as done) or reassigning tasks.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idsYesTask IDs to update
statusNo
priorityNo
assigned_toNo

Implementation Reference

  • The handler function 'handleTaskBatchUpdate' implements the tool logic by updating multiple task records in a transaction, logging activity, and handling side effects.
    function handleTaskBatchUpdate(args: Record<string, unknown>) {
      const db = getDb();
      const ids = args.ids as number[];
      const status = args.status as string | undefined;
      const priority = args.priority as string | undefined;
      const assignedTo = args.assigned_to as string | undefined;
    
      if (!status && !priority && assignedTo === undefined) {
        throw new Error('Provide at least one field to update: status, priority, or assigned_to');
      }
    
      const getStmt = db.prepare('SELECT * FROM tasks WHERE id = ?');
    
      const results = db.transaction(() => {
        return ids.map((id) => {
          const oldRow = getStmt.get(id) as Record<string, unknown> | undefined;
          if (!oldRow) throw new Error(`Task ${id} not found`);
    
          const updates: string[] = [];
          const params: unknown[] = [];
    
          if (status) {
            updates.push('status = ?');
            params.push(status);
          }
          if (priority) {
            updates.push('priority = ?');
            params.push(priority);
          }
          if (assignedTo !== undefined) {
            updates.push('assigned_to = ?');
            params.push(assignedTo);
          }
    
          updates.push("updated_at = datetime('now')");
          params.push(id);
    
          const newRow = db
            .prepare(`UPDATE tasks SET ${updates.join(', ')} WHERE id = ? RETURNING *`)
            .get(...params) as Record<string, unknown>;
    
          // Log status changes
          if (status && oldRow.status !== status) {
            logActivity(
              db, 'task', id, 'status_changed', 'status',
              oldRow.status as string, status,
              `Task '${newRow.title}' status: ${oldRow.status} -> ${status}`
            );
          }
          if (priority && oldRow.priority !== priority) {
            logActivity(
              db, 'task', id, 'updated', 'priority',
              oldRow.priority as string, priority,
              `Task '${newRow.title}' priority: ${oldRow.priority} -> ${priority}`
            );
          }
    
          // Auto time tracking
          if (status === 'done' && oldRow.status !== 'done' && !newRow.actual_hours) {
            const startEntry = db.prepare(
              `SELECT created_at FROM activity_log
               WHERE entity_type = 'task' AND entity_id = ? AND action = 'status_changed'
                 AND field_name = 'status' AND new_value = 'in_progress'
               ORDER BY created_at DESC LIMIT 1`
            ).get(id) as { created_at: string } | undefined;
    
            if (startEntry) {
              const startMs = new Date(startEntry.created_at + 'Z').getTime();
              const nowMs = Date.now();
              const hours = Math.round(((nowMs - startMs) / 3_600_000) * 10) / 10;
              if (hours > 0) {
                db.prepare('UPDATE tasks SET actual_hours = ? WHERE id = ?').run(hours, id);
                newRow.actual_hours = hours;
                logActivity(db, 'task', id, 'updated', 'actual_hours', null, String(hours),
                  `Task '${newRow.title}' auto-tracked: ${hours}h`);
              }
            }
          }
    
          // Re-evaluate downstream dependencies when task marked done
          if (status === 'done' && oldRow.status !== 'done') {
            reevaluateDownstream(db, id);
          }
    
          return newRow;
        });
      })();
    
      return { updated: results.length, tasks: results };
    }
  • The schema definition for 'task_batch_update', including description and input validation constraints.
    {
      name: 'task_batch_update',
      description:
        'Update multiple tasks at once. Useful for changing status of several tasks (e.g., mark 3 tasks as done) or reassigning tasks.',
      annotations: { title: 'Batch Update Tasks', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
      inputSchema: {
        type: 'object',
        properties: {
          ids: {
            type: 'array',
            items: { type: 'integer' },
            description: 'Task IDs to update',
          },
          status: { type: 'string', enum: ['todo', 'in_progress', 'review', 'done', 'blocked'] },
          priority: { type: 'string', enum: ['low', 'medium', 'high', 'critical'] },
          assigned_to: { type: 'string' },
        },
        required: ['ids'],
      },
    },
  • The tool registration within the 'handlers' dictionary, mapping 'task_batch_update' to 'handleTaskBatchUpdate'.
    export const handlers: Record<string, ToolHandler> = {
      activity_log: handleActivityLog,
      tracker_session_diff: handleSessionDiff,
      task_batch_update: handleTaskBatchUpdate,
    };
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description adds useful context about batch operations and common use cases beyond what annotations provide. Annotations already cover key behavioral traits (readOnlyHint=false, destructiveHint=false, idempotentHint=true), so the bar is lower. The description doesn't contradict annotations and adds practical context about typical scenarios.

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 efficiently communicate the core functionality and common use cases. It's front-loaded with the main purpose and follows with practical examples. No wasted words or unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given this is a mutation tool with 4 parameters (only 25% documented in schema), no output schema, and annotations covering safety/idempotency, the description provides adequate but incomplete context. It covers the 'what' and 'why' but lacks parameter details and doesn't address potential constraints or response format.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With only 25% schema description coverage (only 'ids' parameter has a description), the description fails to compensate for the lack of parameter documentation. It mentions 'status' and 'assigned_to' in examples but doesn't explain what 'priority' does or provide any parameter-specific guidance beyond what's implied in the examples.

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: 'Update multiple tasks at once' with specific examples ('changing status of several tasks' and 'reassigning tasks'). It distinguishes from single-task operations but doesn't explicitly differentiate from sibling 'task_update' beyond the batch aspect.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides implied usage context ('Useful for changing status of several tasks') and examples, but doesn't explicitly state when to use this versus 'task_update' for single tasks or other task-related tools. No explicit alternatives or exclusions are mentioned.

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

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/spranab/saga-mcp'

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