get_tasks
Retrieve tasks from Linear with filters for status, assignee, team, or result count to manage workflow efficiently.
Instructions
Get tasks from Linear with optional filtering
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| status | No | Filter by status (e.g., "Todo", "In Progress", "Done") | |
| assignee | No | Filter by assignee name or ID | |
| team | No | Filter by team name or ID | |
| limit | No | Maximum number of tasks to return (default: 20) |
Implementation Reference
- src/index.ts:143-217 (handler)The handler function that executes the get_tasks tool logic: filters and fetches tasks (issues) from Linear API, formats them, and returns as JSON.private async handleGetTasks(args: any) { const limit = args?.limit || 20; // Build the filter let filter: Record<string, any> = {}; if (args?.status) { // Get workflow states to map status name to ID const workflowStates = await linearClient.workflowStates(); const state = workflowStates.nodes.find( (s) => s.name.toLowerCase() === args.status.toLowerCase() ); if (state) { filter.stateId = { eq: state.id }; } } if (args?.assignee) { const users = await linearClient.users(); const user = users.nodes.find( (u) => u.name.toLowerCase().includes(args.assignee.toLowerCase()) || u.id === args.assignee ); if (user) { filter.assigneeId = { eq: user.id }; } } if (args?.team) { const teams = await linearClient.teams(); const team = teams.nodes.find( (t) => t.name.toLowerCase().includes(args.team.toLowerCase()) || t.id === args.team ); if (team) { filter.teamId = { eq: team.id }; } } // Fetch issues with the filter const issues = await linearClient.issues({ filter, first: limit, }); // Format the response const formattedIssues = await Promise.all( issues.nodes.map(async (issue) => { const assignee = issue.assignee ? await issue.assignee : null; const team = issue.team ? await issue.team : null; const state = issue.state ? await issue.state : null; return { id: issue.id, title: issue.title, description: issue.description, status: state ? state.name : null, assignee: assignee ? assignee.name : null, team: team ? team.name : null, createdAt: issue.createdAt, updatedAt: issue.updatedAt, url: issue.url, }; }) ); return { content: [ { type: 'text', text: JSON.stringify(formattedIssues, null, 2), }, ], }; }
- src/index.ts:51-77 (schema)The input schema and metadata for the get_tasks tool, defined in the ListTools response.{ name: 'get_tasks', description: 'Get tasks from Linear with optional filtering', inputSchema: { type: 'object', properties: { status: { type: 'string', description: 'Filter by status (e.g., "Todo", "In Progress", "Done")', }, assignee: { type: 'string', description: 'Filter by assignee name or ID', }, team: { type: 'string', description: 'Filter by team name or ID', }, limit: { type: 'number', description: 'Maximum number of tasks to return (default: 20)', minimum: 1, maximum: 100, }, }, }, },
- src/index.ts:114-116 (registration)Registration of the get_tasks handler in the CallToolRequestSchema switch statement.case 'get_tasks': return await this.handleGetTasks(request.params.arguments); case 'get_task_details':