update_context
Update context information across all tasks to maintain consistency and alignment in complex workflows.
Instructions
Updates the context information for all tasks.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| context_for_all_tasks | Yes | The new context information for all tasks |
Implementation Reference
- src/index.ts:639-674 (handler)The handler function that implements the logic for the 'update_context' tool. It validates input, reads current task data, updates the context_for_all_tasks field, persists the changes, and returns a success or error response.// Update the context for all tasks private async updateContext(args: any): Promise<any> { if (!args?.context_for_all_tasks) { throw new McpError(ErrorCode.InvalidParams, 'Context for all tasks is required'); } try { const taskData = await this.readTaskData(); // Update the context for all tasks taskData.context_for_all_tasks = args.context_for_all_tasks; // Write the updated task data to the file await this.writeTaskData(taskData); return { content: [ { type: 'text', text: 'Context updated successfully.', }, ], }; } catch (error) { console.error('Error updating context:', error); return { content: [ { type: 'text', text: `Error updating context: ${error instanceof Error ? error.message : String(error)}`, }, ], isError: true, }; } }
- src/index.ts:189-202 (schema)The input schema definition for the 'update_context' tool, specifying that it takes a 'context_for_all_tasks' string.{ name: 'update_context', description: 'Updates the context information for all tasks.', inputSchema: { type: 'object', properties: { context_for_all_tasks: { type: 'string', description: 'The new context information for all tasks' } }, required: ['context_for_all_tasks'] } },
- src/index.ts:428-429 (registration)The switch case in the CallToolRequestSchema handler that dispatches calls to the 'update_context' tool to the updateContext method.case 'update_context': return await this.updateContext(request.params.arguments);