get_honeybadger_notices
Retrieve and analyze error notices for a specific fault using the Honeybadger MCP Server. Input a fault ID and optional project ID to fetch relevant error occurrences, aiding in debugging and issue resolution.
Instructions
Fetch notices (occurrences) for a specific fault
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fault_id | Yes | The ID of the fault to fetch notices for | |
| limit | No | Number of notices to fetch (default: 10, max: 100) | |
| project_id | No | Optional project ID (uses env var if not provided) |
Implementation Reference
- src/index.ts:272-290 (handler)The main handler function for the 'get_honeybadger_notices' tool. It fetches notices for a given fault ID from the Honeybadger API using makeHoneybadgerRequest and returns the JSON data wrapped in MCP content format.private async getNotices(faultId: string, projectId?: string, limit: number = 10): 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}/notices`, { limit: Math.min(limit, 100), }); return { content: [ { type: 'text', text: JSON.stringify(data, null, 2), }, ], }; }
- src/index.ts:115-133 (schema)Input schema definition for the 'get_honeybadger_notices' tool, specifying parameters: fault_id (required), project_id (optional), limit (optional with default).inputSchema: { type: 'object', properties: { fault_id: { type: 'string', description: 'The ID of the fault to fetch notices for', }, project_id: { type: 'string', description: 'Optional project ID (uses env var if not provided)', }, limit: { type: 'number', description: 'Number of notices to fetch (default: 10, max: 100)', default: 10, }, }, required: ['fault_id'], },
- src/index.ts:112-134 (registration)Tool registration in the ListTools response, including name, description, and input schema.{ name: 'get_honeybadger_notices', description: 'Fetch notices (occurrences) for a specific fault', inputSchema: { type: 'object', properties: { fault_id: { type: 'string', description: 'The ID of the fault to fetch notices for', }, project_id: { type: 'string', description: 'Optional project ID (uses env var if not provided)', }, limit: { type: 'number', description: 'Number of notices to fetch (default: 10, max: 100)', default: 10, }, }, required: ['fault_id'], }, },
- src/index.ts:201-202 (registration)Dispatch case in the CallToolRequest handler that routes to the getNotices method.case 'get_honeybadger_notices': return await this.getNotices(args.fault_id as string, args.project_id as string | undefined, args.limit as number | undefined);
- src/index.ts:222-252 (helper)Helper method used by getNotices 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}`); } }