Skip to main content
Glama

Sentry MCP

Official
by getsentry
chat-error-handler.ts1.63 kB
/** * Simplified chat error handling utilities * Only handles two concerns: auth errors vs other errors */ /** * Check if an error is authentication-related (401) */ export function isAuthError(error: Error): boolean { const message = error.message.toLowerCase(); // Check for 401 status code or auth-related keywords return ( message.includes("401") || message.includes("auth_expired") || message.includes("invalid_token") || message.includes("session has expired") || message.includes("unauthorized") ); } /** * Extract a user-friendly error message from the error */ export function getErrorMessage(error: Error): string { try { // Try to parse JSON error response const jsonMatch = error.message.match(/\{.*\}/); if (jsonMatch) { const data = JSON.parse(jsonMatch[0]); if (data.error) { return data.error; } } } catch { // Ignore JSON parse errors } // Check for specific error types if (isAuthError(error)) { return "Your session has expired. Please log in again."; } if ( error.message.includes("429") || error.message.toLowerCase().includes("rate_limit") ) { return "You've sent too many messages. Please wait a moment before trying again."; } if ( error.message.includes("403") || error.message.toLowerCase().includes("permission") ) { return "You don't have permission to access this organization."; } if (error.message.includes("500")) { return "Something went wrong on our end. Please try again."; } // Default message return "An error occurred. Please try again."; }

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/getsentry/sentry-mcp'

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