list_honeybadger_faults
Fetch recent application errors from Honeybadger to analyze and troubleshoot issues directly in your development environment.
Instructions
List recent faults from Honeybadger
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | No | Optional project ID (uses env var if not provided) | |
| limit | No | Number of faults to fetch (default: 20, max: 100) | |
| environment | No | Filter by environment (e.g., production, staging) | |
| resolved | No | Filter by resolved status |
Implementation Reference
- src/index.ts:292-315 (handler)The primary handler function for the 'list_honeybadger_faults' tool. It extracts parameters (project_id, limit, environment, resolved), makes an authenticated API request to Honeybadger's faults endpoint, and returns the JSON response formatted as MCP content.private async listFaults(args: any): Promise<any> { const pid = args.project_id || this.config.projectId; if (!pid) { throw new McpError(ErrorCode.InvalidRequest, 'Project ID is required'); } const params: any = { limit: Math.min(args.limit || 20, 100), }; if (args.environment) params.environment = args.environment; if (typeof args.resolved === 'boolean') params.resolved = args.resolved; const data = await this.makeHoneybadgerRequest(`/projects/${pid}/faults`, params); return { content: [ { type: 'text', text: JSON.stringify(data, null, 2), }, ], }; }
- src/index.ts:135-161 (registration)Registration of the 'list_honeybadger_faults' tool in the ListToolsRequestSchema handler, including name, description, and input schema.{ name: 'list_honeybadger_faults', description: 'List recent faults from Honeybadger', inputSchema: { type: 'object', properties: { project_id: { type: 'string', description: 'Optional project ID (uses env var if not provided)', }, limit: { type: 'number', description: 'Number of faults to fetch (default: 20, max: 100)', default: 20, }, environment: { type: 'string', description: 'Filter by environment (e.g., production, staging)', }, resolved: { type: 'boolean', description: 'Filter by resolved status', }, }, required: [], }, },
- src/index.ts:138-160 (schema)Input schema defining optional parameters for listing faults: project_id, limit (default 20, max 100), environment, resolved.inputSchema: { type: 'object', properties: { project_id: { type: 'string', description: 'Optional project ID (uses env var if not provided)', }, limit: { type: 'number', description: 'Number of faults to fetch (default: 20, max: 100)', default: 20, }, environment: { type: 'string', description: 'Filter by environment (e.g., production, staging)', }, resolved: { type: 'boolean', description: 'Filter by resolved status', }, }, required: [], },
- src/index.ts:204-205 (registration)Dispatch case in CallToolRequestSchema handler that routes 'list_honeybadger_faults' calls to the listFaults method.case 'list_honeybadger_faults': return await this.listFaults(args as any);
- src/index.ts:222-252 (helper)Shared helper method makeHoneybadgerRequest used by listFaults to perform authenticated GET requests to the Honeybadger API.private async makeHoneybadgerRequest(endpoint: string, params: any = {}) { if (!this.config.apiKey) { throw new McpError(ErrorCode.InvalidRequest, 'HONEYBADGER_API_KEY environment variable is required'); } const username = this.config.apiKey; const password = ''; const url = `${this.config.baseUrl}/v2${endpoint}`; const credentials = Buffer.from(`${username}:${password}`).toString('base64'); try { const response = await axios.get(url, { headers: { 'Authorization': `Basic ${credentials}`, 'Accept': 'application/json', }, params, }); return response.data; } catch (error: any) { if (error.response) { throw new McpError( ErrorCode.InvalidRequest, `Honeybadger API error: ${error.response.status} - ${error.response.data?.error || error.response.statusText}` ); } throw new McpError(ErrorCode.InternalError, `Network error: ${error.message}`); } }