analyze_workload
Analyze team workload distribution to identify available capacity for new tasks using GitHub project board data.
Instructions
Analyze team workload distribution and identify who can take on new tasks
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/workload-analysis.ts:11-58 (handler)Core handler function that fetches team issues via GitHub client, computes workload metrics for each assignee, categorizes workload levels, generates recommendations, sorts members, and returns structured analysis including least and most busy members.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/index.ts:120-128 (registration)Registers the 'analyze_workload' tool in the MCP server's listTools handler, providing name, description, and empty input schema (no parameters required).{ name: 'analyze_workload', description: 'Analyze team workload distribution and identify who can take on new tasks', inputSchema: { type: 'object', properties: {}, required: [], }, },
- src/index.ts:173-183 (handler)MCP tool call dispatch handler that invokes the WorkloadAnalysisTool's analyzeWorkload method and formats the response as MCP content.case 'analyze_workload': { const analysis = await this.workloadAnalysisTool.analyzeWorkload(); return { content: [ { type: 'text', text: this.formatWorkloadAnalysis(analysis), }, ], }; }
- src/types.ts:58-67 (schema)TypeScript interface defining the structure of the workload analysis output, used as the return type for the tool handler.export interface WorkloadAnalysis { members: Array<{ login: string; activeIssues: number; workloadLevel: 'light' | 'moderate' | 'heavy' | 'overloaded'; recommendation: string; }>; leastBusy: string[]; mostBusy: string[]; }
- src/index.ts:273-301 (helper)Helper function to format the workload analysis results into a human-readable Markdown string with emojis for workload levels and highlights for available/busy members.private formatWorkloadAnalysis(analysis: any): string { const { members, leastBusy, mostBusy } = analysis; let output = '## Workload Analysis\n\n'; output += '**Team Workload Distribution:**\n'; for (const member of members) { const { login, activeIssues, workloadLevel, recommendation } = member; const levelEmojiMap: Record<string, string> = { light: 'π’', moderate: 'π‘', heavy: 'π ', overloaded: 'π΄' }; const levelEmoji = levelEmojiMap[workloadLevel] || 'βͺ'; output += `- ${levelEmoji} **${login}**: ${activeIssues} issues (${workloadLevel}) - ${recommendation}\n`; } if (leastBusy.length > 0) { output += `\n**Available for new work:** ${leastBusy.join(', ')}\n`; } if (mostBusy.length > 0) { output += `\n**At capacity:** ${mostBusy.join(', ')}\n`; } return output; }