/**
 * MCP (Model Context Protocol) type definitions.
 *
 * Internal types for Flynn's MCP client integration.
 * These wrap the SDK types into simpler forms used by the bridge and manager.
 */

/** Configuration for a single MCP server from flynn.yaml. */
export interface McpServerConfig {
  /** Unique name for this server (used as tool name prefix). */
  name: string;
  /** Executable command to spawn the server process. */
  command: string;
  /** Arguments passed to the command. */
  args: string[];
  /** Optional environment variables for the server process. */
  env?: Record<string, string>;
  /** Optional working directory for the server process. */
  cwd?: string;
}

/** Connection status of an MCP server. */
export type McpServerStatus = 'disconnected' | 'connecting' | 'connected' | 'error';

/** Information about a tool discovered from an MCP server. */
export interface McpToolInfo {
  /** Tool name as reported by the MCP server. */
  name: string;
  /** Human-readable description. */
  description: string;
  /** JSON Schema for the tool's input parameters. */
  inputSchema: {
    type: 'object';
    properties?: Record<string, unknown>;
    required?: string[];
  };
}

/** Runtime state of a connected MCP server. */
export interface McpServerState {
  /** Config this server was started from. */
  config: McpServerConfig;
  /** Current connection status. */
  status: McpServerStatus;
  /** Tools discovered from this server. */
  tools: McpToolInfo[];
  /** Error message if status is 'error'. */
  error?: string;
}
