UNPKG

@toolbox-sdk/core

Version:
96 lines (95 loc) 3.09 kB
import { z, ZodRawShape, ZodObject } from 'zod'; export declare enum Protocol { MCP_v20241105 = "2024-11-05", MCP_v20250326 = "2025-03-26", MCP_v20250618 = "2025-06-18", MCP_v20251125 = "2025-11-25", MCP_v20260728 = "2026-07-28", MCP_DRAFT_2026_v1 = "2026-07-28", MCP = "2026-07-28", MCP_LATEST = "2026-07-28", MCP_DRAFT = "2026-07-28" } export declare const MCP_LATEST = Protocol.MCP_v20260728; export declare function getSupportedMcpVersions(): Protocol[]; export declare function isVersionAtLeast(currentVersion: string, minVersion: string): boolean; interface StringType { type: 'string'; } interface IntegerType { type: 'integer'; } interface FloatType { type: 'float'; } interface NumberType { type: 'number'; } interface BooleanType { type: 'boolean'; } export type PrimitiveTypeSchema = StringType | IntegerType | FloatType | NumberType | BooleanType; interface ArrayType { type: 'array'; items?: TypeSchema; } interface ObjectType { type: 'object'; additionalProperties?: boolean | PrimitiveTypeSchema; } export type TypeSchema = PrimitiveTypeSchema | ArrayType | ObjectType; interface BaseParameter { name: string; description: string; authSources?: string[]; required?: boolean; default?: unknown; } export type ParameterSchema = BaseParameter & TypeSchema; export declare const ZodParameterSchema: z.ZodType<ParameterSchema>; export declare const ZodToolSchema: z.ZodObject<{ description: z.ZodString; parameters: z.ZodArray<z.ZodType<ParameterSchema, z.ZodTypeDef, ParameterSchema>, "many">; authRequired: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; }, "strip", z.ZodTypeAny, { description: string; parameters: ParameterSchema[]; authRequired?: string[] | undefined; }, { description: string; parameters: ParameterSchema[]; authRequired?: string[] | undefined; }>; export declare const ZodManifestSchema: z.ZodObject<{ serverVersion: z.ZodString; tools: z.ZodRecord<z.ZodString, z.ZodObject<{ description: z.ZodString; parameters: z.ZodArray<z.ZodType<ParameterSchema, z.ZodTypeDef, ParameterSchema>, "many">; authRequired: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; }, "strip", z.ZodTypeAny, { description: string; parameters: ParameterSchema[]; authRequired?: string[] | undefined; }, { description: string; parameters: ParameterSchema[]; authRequired?: string[] | undefined; }>>; }, "strip", z.ZodTypeAny, { serverVersion: string; tools: Record<string, { description: string; parameters: ParameterSchema[]; authRequired?: string[] | undefined; }>; }, { serverVersion: string; tools: Record<string, { description: string; parameters: ParameterSchema[]; authRequired?: string[] | undefined; }>; }>; export type ZodManifest = z.infer<typeof ZodManifestSchema>; export declare function createZodSchemaFromParams(params: ParameterSchema[]): ZodObject<ZodRawShape>; export {};