get_honeybadger_fault
Fetch and analyze a specific application error by fault ID directly from Honeybadger, enabling developers to troubleshoot issues efficiently within their development environment.
Instructions
Fetch a specific fault/error from Honeybadger by ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fault_id | Yes | The ID of the fault to fetch | |
| project_id | No | Optional project ID (uses env var if not provided) |
Implementation Reference
- src/index.ts:254-270 (handler)The handler function that executes the tool logic: fetches the Honeybadger fault details by ID using the API and returns formatted JSON response.private async getFault(faultId: string, projectId?: string): Promise<any> { const pid = projectId || this.config.projectId; if (!pid) { throw new McpError(ErrorCode.InvalidRequest, 'Project ID is required'); } const data = await this.makeHoneybadgerRequest(`/projects/${pid}/faults/${faultId}`); return { content: [ { type: 'text', text: JSON.stringify(data, null, 2), }, ], }; }
- src/index.ts:97-110 (schema)Input schema definition for the get_honeybadger_fault tool, specifying required fault_id and optional project_id.inputSchema: { type: 'object', properties: { fault_id: { type: 'string', description: 'The ID of the fault to fetch', }, project_id: { type: 'string', description: 'Optional project ID (uses env var if not provided)', }, }, required: ['fault_id'], },
- src/index.ts:94-111 (registration)Tool registration in the ListTools response, defining name, description, and schema.{ name: 'get_honeybadger_fault', description: 'Fetch a specific fault/error from Honeybadger by ID', inputSchema: { type: 'object', properties: { fault_id: { type: 'string', description: 'The ID of the fault to fetch', }, project_id: { type: 'string', description: 'Optional project ID (uses env var if not provided)', }, }, required: ['fault_id'], }, },
- src/index.ts:198-199 (registration)Registration of the tool handler dispatch in the CallToolRequest switch statement.case 'get_honeybadger_fault': return await this.getFault(args.fault_id as string, args.project_id as string | undefined);
- src/index.ts:222-252 (helper)Helper method used by getFault to make authenticated API requests to Honeybadger.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}`); } }