list_recipients
Retrieve and filter notification recipients in a Honeycomb environment. This tool provides a detailed list of recipient names, types, targets, and metadata for effective notification management.
Instructions
Lists available recipients for notifications in a specific environment. This tool returns a list of all recipients available in the specified environment, including their names, types, targets, and metadata.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| environment | Yes | The Honeycomb environment | |
| limit | No | Number of items per page | |
| page | No | Page number (1-based) | |
| search | No | Search term to filter results | |
| search_fields | No | Fields to search in (string or array of strings) | |
| sort_by | No | Field to sort by | |
| sort_order | No | Sort direction |
Implementation Reference
- src/tools/list-recipients.ts:24-59 (handler)The handler function for the 'list_recipients' tool. It validates the 'environment' parameter, fetches recipients from the Honeycomb API, simplifies the response data, formats it as JSON text content with metadata, and handles errors using handleToolError.handler: async ({ environment }: z.infer<typeof ListRecipientsSchema>) => { // Validate input parameters if (!environment) { return handleToolError(new Error("environment parameter is required"), "list_recipients"); } try { // Fetch recipients from the API const recipients = await api.getRecipients(environment); // Create a simplified response const simplifiedRecipients = recipients.map(recipient => ({ id: recipient.id, name: recipient.name, type: recipient.type, target: recipient.target || '', created_at: recipient.created_at, updated_at: recipient.updated_at, })); return { content: [ { type: "text", text: JSON.stringify(simplifiedRecipients, null, 2), }, ], metadata: { count: simplifiedRecipients.length, environment } }; } catch (error) { return handleToolError(error, "list_recipients"); } }
- src/types/schema.ts:385-388 (schema)Zod schema defining input parameters for the list_recipients tool: required 'environment' string, optional pagination fields from PaginationSchema.export const ListRecipientsSchema = z.object({ environment: z.string().min(1).trim().describe("The Honeycomb environment"), }).merge(PaginationSchema).describe("Parameters for listing notification recipients in a Honeycomb environment. Recipients receive alerts from triggers.");
- src/tools/index.ts:43-43 (registration)Registration of the list_recipients tool: created via createListRecipientsTool(api) and added to the tools array in registerTools function, which iterates and registers each tool with the MCP server using server.tool().createListRecipientsTool(api),
- src/tools/index.ts:9-9 (registration)Import of the createListRecipientsTool function used to instantiate the tool.import { createListRecipientsTool } from "./list-recipients.js";
- src/tools/list-recipients.ts:12-61 (handler)The createListRecipientsTool factory function that returns the tool object with name, description, schema, and handler for 'list_recipients'. Note: name has typo 'list_recipient' without 's'? Wait, check: actually in code it's "list_recipients".export function createListRecipientsTool(api: HoneycombAPI) { return { name: "list_recipients", description: "Lists available recipients for notifications in a specific environment. This tool returns a list of all recipients available in the specified environment, including their names, types, targets, and metadata.", schema: ListRecipientsSchema.shape, /** * Handler for the list_recipients tool * * @param params - The parameters for the tool * @param params.environment - The Honeycomb environment * @returns List of recipients with relevant metadata */ handler: async ({ environment }: z.infer<typeof ListRecipientsSchema>) => { // Validate input parameters if (!environment) { return handleToolError(new Error("environment parameter is required"), "list_recipients"); } try { // Fetch recipients from the API const recipients = await api.getRecipients(environment); // Create a simplified response const simplifiedRecipients = recipients.map(recipient => ({ id: recipient.id, name: recipient.name, type: recipient.type, target: recipient.target || '', created_at: recipient.created_at, updated_at: recipient.updated_at, })); return { content: [ { type: "text", text: JSON.stringify(simplifiedRecipients, null, 2), }, ], metadata: { count: simplifiedRecipients.length, environment } }; } catch (error) { return handleToolError(error, "list_recipients"); } } }; }