update_task
Modify specific fields of an existing task without affecting others. Update due date, status, owner, or description by providing only the fields to change.
Instructions
Update fields on an existing task. Only the fields you provide are changed. To mark a task done prefer complete_task.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ||
| description | No | ||
| dueOn | No | YYYY-MM-DD | |
| dueTime | No | HH:MM in user's timezone | |
| detail | No | ||
| status | No | Set to OPEN or COMPLETED. (PENDING exists internally for track-driven tasks but cannot be set directly via this tool — Capsule rejects it.) Setting status: OPEN on an already-open task is a true no-op (does not advance updatedAt). | |
| ownerId | No | Reassign owner to user ID. Once set, this connector cannot clear an owner back to null — use Capsule's web UI for that. |
Implementation Reference
- src/tools/tasks.ts:162-172 (handler)The handler function that executes the update_task logic. Extracts id and ownerId from input, builds a body object with only defined fields, then sends a PUT request to /tasks/{id}.
export async function updateTask(input: z.infer<typeof updateTaskSchema>) { const { id, ownerId, ...rest } = input; const body: Record<string, unknown> = {}; for (const [k, v] of Object.entries(rest)) { if (v !== undefined) body[k] = v; } if (ownerId) body["owner"] = { id: ownerId }; return capsulePut<{ task: unknown }>(`/tasks/${id}`, { task: body }); } - src/tools/tasks.ts:129-160 (schema)Zod schema defining the input shape for update_task. Fields: id (required), description, dueOn, dueTime, detail, status (OPEN/COMPLETED), and ownerId (all optional except id).
export const updateTaskSchema = z.object({ id: z.number().int().positive(), description: z.string().min(1).optional(), dueOn: z .string() .regex(/^\d{4}-\d{2}-\d{2}$/) .optional() .describe("YYYY-MM-DD"), dueTime: z .string() .regex(/^\d{2}:\d{2}$/) .optional() .describe("HH:MM in user's timezone"), detail: z.string().optional(), // Capsule rejects direct sets of `PENDING` (which is a track-machinery // internal state) with 422 "cannot set task status to PENDING". // Only OPEN and COMPLETED are settable here. status: z .enum(["OPEN", "COMPLETED"]) .optional() .describe( "Set to OPEN or COMPLETED. (PENDING exists internally for track-driven tasks but cannot be set directly via this tool — Capsule rejects it.) Setting status: OPEN on an already-open task is a true no-op (does not advance updatedAt).", ), ownerId: z .number() .int() .positive() .optional() .describe( "Reassign owner to user ID. Once set, this connector cannot clear an owner back to null — use Capsule's web UI for that.", ), }); - src/server.ts:631-637 (registration)Registration of the update_task tool via the registerTool helper in src/server.ts. Wires the name 'update_task' to updateTaskSchema and updateTask handler, with a description.
registerTool( server, "update_task", "Update fields on an existing task. Only the fields you provide are changed. To mark a task done prefer complete_task.", updateTaskSchema, updateTask, ); - src/server/register-tool.ts:39-59 (helper)The registerTool helper function used to register update_task (and all other tools). Wraps the handler's return value into the MCP text-content response format via JSON.stringify.
export function registerTool<Schema extends z.ZodObject<ZodRawShape>>( server: McpServer, name: string, description: string, schema: Schema, handler: (input: z.infer<Schema>) => Promise<unknown>, ): void { // Use the SDK config-form registerTool with the full Zod schema. The // deprecated shape overload rebuilds z.object(schema.shape), which drops // object-level refinements such as superRefine. const registerWithSchema = server.registerTool.bind(server) as ( toolName: string, config: { description: string; inputSchema: Schema }, callback: (input: z.infer<Schema>) => Promise<CallToolResult>, ) => void; registerWithSchema(name, { description, inputSchema: schema }, async (input) => { const result = await handler(input); return wrapAsText(result); }); }