get_tasks
Retrieve tasks from Linear with filters like status, assignee, or team to manage workflows efficiently and limit results for focused task tracking.
Instructions
Get tasks from Linear with optional filtering
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| assignee | No | Filter by assignee name or ID | |
| limit | No | Maximum number of tasks to return (default: 20) | |
| status | No | Filter by status (e.g., "Todo", "In Progress", "Done") | |
| team | No | Filter by team name or ID |
Implementation Reference
- src/index.ts:143-217 (handler)The handler function that implements the core logic of the 'get_tasks' tool. It constructs a filter based on input arguments (status, assignee, team, limit), queries the Linear API for matching issues, fetches additional details for each issue, formats them, and returns a JSON string response.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:52-77 (schema)The schema definition for the 'get_tasks' tool, including name, description, and input schema specifying optional filter parameters.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-115 (registration)The dispatch/registration point where incoming 'get_tasks' tool calls are routed to the handleGetTasks handler.case 'get_tasks': return await this.handleGetTasks(request.params.arguments);