Skip to main content
Glama

DSP Booking MCP Server

by hrz8
json-schema.ts1.41 kB
import zodToJsonSchema from 'zod-to-json-schema'; export function zodToMcpJsonSchema(zodSchema: any): { [x: string]: unknown; type: 'object'; required?: string[] | undefined; properties?: { [x: string]: unknown; } | undefined; } { const jsonSchema = zodToJsonSchema(zodSchema); if (typeof jsonSchema === 'object' && jsonSchema !== null && 'type' in jsonSchema) { if (jsonSchema.type === 'object') { return jsonSchema as { [x: string]: unknown; type: 'object'; required?: string[] | undefined; properties?: { [x: string]: unknown; } | undefined; }; } } return { type: 'object' as const, properties: { value: jsonSchema, }, required: ['value'], }; } export function jsonSchemaToPromptArguments( jsonSchema: ReturnType<typeof zodToMcpJsonSchema>, ): Array<{ name: string; description: string; required: boolean; }> { const args: Array<{ name: string; description: string; required: boolean; }> = []; if (jsonSchema.type === 'object' && jsonSchema.properties) { const requiredFields = new Set(jsonSchema.required || []); for (const [key, property] of Object.entries(jsonSchema.properties)) { const prop = property as any; args.push({ name: key, description: prop.description || '', required: requiredFields.has(key), }); } } return args; }

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/hrz8/mcp-openapi'

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