get_dev_status
Check the status of npm run dev processes to monitor project execution, logs, and port usage for development workflows.
Instructions
npm run devプロセスの状態確認
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/getDevStatus.ts:17-80 (handler)The main handler function that executes the get_dev_status tool. It retrieves the status of dev servers using ProcessManager, gathers process info including logs and errors, and returns a formatted JSON string.export async function getDevStatus(): Promise<string> { try { logger.debug('Getting dev server status'); const processManager = ProcessManager.getInstance(); const processes = await processManager.getStatus(); if (processes.length === 0) { return JSON.stringify({ success: true, message: 'Dev serverは起動していません', isRunning: false, processes: [] }); } const processesInfo = processes.map(status => { const logManager = processManager.getLogManager(status.directory); const logStats = logManager?.getLogStats(); const hasRecentErrors = logManager?.hasRecentErrors() || false; return { pid: status.pid, directory: status.directory, status: status.status, startTime: status.startTime, ports: status.ports, uptime: Date.now() - status.startTime.getTime(), stats: logStats ? { errors: logStats.errors, warnings: logStats.warnings } : undefined, hasRecentErrors }; }); const result = { success: true, message: `${processes.length}個のDev serverが稼働中です`, isRunning: true, processes: processesInfo }; const ports = processes.flatMap(p => p.ports); if (ports.length > 0) { result.message += `\n利用可能なポート: ${ports.join(', ')}`; } if (processesInfo.some(p => p.hasRecentErrors)) { result.message += '\n⚠️ 一部のプロセスでエラーが発生しています。'; } return JSON.stringify(result, null, 2); } catch (error) { logger.error('Failed to get dev server status', { error }); return JSON.stringify({ success: false, message: `ステータス取得に失敗しました: ${error}`, isRunning: false, processes: [] }); } }
- src/tools/getDevStatus.ts:7-15 (schema)The input/output schema definition for the get_dev_status tool, specifying no input parameters.export const getDevStatusSchema: Tool = { name: 'get_dev_status', description: 'npm run devプロセスの状態確認', inputSchema: { type: 'object', properties: {}, additionalProperties: false } };
- src/index.ts:55-65 (registration)Registration of the getDevStatusSchema in the tools array used for ListToolsRequestHandler.const tools = [ scanProjectDirsSchema, startDevServerSchema, getDevStatusSchema, getDevLogsSchema, stopDevServerSchema, restartDevServerSchema, getHealthStatusSchema, recoverFromStateSchema, autoRecoverSchema, ];
- src/index.ts:147-155 (registration)Tool dispatch/registration in the CallToolRequestHandler switch statement, invoking getDevStatus() when 'get_dev_status' is called.case 'get_dev_status': return { content: [ { type: 'text', text: await getDevStatus(), }, ], };
- Dependency mapping for tools, specifying that get_dev_status requires the 'stateManager' service.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;