list_tasks
Retrieve tasks for time tracking with filtering options. Manage task lists by status, update date, or pagination to organize project assignments.
Instructions
Retrieve a list of tasks with optional filtering. Tasks are the building blocks for time tracking and can be assigned to projects.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| is_active | No | Filter by active status | |
| updated_since | No | Filter by tasks updated since this timestamp | |
| page | No | Page number for pagination | |
| per_page | No | Number of tasks per page (max 2000) |
Implementation Reference
- src/tools/tasks.ts:20-36 (handler)The ListTasksHandler class handles the execution of the list_tasks tool by validating input and calling the Harvest API.
class ListTasksHandler implements ToolHandler { constructor(private readonly config: BaseToolConfig) {} async execute(args: Record<string, any>): Promise<CallToolResult> { try { const validatedArgs = validateInput(TaskQuerySchema, args, 'tasks query'); logger.info('Listing tasks from Harvest API'); const tasks = await this.config.harvestClient.getTasks(validatedArgs); return { content: [{ type: 'text', text: JSON.stringify(tasks, null, 2) }], }; } catch (error) { return handleMCPToolError(error, 'list_tasks'); } } } - src/tools/tasks.ts:116-132 (registration)The list_tasks tool is defined and registered with its schema and handler within registerTaskTools.
{ tool: { name: 'list_tasks', description: 'Retrieve a list of tasks with optional filtering. Tasks are the building blocks for time tracking and can be assigned to projects.', inputSchema: { type: 'object', properties: { is_active: { type: 'boolean', description: 'Filter by active status' }, updated_since: { type: 'string', format: 'date-time', description: 'Filter by tasks updated since this timestamp' }, page: { type: 'number', minimum: 1, description: 'Page number for pagination' }, per_page: { type: 'number', minimum: 1, maximum: 2000, description: 'Number of tasks per page (max 2000)' }, }, additionalProperties: false, }, }, handler: new ListTasksHandler(config), },