find_best_assignee
Identify team members with the lightest workload to assign new tasks, optimizing task distribution and balancing team capacity.
Instructions
Find the team member with the lightest workload for assigning new tasks
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/workload-analysis.ts:60-74 (handler)Core handler function that executes the find_best_assignee tool logic by analyzing team workload and selecting the best (least busy) assignee.async findBestAssignee(): Promise<string | null> { const analysis = await this.analyzeWorkload(); // Return the person with the lightest workload if (analysis.leastBusy.length > 0) { return analysis.leastBusy[0]; } // If no one has a light workload, return the person with the fewest issues const lightestMember = analysis.members.reduce((prev, current) => prev.activeIssues < current.activeIssues ? prev : current ); return lightestMember.login; }
- src/index.ts:129-137 (registration)Tool registration in the MCP server's list of available tools, including name, description, and parameterless input schema.{ name: 'find_best_assignee', description: 'Find the team member with the lightest workload for assigning new tasks', inputSchema: { type: 'object', properties: {}, required: [], }, },
- src/index.ts:185-197 (handler)MCP tool call dispatcher that invokes the WorkloadAnalysisTool's findBestAssignee method and formats the response.case 'find_best_assignee': { const bestAssignee = await this.workloadAnalysisTool.findBestAssignee(); return { content: [ { type: 'text', text: bestAssignee ? `Best assignee for new tasks: ${bestAssignee}` : 'No suitable assignee found - all team members are at capacity', }, ], }; }
- src/tools/workload-analysis.ts:11-58 (helper)Key helper method called by findBestAssignee to compute workload analysis for all team members, categorizing their load and identifying least/most busy.async analyzeWorkload(): Promise<WorkloadAnalysis> { try { // Get all open issues const issues = await this.githubClient.getAllTeamIssues(); // Get unique assignees const assigneeLogins = this.githubClient.getUniqueAssignees(issues); // Calculate workload for each member const members = assigneeLogins.map(login => { const memberIssues = issues.filter(issue => issue.assignees.some(assignee => assignee.login === login) ); const activeIssues = memberIssues.length; const workloadLevel = this.categorizeWorkload(activeIssues); const recommendation = this.getRecommendation(workloadLevel, activeIssues); return { login, activeIssues, workloadLevel, recommendation }; }); // Sort by active issues count members.sort((a, b) => a.activeIssues - b.activeIssues); // Find least and most busy members const leastBusy = members .filter(m => m.workloadLevel === 'light') .map(m => m.login); const mostBusy = members .filter(m => m.workloadLevel === 'overloaded' || m.workloadLevel === 'heavy') .map(m => m.login); return { members, leastBusy, mostBusy }; } catch (error) { console.error('Error analyzing workload:', error); throw error; } }
- src/types.ts:58-67 (schema)Type definition for the WorkloadAnalysis return type used in the tool's implementation.export interface WorkloadAnalysis { members: Array<{ login: string; activeIssues: number; workloadLevel: 'light' | 'moderate' | 'heavy' | 'overloaded'; recommendation: string; }>; leastBusy: string[]; mostBusy: string[]; }