list_triggers
Retrieve detailed triggers and metadata for a specific dataset in a Honeycomb environment. This tool provides names, descriptions, thresholds, and additional details for all available alerts.
Instructions
Lists available triggers (alerts) for a specific dataset. This tool returns a list of all triggers available in the specified dataset, including their names, descriptions, thresholds, and other metadata. NOTE: all is NOT supported as a dataset name -- it is not possible to list all triggers in an environment.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dataset | Yes | The dataset to fetch triggers from | |
| environment | Yes | The Honeycomb environment |
Implementation Reference
- src/tools/list-triggers.ts:45-94 (handler)Handler function for the list_triggers tool. Validates required parameters (environment, dataset), fetches triggers using HoneycombAPI.getTriggers, simplifies trigger data into a compact interface, computes counts for active and triggered triggers, and returns structured content with JSON-serialized triggers and metadata.handler: async ({ environment, dataset }: z.infer<typeof DatasetArgumentsSchema>) => { // Validate input parameters if (!environment) { return handleToolError(new Error("environment parameter is required"), "list_triggers"); } if (!dataset) { return handleToolError(new Error("dataset parameter is required"), "list_triggers"); } try { // Fetch triggers from the API const triggers = await api.getTriggers(environment, dataset); // Simplify the response to reduce context window usage const simplifiedTriggers: SimplifiedTrigger[] = triggers.map(trigger => ({ id: trigger.id, name: trigger.name, description: trigger.description || '', threshold: { op: trigger.threshold.op, value: trigger.threshold.value, }, triggered: trigger.triggered, disabled: trigger.disabled, frequency: trigger.frequency, alert_type: trigger.alert_type, })); const activeCount = simplifiedTriggers.filter(trigger => !trigger.disabled).length; const triggeredCount = simplifiedTriggers.filter(trigger => trigger.triggered).length; return { content: [ { type: "text", text: JSON.stringify(simplifiedTriggers, null, 2), }, ], metadata: { count: simplifiedTriggers.length, activeCount, triggeredCount, dataset, environment } }; } catch (error) { return handleToolError(error, "list_triggers"); } }
- src/tools/list-triggers.ts:33-36 (schema)Input schema using Zod for validating environment and dataset parameters required by the list_triggers tool.schema: { environment: z.string().describe("The Honeycomb environment"), dataset: z.string().describe("The dataset to fetch triggers from"), },
- src/tools/index.ts:49-51 (registration)The list_triggers tool is created via createListTriggersTool(api) and included in the tools array, which is subsequently registered with the MCP server in a loop.// Trigger tools createListTriggersTool(api), createGetTriggerTool(api),
- src/tools/list-triggers.ts:9-21 (helper)SimplifiedTrigger interface defines the structure of trigger data returned by the tool to reduce context window usage.interface SimplifiedTrigger { id: string; name: string; description: string; threshold: { op: string; value: number; }; triggered: boolean; disabled: boolean; frequency: number; alert_type?: string; }
- src/tools/index.ts:12-12 (registration)Import of the createListTriggersTool function used to instantiate the list_triggers tool.import { createListTriggersTool } from "./list-triggers.js";