Skip to main content
Glama

hny-mcp

by honeycombio
MIT License
2
36
  • Linux
  • Apple
tool-error.ts1.77 kB
import { HoneycombError } from "./errors.js"; import { z } from "zod"; /** * Handles errors from tool execution and returns a formatted error response */ export async function handleToolError( error: unknown, toolName: string, options: { suppressConsole?: boolean; environment?: string; dataset?: string; } = {} ): Promise<{ content: { type: "text"; text: string }[]; error: { message: string; }; }> { let errorMessage = "Unknown error occurred"; let suggestions: string[] = []; if (error instanceof HoneycombError) { // Use the enhanced error message system errorMessage = error.getFormattedMessage(); } else if (error instanceof z.ZodError) { // For Zod validation errors, create a validation error with context const validationError = HoneycombError.createValidationError( error.errors.map(err => err.message).join(", "), { environment: options.environment, dataset: options.dataset } ); errorMessage = validationError.getFormattedMessage(); } else if (error instanceof Error) { errorMessage = error.message; } // Log the error to stderr for debugging, unless suppressed if (!options.suppressConsole) { console.error(`Tool '${toolName}' failed:`, error); } let helpText = `Failed to execute tool '${toolName}': ${errorMessage}\n\n` + `Please verify:\n` + `- The environment name is correct and configured via HONEYCOMB_API_KEY or HONEYCOMB_ENV_*_API_KEY\n` + `- Your API key is valid\n` + `- The dataset exists and you have access to it\n` + `- Your query parameters are valid\n`; return { content: [ { type: "text", text: helpText, }, ], error: { message: errorMessage } }; }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/honeycombio/honeycomb-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server