get_trigger
Retrieve detailed trigger information including ID, name, description, threshold, and status from the Honeycomb environment using a specific trigger ID and dataset.
Instructions
Retrieves a specific trigger (alert) by ID with detailed information. This tool returns a detailed object containing the trigger's ID, name, description, threshold, frequency, alert type, triggered status, disabled status, recipients, evaluation schedule type, and timestamps.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dataset | Yes | The dataset containing the trigger | |
| environment | Yes | The Honeycomb environment | |
| triggerId | Yes | The ID of the trigger to retrieve |
Implementation Reference
- src/tools/get-trigger.ts:58-113 (handler)The main handler function for the 'get_trigger' tool. Validates input parameters (environment, dataset, triggerId), fetches trigger details from the Honeycomb API, simplifies the response data to reduce token usage, formats it as JSON text content with metadata, and handles errors.handler: async ({ environment, dataset, triggerId }: { environment: string; dataset: string; triggerId: string }) => { // Validate input parameters if (!environment) { return handleToolError(new Error("environment parameter is required"), "get_trigger"); } if (!dataset) { return handleToolError(new Error("dataset parameter is required"), "get_trigger"); } if (!triggerId) { return handleToolError(new Error("triggerId parameter is required"), "get_trigger"); } try { // Fetch trigger details from the API const trigger = await api.getTrigger(environment, dataset, triggerId); // Simplify the response to reduce context window usage const simplifiedTrigger: SimplifiedTriggerDetails = { id: trigger.id, name: trigger.name, description: trigger.description || '', threshold: { op: trigger.threshold.op, value: trigger.threshold.value, }, frequency: trigger.frequency, alert_type: trigger.alert_type, triggered: trigger.triggered, disabled: trigger.disabled, recipients: trigger.recipients.map(r => ({ type: r.type, target: r.target, })), evaluation_schedule_type: trigger.evaluation_schedule_type, created_at: trigger.created_at, updated_at: trigger.updated_at, }; return { content: [ { type: "text", text: JSON.stringify(simplifiedTrigger, null, 2), }, ], metadata: { triggerId, dataset, environment, status: trigger.triggered ? "TRIGGERED" : trigger.disabled ? "DISABLED" : "ACTIVE" } }; } catch (error) { return handleToolError(error, "get_trigger"); } }
- src/tools/get-trigger.ts:44-48 (schema)Zod input schema defining required string parameters: environment, dataset, and triggerId with descriptions.schema: { environment: z.string().describe("The Honeycomb environment"), dataset: z.string().describe("The dataset containing the trigger"), triggerId: z.string().describe("The ID of the trigger to retrieve"), },
- src/tools/get-trigger.ts:8-32 (schema)TypeScript interfaces defining the simplified data structures for recipients and trigger details used in the tool's output.interface SimplifiedRecipient { type: string; target?: string; } /** * Interface for simplified trigger data returned by the get_trigger tool */ interface SimplifiedTriggerDetails { id: string; name: string; description: string; threshold: { op: string; value: number; }; frequency: number; alert_type?: string; triggered: boolean; disabled: boolean; recipients: SimplifiedRecipient[]; evaluation_schedule_type?: string; created_at: string; updated_at: string; }
- src/tools/index.ts:13-13 (registration)Import statement for the createGetTriggerTool factory function.import { createGetTriggerTool } from "./get-trigger.js";
- src/tools/index.ts:49-52 (registration)Instantiation of the get_trigger tool via createGetTriggerTool(api) within the array of tools passed to the MCP server registration.// Trigger tools createListTriggersTool(api), createGetTriggerTool(api),