export const mcpCallDependencyDeclarations = [
    {
        dependencyId: "runtime.execEngine.mcp.callTool",
        kind: "service",
        required: true,
        description: "Runtime-owned MCP client dispatch. BaseTool passes a normalized call request and never creates a hidden MCP client.",
    },
    {
        dependencyId: "runtime.governancePlane.mcpApproval",
        kind: "permission",
        required: true,
        description: "dryRun:false requires explicit guard/governance approval before invoking the runtime MCP provider.",
    },
    {
        dependencyId: "runtime.mcp.sessionTransport",
        kind: "runtime",
        required: true,
        description: "Connection, session, transport, OAuth, progress, and cancellation remain owned by runtime.",
    },
];
export function createHostExecutorMcpCallProvider(executor) {
    const callTool = executor?.mcp?.callTool;
    if (callTool === undefined)
        return undefined;
    return async (request, context) => {
        const result = await callTool({
            serverId: request.serverId,
            toolName: request.toolName,
            arguments: request.arguments,
            mode: request.mode,
            timeoutMs: request.timeoutMs,
            context,
        });
        if (!result.ok) {
            throw new Error(result.error.message);
        }
        return result.output;
    };
}
