Skip to main content
Glama
error.ts869 B
import { ErrorCode, McpError } from "@modelcontextprotocol/sdk/types.js"; /** * Extract error message from any error type */ export function getErrorMessage(error: unknown): string { if (error instanceof Error) { return error.message; } return String(error); } /** * Log error with context */ export function logError(context: string, error: unknown) { console.error(`[Error] ${context}:`, error); if (error && typeof error === "object" && "serverError" in error) { console.error( "Server details:", (error as { serverError: unknown }).serverError ); } } /** * Create a standardized MCP error from any error */ export function createMcpError(context: string, error: unknown): McpError { logError(context, error); return new McpError( ErrorCode.InternalError, `Operation failed: ${getErrorMessage(error)}` ); }

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/mmruesch12/azdo-mcp'

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