Skip to main content
Glama

MCP Documentation Server

by mahawi1992
validation.ts1.2 kB
import { Request, Response, NextFunction } from 'express'; import { ValidationError } from '../errors'; import { SearchParams, CodeAnalysisParams } from '../types'; export const validateSearch = (req: Request, res: Response, next: NextFunction) => { const params = req.body as SearchParams; if (!params.query) { throw new ValidationError('Search query is required'); } if (params.query.length < 2) { throw new ValidationError('Search query must be at least 2 characters'); } next(); }; export const validateAnalysis = (req: Request, res: Response, next: NextFunction) => { const params = req.body as CodeAnalysisParams; if (!params.code) { throw new ValidationError('Code is required'); } if (!params.language) { throw new ValidationError('Programming language is required'); } const supportedLanguages = ['javascript', 'typescript', 'python', 'java']; if (!supportedLanguages.includes(params.language.toLowerCase())) { throw new ValidationError( `Language ${params.language} is not supported. ` + `Supported languages: ${supportedLanguages.join(', ')}` ); } next(); };

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/mahawi1992/mcp-documentation-server'

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