import { BaseService, BaseServiceConfig } from './BaseService.js'; import '../utils/collector.js'; interface McpServiceConfig extends BaseServiceConfig { } /** * Calls the Coolhand server's `/mcp` endpoint, which speaks JSON-RPC 2.0. Used by coolhand-cli's * optimization commands (list-workloads, search/get/close/update-optimization) to invoke server-side * MCP tools. * * Unlike logging/feedback, this endpoint authenticates with the client's PRIVATE key (passed as the * `apiKey` config field and sent as `X-API-Key`), and it surfaces failures by THROWING rather than * returning `null`, so callers can show the error to the user. `dryRun: true` still applies here — * it skips the request and returns `null`, since some MCP tools (e.g. `close_optimization`) mutate * server state. */ declare class McpService extends BaseService { constructor(config: McpServiceConfig); /** * Invoke a server-side MCP tool by name and return its `result` payload. * * @param toolName The MCP tool to call (e.g. `"list_workloads"`). * @param args The tool arguments object, forwarded verbatim as JSON-RPC `params.arguments`. * @returns The JSON-RPC `result` field on success, or `null` in dry-run mode. * @throws Error on network failure, a non-JSON body, or a JSON-RPC `error`. A non-2xx response * throws an error whose `status` property holds the HTTP status code. */ mcpCall(toolName: string, args: Record): Promise; } export { McpService, type McpServiceConfig };