list_slos
Retrieve available Service Level Objectives (SLOs) for a specific Honeycomb dataset and environment, including names, descriptions, time periods, and success targets.
Instructions
Lists available SLOs (Service Level Objectives) for a specific dataset. This tool returns a list of all SLOs available in the specified environment, including their names, descriptions, time periods, and target per million events expected to succeed. NOTE: all is NOT supported as a dataset name -- it is not possible to list all SLOs in an environment.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| environment | Yes | The Honeycomb environment | |
| dataset | Yes | The dataset to fetch SLOs from |
Implementation Reference
- src/tools/list-slos.ts:39-77 (handler)Handler function that validates parameters, fetches SLOs via api.getSLOs(environment, dataset), simplifies the data to id, name, description, time_period_days, target_per_million, and returns formatted text content with count metadata.handler: async ({ environment, dataset }: z.infer<typeof DatasetArgumentsSchema>) => { // Validate input parameters if (!environment) { return handleToolError(new Error("environment parameter is required"), "list_slos"); } if (!dataset) { return handleToolError(new Error("dataset parameter is required"), "list_slos"); } try { // Fetch SLOs from the API const slos = await api.getSLOs(environment, dataset); // Simplify the response to reduce context window usage const simplifiedSLOs: SimplifiedSLO[] = slos.map(slo => ({ id: slo.id, name: slo.name, description: slo.description || '', time_period_days: slo.time_period_days, target_per_million: slo.target_per_million, })); return { content: [ { type: "text", text: JSON.stringify(simplifiedSLOs, null, 2), }, ], metadata: { count: simplifiedSLOs.length, dataset, environment } }; } catch (error) { return handleToolError(error, "list_slos"); } }
- src/tools/list-slos.ts:27-30 (schema)Zod input schema defining required string parameters: environment and dataset.schema: { environment: z.string().describe("The Honeycomb environment"), dataset: z.string().describe("The dataset to fetch SLOs from"), },
- src/tools/index.ts:10-10 (registration)Import of the createListSLOsTool factory function.import { createListSLOsTool } from "./list-slos.js";
- src/tools/index.ts:46-46 (registration)Instantiation of the list_slos tool using createListSLOsTool(api) and addition to the tools array for registration with the MCP server.createListSLOsTool(api),
- src/tools/list-slos.ts:23-79 (helper)Factory function that creates the tool object including name, description, schema, and handler for list_slos.export function createListSLOsTool(api: HoneycombAPI) { return { name: "list_slos", description: "Lists available SLOs (Service Level Objectives) for a specific dataset. This tool returns a list of all SLOs available in the specified environment, including their names, descriptions, time periods, and target per million events expected to succeed. NOTE: __all__ is NOT supported as a dataset name -- it is not possible to list all SLOs in an environment.", schema: { environment: z.string().describe("The Honeycomb environment"), dataset: z.string().describe("The dataset to fetch SLOs from"), }, /** * Handler for the list_slos tool * * @param params - The parameters for the tool * @param params.environment - The Honeycomb environment * @param params.dataset - The dataset to fetch SLOs from * @returns Simplified list of SLOs with relevant metadata */ handler: async ({ environment, dataset }: z.infer<typeof DatasetArgumentsSchema>) => { // Validate input parameters if (!environment) { return handleToolError(new Error("environment parameter is required"), "list_slos"); } if (!dataset) { return handleToolError(new Error("dataset parameter is required"), "list_slos"); } try { // Fetch SLOs from the API const slos = await api.getSLOs(environment, dataset); // Simplify the response to reduce context window usage const simplifiedSLOs: SimplifiedSLO[] = slos.map(slo => ({ id: slo.id, name: slo.name, description: slo.description || '', time_period_days: slo.time_period_days, target_per_million: slo.target_per_million, })); return { content: [ { type: "text", text: JSON.stringify(simplifiedSLOs, null, 2), }, ], metadata: { count: simplifiedSLOs.length, dataset, environment } }; } catch (error) { return handleToolError(error, "list_slos"); } } }; }