Skip to main content
Glama

subtask_update

Modify subtask details including title, status, or order in project tracking systems to maintain accurate task management and progress monitoring.

Instructions

Update a subtask title, status, or sort order.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesSubtask ID
titleNo
statusNo
sort_orderNo

Implementation Reference

  • The handleSubtaskUpdate function implements the business logic for updating a subtask, including input validation, database execution, and logging activity.
    function handleSubtaskUpdate(args: Record<string, unknown>) {
      const db = getDb();
      const id = args.id as number;
    
      const oldRow = db.prepare('SELECT * FROM subtasks WHERE id = ?').get(id) as Record<string, unknown> | undefined;
      if (!oldRow) throw new Error(`Subtask ${id} not found`);
    
      const updates: string[] = [];
      const params: unknown[] = [];
    
      if (args.title !== undefined) {
        updates.push('title = ?');
        params.push(args.title);
      }
      if (args.status !== undefined) {
        updates.push('status = ?');
        params.push(args.status);
      }
      if (args.sort_order !== undefined) {
        updates.push('sort_order = ?');
        params.push(args.sort_order);
      }
    
      if (updates.length === 0) throw new Error('No fields to update');
    
      updates.push("updated_at = datetime('now')");
      params.push(id);
    
      const newRow = db
        .prepare(`UPDATE subtasks SET ${updates.join(', ')} WHERE id = ? RETURNING *`)
        .get(...params) as Record<string, unknown>;
    
      if (oldRow.status !== newRow.status) {
        logActivity(
          db, 'subtask', id, 'status_changed', 'status',
          oldRow.status as string, newRow.status as string,
          `Subtask '${newRow.title}' status: ${oldRow.status} -> ${newRow.status}`
        );
      }
    
      return newRow;
    }
  • The schema definition for the 'subtask_update' tool.
    {
      name: 'subtask_update',
      description: 'Update a subtask title, status, or sort order.',
      annotations: { title: 'Update Subtask', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
      inputSchema: {
        type: 'object',
        properties: {
          id: { type: 'integer', description: 'Subtask ID' },
          title: { type: 'string' },
          status: { type: 'string', enum: ['todo', 'in_progress', 'done'] },
          sort_order: { type: 'integer' },
        },
        required: ['id'],
      },
    },
  • Registration map linking tool names to their respective handler functions.
    export const handlers: Record<string, ToolHandler> = {
      subtask_create: handleSubtaskCreate,
      subtask_update: handleSubtaskUpdate,
      subtask_delete: handleSubtaskDelete,
    };

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