Skip to main content
Glama

Qdrant Retrieve MCP Server

ContentSchemas.ts1.56 kB
import { z } from "zod"; /** * Schema for validating TextContent objects * Represents a text response from an MCP tool */ export const TextContentSchema = z.object({ type: z.literal("text"), text: z.string(), }); /** * Schema for validating ImageContent objects * Represents an image response from an MCP tool */ export const ImageContentSchema = z.object({ type: z.literal("image"), data: z.string(), mimeType: z.string(), }); /** * Creates a schema for validating JsonContent objects with a specific data type * Represents a JSON response from an MCP tool * * @param dataSchema - Zod schema for the data property * @returns A Zod schema for JsonContent with the specified data type */ export function createJsonContentSchema<T extends z.ZodTypeAny>(dataSchema: T) { return z.object({ type: z.literal("json"), data: dataSchema, }); } /** * Schema for validating arrays of content objects * This approach allows for mixed arrays containing any combination of * TextContent, ImageContent, and optionally JsonContent objects * * @param jsonDataSchema - Optional Zod schema for JSON data (if JsonContent is expected) * @returns A Zod schema for an array of content objects */ export function createContentArraySchema(jsonDataSchema?: z.ZodTypeAny) { // Create the array schema using discriminated union for type safety return z.array( z.discriminatedUnion("type", [ TextContentSchema, ImageContentSchema, ...(jsonDataSchema ? [createJsonContentSchema(jsonDataSchema)] : []), ]) ); }

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/gergelyszerovay/mcp-server-qdrant-retrive'

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