/** * Invoke one tool on one upstream MCP server (DES-MCP-TOOLS-001 ยง6 step 6). * * - One connection per call: connect, `tools/call`, close. The upstream is reached exactly as the * registry's probe reaches it (`transportFor`: the SDK's safe env for stdio plus the ONE variable * the secret is injected into, or the one auth header for http), so the secret is resolved and * injected here and nowhere else. * - Bounded: connect and call share one deadline; a hung upstream is closed and the call fails * with the error class `timeout`. * - Every failure is classified ({@link classifyUpstreamError}) so the broker can decide whether a * retry is allowed (step 7: transport errors, 429 and 5xx only) and what the call record says. * * A `rest` upstream is not an MCP server: its tools are single HTTP requests (`rest.ts`). * * The result is returned RAW: the broker scrubs it (D-2) before anything else sees it. */ import type { McpRestMapping } from '../core/types.js'; import { type McpUpstreamConfig } from './probe.js'; import { UpstreamCallError } from './upstream-error.js'; /** The default per-call deadline (connect + call). */ export declare const MCP_CALL_TIMEOUT_MS = 30000; export { UpstreamCallError, type UpstreamErrorClass } from './upstream-error.js'; /** A `tools/call` result as the upstream sent it (`content`, `structuredContent?`, `isError?`, ...). */ export type UpstreamToolResult = Record; export type Invoker = (config: McpUpstreamConfig, secret: string | null, tool: string, args: Record, timeoutMs: number, /** A `rest` tool's request mapping (slice S5a); `null` for an MCP server's tool. */ rest?: McpRestMapping | null) => Promise; /** * Classify a failure: transport errors (the connection could not be made or closed under the * call), HTTP 429 and 5xx are retryable; a timeout, any other HTTP status and a JSON-RPC error the * server answered are not. */ export declare function classifyUpstreamError(err: unknown): UpstreamCallError; /** The real invoker. */ export declare const invokeMcpTool: Invoker; //# sourceMappingURL=invoke.d.ts.map