waroom_get_incidents
Retrieve incident lists from Waroom MCP with filtering options for service, status, severity, date range, and root cause analysis.
Instructions
インシデントの一覧を取得します。各種フィルター条件を指定できます。
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | 取得するページ番号(1以上の整数)。デフォルト: 1 | |
| per_page | No | 1ページあたりの取得数(1-100)。デフォルト: 50 | |
| service_names | No | フィルタリング対象のサービス名の配列 | |
| status | No | インシデントステータス(resolved, close, detected, investigating, fixing) | |
| root_cause | No | 根本原因 | |
| severities | No | 重要度の配列(critical, high, low, info, unknown) | |
| from | No | 開始日(YYYY-MM-DD形式 例: 2023-01-01) | |
| to | No | 終了日(YYYY-MM-DD形式 例: 2023-12-31) | |
| includes_experimental | No | 実験的なインシデントを含めるかどうか | |
| label_names | No | フィルタリング対象のラベル名の配列 | |
| commander_id | No | コマンダーのID(正の整数) |
Implementation Reference
- src/tools/incidents.ts:44-79 (registration)Registration of the 'waroom_get_incidents' MCP tool, including input schema (Zod), description, and inline handler function that calls WaroomClient.getIncidents and returns formatted response.server.tool( 'waroom_get_incidents', 'インシデントの一覧を取得します。各種フィルター条件を指定できます。', { page: z.number().int().min(1).optional().describe('取得するページ番号(1以上の整数)。デフォルト: 1'), per_page: z.number().int().min(1).max(100).optional().describe('1ページあたりの取得数(1-100)。デフォルト: 50'), service_names: z.array(z.string().min(1)).min(1).optional().describe('フィルタリング対象のサービス名の配列'), status: z.enum(['resolved', 'close', 'detected', 'investigating', 'fixing']).optional().describe('インシデントステータス(resolved, close, detected, investigating, fixing)'), root_cause: z.enum(['unspecified', 'code_bug', 'configuration_error', 'deployment_failure', 'infrastructure_failure', 'operational_failure', 'third_party_outage', 'other']).optional().describe('根本原因'), severities: z.array(z.enum(['critical', 'high', 'low', 'info', 'unknown'])).min(1).optional().describe('重要度の配列(critical, high, low, info, unknown)'), from: z.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional().describe('開始日(YYYY-MM-DD形式 例: 2023-01-01)'), to: z.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional().describe('終了日(YYYY-MM-DD形式 例: 2023-12-31)'), includes_experimental: z.boolean().optional().describe('実験的なインシデントを含めるかどうか'), label_names: z.array(z.string().min(1)).min(1).optional().describe('フィルタリング対象のラベル名の配列'), commander_id: z.number().int().positive().optional().describe('コマンダーのID(正の整数)'), }, async (params) => { try { const { page = 1, per_page = 50, ...filters } = params; const response = await waroomClient.getIncidents(page, per_page, filters); return { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] }; } catch (error) { return { content: [{ type: 'text', text: `インシデント一覧の取得に失敗しました: ${error}` }] }; } } );
- src/WaroomClient.ts:23-42 (helper)WaroomClient.getIncidents helper method: constructs query parameters from filters and makes API call to fetch paginated list of incidents with applied filters.async getIncidents(page = 1, perPage = 50, filters: any = {}) { try { const params: any = { page, per_page: perPage }; // フィルターパラメーターを追加 if (filters.service_names?.length) params.service_names = filters.service_names.join(','); if (filters.status) params.status = filters.status; if (filters.root_cause) params.root_cause = filters.root_cause; if (filters.severities?.length) params.severities = filters.severities.join(','); if (filters.from) params.from = filters.from; if (filters.to) params.to = filters.to; if (filters.includes_experimental !== undefined) params.includes_experimental = filters.includes_experimental; if (filters.label_names?.length) params.label_names = filters.label_names.join(','); if (filters.commander_id) params.commander_id = filters.commander_id; const response = await this.axiosInstance.get(`${this.baseUrl}/incidents`, { params }); return response.data; } catch (error) { throw new Error(`Failed to get incidents: ${error}`); }
- src/main.ts:26-29 (registration)Top-level invocation of createIncidentsTools (among others) to register all incident-related tools, including waroom_get_incidents, to the MCP server.createIncidentsTools(server, waroomClient); createPostmortemsTools(server, waroomClient); createServicesTools(server, waroomClient); createLabelsTools(server, waroomClient);