Task Management
Relevant source files
The following files were used as context for generating this wiki page:
Task Management in e-zer0 provides a unified interface for AI agents to interact with Google Tasks and Microsoft To Do. The system abstracts provider-specific APIs into a single set of Model Context Protocol (MCP) tools. This allows agents to list, create, update, and delete tasks across different platforms using standardized commands.
The implementation relies on dedicated library clients for the Google Tasks API and Microsoft Graph API. It ensures security through PII redaction and mandatory audit logging for every operation.
Sources: src/mcp/tools.ts:800-805, README.md:100-115
Architecture and Integration
The task management system functions as a middleware layer between MCP clients and external task providers. The src/mcp/tools.ts file acts as the unification engine, translating generic requests into provider-specific API calls.
Data Flow Overview
When an agent requests a task operation, the system follows this execution path:
- Authentication: The system retrieves and decrypts the provider access token from the D1 database.
- Execution: The unified tool calls the relevant function in
src/lib/tasks/google.tsorsrc/lib/tasks/microsoft.ts. - Normalization: The system maps provider-specific task objects into a common
unifyTaskstructure. - Sanitization: The system redacts PII from task titles and notes before returning data to the agent.
- Auditing: The system logs the success or failure of the action in the
audit_logstable.
Sources: src/mcp/tools.ts:80-110, src/mcp/tools.ts:814-835, src/mcp/server.ts:600-610
The diagram shows the request flow from the MCP client through the unification layer to external provider APIs, including background security and logging processes.
Sources: src/mcp/tools.ts:800-810, src/mcp/server.ts:35-50
Task Unification
Different providers use different field names and status values. e-zer0 normalizes these into a consistent schema.
Status Mapping
Google uses needsAction or completed, while Microsoft uses multiple states like notStarted, inProgress, and completed. e-zer0 simplifies these into two internal states: open and completed.
Sources: src/lib/tasks/google.ts:16-24, src/lib/tasks/microsoft.ts:15-23, src/mcp/tools.ts:814-825
Unified Task Structure
The unifyTask function ensures all tasks returned to the agent include security metadata and consistent date formatting.
| Field | Type | Description |
|---|---|---|
id | string | The unique provider ID for the task. |
title | string | Sanitized task title. |
notes | string | Sanitized task notes or description. |
status | open | completed | Normalized task status. |
due | string | ISO 8601 date string. |
_security | object | Risk scores and redaction summaries. |
Sources: src/mcp/tools.ts:814-835, src/types.ts:100-120
Provider Clients
Google Tasks Client
The Google client interfaces with https://tasks.googleapis.com/tasks/v1. It handles pagination using nextPageToken and enforces a limit of 50 pages for list operations. Google only honors the date portion of the due field.
Key functions:
listGoogleTaskLists: Retrieves all lists for the authenticated user.listGoogleTasks: Fetches tasks from a list with optional completion filters.createGoogleTask: Sends a POST request to create a task.
Sources: src/lib/tasks/google.ts:1-70, src/lib/tasks/google.test.ts:1-50
Microsoft To Do Client
The Microsoft client uses the Graph API via https://graph.microsoft.com/v1.0/me. It supports the "wellknownListName" property to identify the defaultList. Unlike Google, Microsoft expects date-time objects without a trailing 'Z' in a UTC timezone.
Key functions:
getMsDefaultListId: Identifies the primary task list.listMsTasks: Filters tasks using OData$filterqueries (e.g.,status ne 'completed').updateMsTask: Issues a PATCH request for partial updates.
Sources: src/lib/tasks/microsoft.ts:1-90, src/lib/tasks/microsoft.test.ts:1-60
MCP Tool Interface
The MCP server exposes tasks through five primary tools. Every tool requires an account_id to identify the connected mailbox.
| Tool Name | Action | Destructive |
|---|---|---|
list_task_lists | Retrieves all task lists for an account. | No |
list_tasks | Fetches tasks (defaults to open tasks). | No |
create_task | Adds a new task to a specific or default list. | No |
update_task | Modifies properties or marks a task complete. | Yes |
delete_task | Permanently removes a task. | Yes |
Sources: src/mcp/server.ts:600-750, src/mcp/server.test.ts:15-35
Implementation Logic
The unified tool layer manages list resolution. If an agent omits a list_id, the system automatically resolves the @default list for Google or the defaultList for Microsoft.
Sources: src/mcp/tools.ts:850-900, src/lib/tasks/microsoft.ts:55-60
The sequence diagram illustrates the end-to-end lifecycle of a task creation request, highlighting the decryption and sanitization steps.
Sources: src/mcp/tools.ts:80-110, src/mcp/tools.ts:875-890, src/mcp/server.ts:650-680
Summary
Task Management provides a secure, provider-agnostic way for AI agents to organize work. By centralizing authentication and data normalization, the system protects raw credentials and sensitive information while maintaining a full audit trail of agent activities across Google and Microsoft ecosystems.
Sources: README.md:15-30, AGENTS.md:50-65