import type { InputRequiredResult } from '@modelcontextprotocol/server'; import type { UpstreamAuthRequiredEvent } from './upstream-auth.js'; import type { UpstreamApiAuth, UpstreamAuthScheme } from './upstream-auth-scheme.js'; import type { KvService } from '@redocly/config'; export declare const CREDENTIALS_INPUT_REQUEST_KEY = "credentials"; export type CredentialTarget = { api: string; name: string; scheme: string; schemeLabel?: string; acceptedSchemes?: string[]; }; /** * Why the prompt is being raised. `authFailure` is the automatic path behind an upstream 401; * `requested` is the model calling the credentials tool on the user's behalf. */ export type CredentialElicitationReason = { kind: 'authFailure'; status: number; detail?: string; otherApiNames?: string[]; } | { kind: 'requested'; }; type CredentialElicitationRequest = { subject: string; baseUrl: string; target: CredentialTarget; auth: UpstreamAuthScheme; apiAuth?: UpstreamApiAuth; kv: KvService; hasExistingSecret: boolean; reason: CredentialElicitationReason; }; type AcceptedLinkScope = { kv: KvService; subject: string; baseUrl: string; apis: readonly string[]; }; export type AcceptedCredentialsLink = { apiName: string; url: string; }; /** Concurrent prompts for one subject and scheme share the link the first one mints. */ export declare function dedupeElicitation(key: string, run: () => Promise): Promise; export declare function supportsUrlElicitation(capabilities: { elicitation?: { url?: unknown; }; } | undefined): boolean; /** Only a 2026-07-28-era request carries `_meta` envelope keys, and it needs no session. */ export declare function isStatelessRequest(mcpReq: { envelope?: unknown; }): boolean; /** How the user answered the credentials prompt, read from a retried request. */ export declare function credentialElicitationAnswer(inputResponses: Record | undefined): 'accepted' | 'declined' | undefined; export declare function buildCredentialsAcceptedHint(apiName: string, url?: string): string; export declare function acceptedCredentialsLink(requestState: unknown, { kv, subject, baseUrl, apis }: AcceptedLinkScope): Promise; export declare function schemeLabelOf(schemes: Record, scheme: string): string | undefined; /** * The 2026-07-28-era credentials prompt: the tool call returns an input-required result the * client fulfils and retries, with no push `elicitation/create` and no session behind it. * `requestState` carries the link token, so the retry after an accepted prompt can repeat the link. */ export declare function buildUpstreamCredentialInputRequired(request: CredentialElicitationRequest): Promise; /** Fallback text for a client without URL-elicitation support. */ export declare function buildUpstreamCredentialFallback(request: CredentialElicitationRequest): Promise; /** * Text for an authorization failure we deliberately do NOT prompt for: a stored secret the * upstream rejected, a 401 that never carried a stored credential, or a 403/407 that is more * likely a permissions problem than a missing key. */ export declare function buildCredentialsToolHint(event: UpstreamAuthRequiredEvent, schemeLabel?: string): string; export {}; //# sourceMappingURL=elicitation.d.ts.map