/** * Programmatic API for mcpGraph * * This API can be used by: * - MCP server (main.ts) - for stdio transport * - UX applications - for HTTP/WebSocket servers * - Other applications - for programmatic graph execution */ import type { McpGraphConfig, ServerConfig, ToolDefinition } from './types/config.js'; import { type ValidationError } from './graph/validator.js'; import type { ExecutionOptions, ExecutionResult as CoreExecutionResult, ExecutionController, ExecutionState, NodeExecutionRecord } from './types/execution.js'; export type { NodeDefinition, McpGraphConfig } from './types/config.js'; export type { ExecutionOptions, ExecutionHooks, ExecutionController, ExecutionState, ExecutionStatus, NodeExecutionRecord, ExecutionTelemetry, } from './types/execution.js'; export { ToolCallMcpError, ToolCallError } from './errors/mcp-tool-error.js'; export interface ToolInfo { name: string; description: string; inputSchema: Record; outputSchema?: Record; } export interface ExecutionResult { result: unknown; structuredContent?: Record; executionHistory?: CoreExecutionResult['executionHistory']; telemetry?: CoreExecutionResult['telemetry']; logs?: CoreExecutionResult['logs']; } export declare class McpGraphApi { private config; private executor; private clientManager; private configPath; /** * Create a new McpGraphApi instance * @param configPath - Path to the YAML configuration file * @param mcpServersFromFile - Optional mcpServers loaded from an MCP JSON file * @throws Error if config cannot be loaded or validated */ constructor(configPath: string, mcpServersFromFile?: Record); /** * Get the server metadata * Title defaults to name if not provided (matching MCP SDK behavior) */ getServerInfo(): { name: string; version: string; title: string; instructions?: string; }; /** * List all available tools */ listTools(): ToolInfo[]; /** * Get information about a specific tool */ getTool(toolName: string): ToolInfo | undefined; /** * Execute a tool with the given arguments * Returns both the execution promise and the controller (if hooks/breakpoints are provided) */ executeTool(toolName: string, toolArguments?: Record, options?: ExecutionOptions): { promise: Promise; controller: ExecutionController | null; }; /** * Get the execution controller (available during execution with hooks/breakpoints) * @deprecated Use the controller returned from executeTool() instead */ getController(): ExecutionController | null; /** * Get the graph structure */ getGraph(): import("./graph/graph.js").Graph | null; /** * Get the current execution state (if execution is in progress) */ getExecutionState(): ExecutionState | null; /** * Get the context that was available to a specific execution (for debugging) * @param executionIndex - The execution index to get context for * @returns Context object that was available to that execution, or null if execution not found */ getContextForExecution(executionIndex: number): Record | null; /** * Get a specific execution record by index * @param executionIndex - The execution index * @returns Execution record or null if not found */ getExecutionByIndex(executionIndex: number): NodeExecutionRecord | null; /** * Get the full configuration */ getConfig(): McpGraphConfig; /** * Validate a configuration without creating an API instance */ static validateConfig(configPath: string): ValidationError[]; /** * Load and validate a configuration without creating an API instance */ static loadAndValidateConfig(configPath: string): { config: McpGraphConfig; errors: ValidationError[]; }; /** * Add a tool to the graph * @param tool - Tool definition to add * @throws Error if tool with same name already exists */ addTool(tool: ToolDefinition): void; /** * Update an existing tool in the graph * @param toolName - Name of the tool to update * @param tool - Updated tool definition * @throws Error if tool not found */ updateTool(toolName: string, tool: ToolDefinition): void; /** * Delete a tool from the graph * @param toolName - Name of the tool to delete * @throws Error if tool not found */ deleteTool(toolName: string): void; /** * Save the graph configuration to a file * @param filePath - Optional file path (defaults to original config path) */ save(filePath?: string): void; /** * Execute an inline tool definition without adding it to the graph * The tool runs in the graph context with access to graph's MCP servers and execution limits * @param toolDefinition - Tool definition to execute * @param toolArguments - Tool input arguments * @param options - Optional execution options * @returns Promise with execution result */ executeToolDefinition(toolDefinition: ToolDefinition, toolArguments?: Record, options?: ExecutionOptions): Promise; /** * Clean up resources (close MCP clients, etc.) */ close(): Promise; } //# sourceMappingURL=api.d.ts.map