Skip to main content
Glama

Promptopia MCP

by lumile
MIT License
18
2
error-handler.ts927 B
import { McpError } from '@modelcontextprotocol/sdk/types.js' export class PromptNotFoundError extends Error { constructor(promptId: string) { super(`Prompt not found: ${promptId}`) this.name = 'PromptNotFoundError' } } export class ValidationError extends Error { constructor(message: string) { super(message) this.name = 'ValidationError' } } export function handleServiceError(error: unknown): McpError { if (error instanceof McpError) { return error } if (error instanceof PromptNotFoundError) { return new McpError( 404, error.message ) } if (error instanceof ValidationError) { return new McpError( 400, error.message ) } // Default case for unknown errors console.error('Unexpected error:', error) return new McpError( 500, `An unexpected error occurred: ${error instanceof Error ? error.message : String(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/lumile/promptopia-mcp'

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