/** * MCP Contracts * * Zod schemas for MCP-specific types, built on top of @revealui/contracts. * These provide runtime validation for MCP request/response payloads * and bridge MCP SDK tool definitions to contracts ToolDefinition. */ import { type A2AAgentCard, type A2AAuth, type AgentDefinition, type ToolDefinition, z } from '@revealui/contracts'; /** * Schema for MCP request options (idempotency, retry, dry-run) */ export declare const MCPRequestOptionsSchema: z.ZodObject<{ timeout: z.ZodOptional; retries: z.ZodOptional; dryRun: z.ZodOptional; idempotencyKey: z.ZodOptional; idempotencyTTL: z.ZodOptional; }, z.core.$strip>; export type MCPRequestOptions = z.infer; /** * Schema for an MCP request payload */ export declare const MCPRequestSchema: z.ZodObject<{ action: z.ZodString; parameters: z.ZodOptional>; options: z.ZodOptional; retries: z.ZodOptional; dryRun: z.ZodOptional; idempotencyKey: z.ZodOptional; idempotencyTTL: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>; export type MCPRequest = z.infer; /** * Schema for MCP response metadata */ export declare const MCPResponseMetadataSchema: z.ZodObject<{ duration: z.ZodNumber; retries: z.ZodNumber; service: z.ZodString; cached: z.ZodOptional; idempotencyKey: z.ZodOptional; }, z.core.$strip>; export type MCPResponseMetadata = z.infer; /** * Schema for an MCP response payload */ export declare const MCPResponseSchema: z.ZodObject<{ success: z.ZodBoolean; data: z.ZodOptional; error: z.ZodOptional; metadata: z.ZodOptional; idempotencyKey: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>; export type MCPResponse = z.infer; /** * Schema for MCP adapter configuration */ export declare const MCPAdapterConfigSchema: z.ZodObject<{ apiKey: z.ZodOptional; baseUrl: z.ZodOptional; timeout: z.ZodOptional; retries: z.ZodOptional; environment: z.ZodOptional>; }, z.core.$strip>; export type MCPAdapterConfig = z.infer; /** * Converts an MCP SDK tool definition (JSON Schema-based) to a contracts ToolDefinition. * * The MCP SDK uses JSON Schema for tool `inputSchema`, while contracts uses * a structured ToolParameter format. This bridge maps between them. */ export declare function mcpToolToContractsToolDefinition(mcpTool: { name: string; description?: string; inputSchema?: { type: string; properties?: Record; required?: string[]; }; }): ToolDefinition; /** * Converts a contracts ToolDefinition back to an MCP SDK-compatible tool shape. * Useful for registering contracts-defined tools with MCP servers. */ export declare function contractsToolDefinitionToMcpTool(tool: ToolDefinition): { name: string; description: string; inputSchema: { type: 'object'; properties: Record; required: string[]; }; }; /** * Converts a RevealUI AgentDefinition to a Google A2A AgentCard. * Wraps the contracts-level `agentDefinitionToCard` with optional MCP-specific overrides. * * @param agent - The agent definition (source of truth) * @param baseUrl - The server base URL (e.g. https://api.revealui.com) * @param opts - Optional overrides for auth scheme and streaming capability */ export declare function agentDefinitionToAgentCard(agent: AgentDefinition, baseUrl: string, opts?: { authScheme?: A2AAuth; streaming?: boolean; }): A2AAgentCard; /** * Converts all tools in a RevealUI AgentDefinition to MCP tool specs. * Uses `contractsToolDefinitionToMcpTool` for each tool. */ export declare function agentDefinitionToMcpTools(agent: AgentDefinition): ReturnType[]; /** Common output schemas that tools can reference for response validation */ export declare const ToolOutputSchemas: { /** List response with pagination */ readonly paginatedList: z.ZodObject<{ items: z.ZodArray; total: z.ZodOptional; page: z.ZodOptional; limit: z.ZodOptional; }, z.core.$strip>; /** Single entity response */ readonly entity: z.ZodObject<{ id: z.ZodString; data: z.ZodRecord; }, z.core.$strip>; /** Status response */ readonly status: z.ZodObject<{ success: z.ZodBoolean; message: z.ZodOptional; }, z.core.$strip>; /** Error detail */ readonly errorDetail: z.ZodObject<{ code: z.ZodString; message: z.ZodString; details: z.ZodOptional; }, z.core.$strip>; }; export type ToolOutputSchemaName = keyof typeof ToolOutputSchemas; /** * Validate tool output data against one of the common output schemas. * Returns `{ valid: true }` on success, or `{ valid: false, errors }` with * human-readable Zod issue descriptions on failure. */ export declare function validateToolOutput(data: unknown, schemaName: ToolOutputSchemaName): { valid: boolean; errors?: string[]; }; //# sourceMappingURL=contracts.d.ts.map