get_workspace_health
Assess workspace health by analyzing project metrics, team wellness, and technical indicators to identify issues and generate improvement recommendations.
Instructions
Get comprehensive workspace health metrics and indicators
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| health_categories | No | Categories of health metrics to assess | |
| alert_thresholds | No | Thresholds for health score alerts | |
| include_recommendations | No | Include actionable recommendations |
Implementation Reference
- src/tools/analytics-insights.ts:271-358 (handler)The main handler function that executes the get_workspace_health tool logic. It parses input arguments, assesses specified health categories using helper functions, calculates overall scores and status, generates alerts based on thresholds, and optionally provides recommendations.export const getWorkspaceHealth = requireAuth(async (args: any) => { const { health_categories, alert_thresholds, include_recommendations } = GetWorkspaceHealthSchema.parse(args) logger.info('Assessing workspace health', { health_categories }) const health: any = { overall_score: 0, status: 'unknown', assessed_at: new Date().toISOString(), categories: {}, alerts: [] } const categoryScores: number[] = [] // Assess each health category for (const category of health_categories) { try { let categoryHealth switch (category) { case 'project_health': categoryHealth = await assessProjectHealth() break case 'team_wellness': categoryHealth = await assessTeamWellness() break case 'technical_debt': categoryHealth = await assessTechnicalDebt() break case 'documentation_coverage': categoryHealth = await assessDocumentationCoverage() break case 'automation_efficiency': categoryHealth = await assessAutomationEfficiency() break case 'security_posture': categoryHealth = await assessSecurityPosture() break default: continue } health.categories[category] = categoryHealth categoryScores.push(categoryHealth.score) // Check for alerts if (categoryHealth.score <= alert_thresholds.critical) { health.alerts.push({ level: 'critical', category, message: `${category} score is critically low (${categoryHealth.score}%)`, recommendations: categoryHealth.urgent_actions || [] }) } else if (categoryHealth.score <= alert_thresholds.warning) { health.alerts.push({ level: 'warning', category, message: `${category} needs attention (${categoryHealth.score}%)`, recommendations: categoryHealth.improvements || [] }) } } catch (error) { logger.error(`Failed to assess ${category}:`, error) health.categories[category] = { error: 'Assessment failed', score: 0 } } } // Calculate overall health score health.overall_score = categoryScores.length > 0 ? Math.round(categoryScores.reduce((sum, score) => sum + score, 0) / categoryScores.length) : 0 // Determine overall status if (health.overall_score >= alert_thresholds.good) { health.status = 'healthy' } else if (health.overall_score >= alert_thresholds.warning) { health.status = 'needs_attention' } else { health.status = 'critical' } // Generate recommendations if requested if (include_recommendations) { health.recommendations = generateWorkspaceRecommendations(health.categories, health.alerts) } return health })
- Zod schema used for input validation in the getWorkspaceHealth handler, defining health_categories, alert_thresholds, and include_recommendations parameters.const GetWorkspaceHealthSchema = z.object({ health_categories: z.array(z.enum(['project_health', 'team_wellness', 'technical_debt', 'documentation_coverage', 'automation_efficiency', 'security_posture'])).default(['project_health', 'team_wellness', 'documentation_coverage']), alert_thresholds: z.object({ critical: z.number().default(30), warning: z.number().default(60), good: z.number().default(80) }).default({}), include_recommendations: z.boolean().default(true) })
- src/tools/analytics-insights.ts:228-259 (registration)MCPTool object registration for 'get_workspace_health', including name, description, and input schema definition.export const getWorkspaceHealthTool: MCPTool = { name: 'get_workspace_health', description: 'Get comprehensive workspace health metrics and indicators', inputSchema: { type: 'object', properties: { health_categories: { type: 'array', items: { type: 'string', enum: ['project_health', 'team_wellness', 'technical_debt', 'documentation_coverage', 'automation_efficiency', 'security_posture'] }, default: ['project_health', 'team_wellness', 'documentation_coverage'], description: 'Categories of health metrics to assess' }, alert_thresholds: { type: 'object', properties: { critical: { type: 'number', default: 30 }, warning: { type: 'number', default: 60 }, good: { type: 'number', default: 80 } }, description: 'Thresholds for health score alerts' }, include_recommendations: { type: 'boolean', default: true, description: 'Include actionable recommendations' } } } }
- src/tools/analytics-insights.ts:786-791 (registration)Export of handler mappings including 'get_workspace_health: getWorkspaceHealth' for tool registration in the analytics insights module.export const analyticsInsightsHandlers = { get_project_analytics: getProjectAnalytics, get_team_productivity: getTeamProductivity, get_workspace_health: getWorkspaceHealth, generate_custom_report: generateCustomReport }