Skip to main content
Glama

CodeAnalysis MCP Server

by 0xjcf
index.ts1.16 kB
/** * Validators for MCP Code Analysis system. * This file contains utility functions for validation of parameters, schemas, and other data. */ import { z } from 'zod'; /** * Validates parameters against a schema * @param parameters The parameters to validate * @param schema The schema to validate against (optional) * @returns Validated parameters or the original parameters if no schema * @throws {Error} If validation fails */ export function validateParameters( parameters: Record<string, unknown>, schema?: z.ZodObject<any> ): Record<string, unknown> { // If no schema, just return the parameters if (!schema) { return parameters; } try { // Parse and validate the parameters const validatedParams = schema.parse(parameters); return validatedParams; } catch (error) { if (error instanceof z.ZodError) { // Format the validation error const formattedErrors = error.errors.map(err => `${err.path.join('.')}: ${err.message}` ).join(', '); throw new Error(`Parameter validation failed: ${formattedErrors}`); } // Re-throw other errors 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/0xjcf/MCP_CodeAnalysis'

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