Skip to main content
Glama
MIT License
27,120
19,789
  • Linux
  • Apple
validation.ts•449 B
import { z } from 'zod'; import { AppError } from './errorHandler.js'; export function validateRequest<T>(schema: z.ZodSchema<T>, data: unknown): T { try { return schema.parse(data); } catch (error) { if (error instanceof z.ZodError) { const messages = error.issues.map((issue) => `${issue.path.join('.')}: ${issue.message}`).join(', '); throw new AppError(`Invalid request: ${messages}`, 400); } throw 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/yamadashy/repomix'

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