/**
 * MCP Adapter types and interfaces.
 *
 * Defines the contract between MCP servers and the Tool Registry.
 */
import type { ToolCategory, PermissionLevel } from "../agent/tools2/types.js";
import type { z } from "zod";
/**
 * JSON Schema type (subset used by MCP).
 *
 * Represents the JSON Schema structures commonly used in MCP tool definitions.
 */
export interface JsonSchema {
    type?: string | string[];
    properties?: Record<string, JsonSchema>;
    required?: string[];
    items?: JsonSchema;
    enum?: unknown[];
    const?: unknown;
    description?: string;
    default?: unknown;
    minimum?: number;
    maximum?: number;
    minLength?: number;
    maxLength?: number;
    pattern?: string;
    additionalProperties?: boolean | JsonSchema;
    oneOf?: JsonSchema[];
    anyOf?: JsonSchema[];
    allOf?: JsonSchema[];
}
/**
 * MCP tool definition as returned by the MCP server.
 */
export interface McpToolDefinition {
    /** Tool name */
    name: string;
    /** Human-readable description */
    description?: string;
    /** JSON Schema for input validation */
    inputSchema?: JsonSchema;
}
/**
 * Configuration for an MCP server connection.
 */
export interface McpServerConfig {
    /** Unique identifier for this server (used for tool prefixing) */
    name: string;
    /** Server URL for JSON-RPC communication */
    url: string;
    /** Tool category for all tools from this server */
    category: ToolCategory;
    /** Default permission level for tools from this server */
    defaultPermission: PermissionLevel;
    /** Optional: Override Zod schemas for specific tools */
    schemaOverrides?: Record<string, z.ZodTypeAny>;
    /** Optional: Whether to convert JSON Schema to Zod (default: true) */
    convertSchemas?: boolean;
    /** Optional: Custom tool name transformer */
    toolNameTransform?: (serverName: string, toolName: string) => string;
    /** Optional: Whether to skip output limit for this tool */
    skipOutputLimit?: (toolName: string) => (output: unknown) => boolean;
    /** Optional: Custom function to transform output for the model */
    toModelOutput?: (toolName: string) => (output: unknown) => any;
}
/**
 * State of an MCP server connection.
 */
export type McpServerState = {
    status: "disconnected";
} | {
    status: "connecting";
} | {
    status: "connected";
    toolCount: number;
} | {
    status: "error";
    error: Error;
};
/**
 * Interface for MCP clients that can be adapted.
 *
 * This interface defines the contract that MCP clients must implement
 * to be usable with the McpToolAdapter.
 */
export interface McpClientInterface {
    /** Connect to the server */
    connect(): Promise<void>;
    /** Disconnect from the server */
    disconnect(): Promise<void>;
    /** Check connection status */
    isConnected(): boolean;
    /** Get tool definitions including schemas */
    getToolDefinitions(): McpToolDefinition[];
    /** Call a tool with arguments */
    callTool(name: string, args: unknown): Promise<unknown>;
}
//# sourceMappingURL=types.d.ts.map