Skip to main content
Glama
masamunet

npm-dev-mcp

by masamunet

get_health_status

Check the health status of the npm-dev-mcp server to monitor background processes and ensure development environments are running properly. Use the detailed parameter for comprehensive reports.

Instructions

MCPサーバーのヘルス状態を取得

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
detailedNo詳細なヘルスレポートを取得するかどうか(デフォルト: false)

Implementation Reference

  • The main execution logic for the get_health_status tool. Performs health checks using HealthChecker instance, supports detailed reports, returns JSON status.
    export async function getHealthStatus(args: { detailed?: boolean } = {}): Promise<string> {
      const logger = Logger.getInstance();
      const healthChecker = HealthChecker.getInstance();
      
      try {
        logger.info('Getting health status', { detailed: args.detailed });
        
        if (args.detailed) {
          // 詳細なヘルスレポートを取得
          const report = await healthChecker.generateHealthReport();
          
          logger.info('Generated detailed health report');
          
          return JSON.stringify({
            success: true,
            message: 'MCPサーバーの詳細ヘルス状態を取得しました',
            report: JSON.parse(report)
          });
        } else {
          // 基本的なヘルス状態を取得
          const status = await healthChecker.performHealthCheck();
          
          logger.info('Health status retrieved', { 
            isHealthy: status.isHealthy,
            devServerStatus: status.devServerStatus
          });
          
          return JSON.stringify({
            success: true,
            message: `MCPサーバーは${status.isHealthy ? '正常' : '異常'}状態です`,
            health: {
              isHealthy: status.isHealthy,
              uptime: Math.floor(status.uptime / 1000),
              devServerStatus: status.devServerStatus,
              memoryUsage: {
                heapUsed: Math.floor(status.memoryUsage.heapUsed / 1024 / 1024),
                rss: Math.floor(status.memoryUsage.rss / 1024 / 1024)
              },
              checks: status.checks,
              lastError: status.lastError,
              timestamp: status.timestamp
            }
          });
        }
        
      } catch (error) {
        logger.error('Failed to get health status', { error });
        
        return JSON.stringify({
          success: false,
          message: `ヘルス状態の取得に失敗しました: ${error}`,
          error: String(error)
        });
      }
    }
  • Input schema and metadata definition for the get_health_status tool, defining optional 'detailed' boolean parameter.
    export const getHealthStatusSchema: Tool = {
      name: 'get_health_status',
      description: 'MCPサーバーのヘルス状態を取得',
      inputSchema: {
        type: 'object',
        properties: {
          detailed: {
            type: 'boolean',
            description: '詳細なヘルスレポートを取得するかどうか(デフォルト: false)',
            default: false
          }
        },
        additionalProperties: false
      }
    };
  • src/index.ts:187-195 (registration)
    Registration and dispatch of get_health_status handler in the main CallToolRequestSchema switch statement.
    case 'get_health_status':
      return {
        content: [
          {
            type: 'text',
            text: await getHealthStatus(args as { detailed?: boolean }),
          },
        ],
      };
  • src/index.ts:55-65 (registration)
    Inclusion of getHealthStatusSchema in the tools array used for ListToolsRequestSchema response.
    const tools = [
      scanProjectDirsSchema,
      startDevServerSchema,
      getDevStatusSchema,
      getDevLogsSchema,
      stopDevServerSchema,
      restartDevServerSchema,
      getHealthStatusSchema,
      recoverFromStateSchema,
      autoRecoverSchema,
    ];
  • Dependency mapping for get_health_status tool, requiring 'healthChecker' service before execution.
    export const SERVICE_DEPENDENCIES = {
      'scan_project_dirs': ['projectContext'],
      'start_dev_server': ['stateManager'],
      'get_dev_status': ['stateManager'],
      'get_dev_logs': ['stateManager'],
      'stop_dev_server': ['stateManager'],
      'restart_dev_server': ['stateManager'],
      'get_health_status': ['healthChecker'],
      'recover_from_state': ['stateManager'],
      'auto_recover': ['stateManager', 'healthChecker']
    } as const;

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/masamunet/npm-dev-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server