get_workspace_health
Assess workspace health metrics across projects, teams, and technical areas to identify issues and receive actionable recommendations for improvement.
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 implements the core logic for the get_workspace_health tool. It parses input, assesses health categories, calculates overall score, generates alerts and 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 input schema for validating arguments to the get_workspace_health handler.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 definition registering the get_workspace_health tool with name, description, and input schema.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)Maps tool names to their handler functions, registering get_workspace_health to getWorkspaceHealth.export const analyticsInsightsHandlers = { get_project_analytics: getProjectAnalytics, get_team_productivity: getTeamProductivity, get_workspace_health: getWorkspaceHealth, generate_custom_report: generateCustomReport }
- src/tools/analytics-insights.ts:779-784 (registration)Exports collection of MCPTool objects, including getWorkspaceHealthTool for registration.export const analyticsInsightsTools = { getProjectAnalyticsTool, getTeamProductivityTool, getWorkspaceHealthTool, generateCustomReportTool }