import { type McpToolAuditEvent, type McpToolResult } from "../../_shared/baseToolAdapter.js";
export type McpToolRegistryBoundary = "input" | "context" | "contract" | "permission" | "scope" | "governance" | "provider";
export type McpToolRegistryPermission = "mcp:tool:read" | "mcp:tool:write";
export type McpToolRegistryContext = {
    runtimeId?: string;
    sessionId?: string;
    invocationId?: string;
    dryRun?: boolean;
    guard?: {
        accepted?: boolean;
        allowed?: boolean;
        reason?: string;
    };
    contract?: {
        accepted?: boolean;
        reason?: string;
    };
    governance?: {
        accepted?: boolean;
        reason?: string;
    };
    serverId?: string;
    allowedServerIds?: readonly string[];
    requestedScopes?: readonly string[];
    allowedScopes?: readonly string[];
    grantedPermissions?: readonly McpToolRegistryPermission[];
    auditMetadata?: Readonly<Record<string, unknown>>;
};
export type McpToolDefinition = {
    name: string;
    description?: string;
    inputSchema?: Readonly<Record<string, unknown>>;
    outputSchema?: Readonly<Record<string, unknown>>;
    metadata?: Readonly<Record<string, unknown>>;
};
export type RegisterMcpToolTarget = {
    serverId: string;
    tool: McpToolDefinition;
    replaceExisting?: boolean;
};
export type RegisterMcpToolRequest = {
    target?: {
        serverId?: unknown;
        tool?: unknown;
        replaceExisting?: unknown;
    } | null;
    context?: McpToolRegistryContext;
};
export type RegisterMcpToolProviderRequest = RegisterMcpToolTarget;
export type RegisterMcpToolProviderResult = {
    name?: string;
    status: "registered" | "already_exists" | "pending";
    providerMetadata?: Readonly<Record<string, unknown>>;
    raw?: unknown;
};
export type RegisterMcpToolProvider = (request: RegisterMcpToolProviderRequest, context: Readonly<Record<string, unknown>>) => Promise<RegisterMcpToolProviderResult> | RegisterMcpToolProviderResult;
export type RegisterMcpToolEnvelope = {
    toolName: string;
    state: "planned" | "registered" | "already_exists" | "pending";
    replaceExisting: boolean;
    source: "mockable-envelope" | "runtime-provider";
};
export type RegisterMcpToolOutput = {
    kind: "agentCore.basicTool.mcp.registerTool";
    target: RegisterMcpToolTarget;
    dryRun: boolean;
    executionBlocked: boolean;
    providerCalled: boolean;
    permissionsRequired: readonly McpToolRegistryPermission[];
    unsafeSideEffects: true;
    acceptedScopes: readonly string[];
    registryEnvelope: RegisterMcpToolEnvelope;
    providerMetadata?: Readonly<Record<string, unknown>>;
};
export type McpToolRegistryErrorCode = "INVALID_REQUEST" | "INVALID_CONTEXT" | "MISSING_SERVER_ID" | "INVALID_SERVER_ID" | "MISSING_TOOL_NAME" | "MISSING_TOOL_DEFINITION" | "MISSING_UPDATE_PATCH" | "INVALID_TOOL_DEFINITION" | "INVALID_UPDATE_PATCH" | "SCOPE_REJECTED" | "PERMISSION_DENIED" | "CONTRACT_REJECTED" | "GOVERNANCE_REJECTED" | "REAL_EXECUTION_BLOCKED" | "PROVIDER_UNAVAILABLE" | "PROVIDER_REJECTED";
export type McpToolRegistryResult<Output> = McpToolResult<Output, McpToolRegistryErrorCode>;
export type RegisterMcpToolResult = McpToolRegistryResult<RegisterMcpToolOutput>;
export declare const mcpRegisterToolDescriptor: {
    readonly toolId: "mcp.registerTool";
    readonly capability: "register-mcp-tool";
    readonly route: "agent_executionEngine.basic_toolLayer.baseTools.mcpBase.tool";
    readonly permissionsRequired: readonly ["mcp:tool:read", "mcp:tool:write"];
    readonly defaultDryRun: true;
    readonly unsafeSideEffects: true;
    readonly tapOwnsApproval: true;
    readonly runtimeOwnsMcpClient: true;
    readonly providerBoundary: "BaseToolExecutorPort.mcp.registerTool";
};
type EarlyFailure<Output> = Extract<McpToolRegistryResult<Output>, {
    ok: false;
}>;
export declare function cleanMcpToolList<T extends string>(values: readonly T[] | undefined): readonly T[];
export declare function isBlankMcpToolValue(value: string | undefined): boolean;
export declare function mcpToolDryRunEnabled(context: McpToolRegistryContext | undefined): boolean;
export declare function createMcpToolRegistryAuditEvent(toolId: string, type: string, context: McpToolRegistryContext | undefined, serverId?: string, metadata?: Readonly<Record<string, unknown>>): McpToolAuditEvent;
export declare function createMcpToolRegistryFailure<Output>(toolId: string, code: McpToolRegistryErrorCode, message: string, boundary: McpToolRegistryBoundary, context: McpToolRegistryContext | undefined, serverId?: string, event?: string): EarlyFailure<Output>;
export declare function normalizeMcpServerId(toolId: string, serverId: unknown, context: McpToolRegistryContext | undefined): string | EarlyFailure<never>;
export declare function normalizeMcpToolName(toolId: string, name: unknown, context: McpToolRegistryContext | undefined, serverId: string): string | EarlyFailure<never>;
export declare function normalizeMcpToolDefinition(toolId: string, tool: unknown, context: McpToolRegistryContext | undefined, serverId: string): McpToolDefinition | EarlyFailure<never>;
export declare function ensureMcpToolRegistryScope<Output>(toolId: string, serverId: string, context: McpToolRegistryContext | undefined): EarlyFailure<Output> | undefined;
export declare function ensureMcpToolRegistryPermissions<Output>(toolId: string, permissionsRequired: readonly McpToolRegistryPermission[], context: McpToolRegistryContext | undefined, serverId: string): EarlyFailure<Output> | undefined;
export declare function blockMcpToolRegistryRealExecution<Output>(toolId: string, context: McpToolRegistryContext | undefined, serverId: string): EarlyFailure<Output> | undefined;
export declare function policyFailure<Output>(toolId: string, context: McpToolRegistryContext, serverId: string): EarlyFailure<Output> | undefined;
export declare function planMcpToolRegistration(request?: unknown): RegisterMcpToolResult;
export declare function executeMcpToolRegistration(request?: unknown, provider?: RegisterMcpToolProvider): Promise<RegisterMcpToolResult>;
export {};
