/** * Elicit Helper * * Extracted helper function for performing elicitation from context classes. * This removes duplication between ToolContext and AgentContext. * * @module elicitation/helpers/elicit.helper */ import { type ZodType } from '@frontmcp/lazy-zod'; import { type FrontMcpContext } from '../../context'; import { type ClientCapabilities } from '../../notification'; import { type ElicitOptions, type ElicitResult } from '../elicitation.types'; /** * Transport interface for elicitation. * Matches the shape exposed by FrontMcpContext. */ export interface ElicitTransport { elicit(message: string, requestedSchema: S, options?: ElicitOptions): Promise ? O : unknown>>; } /** * Dependencies required by the elicit helper. */ export interface ElicitHelperDeps { /** Session ID for the current request */ sessionId: string | undefined; /** Function to get client capabilities for the session */ getClientCapabilities: (sessionId: string) => ClientCapabilities | undefined; /** Function to get the FrontMcpContext (may be unavailable) */ tryGetContext: () => FrontMcpContext | undefined; /** Entry name for fallback context (tool name or agent name) */ entryName: string; /** Entry input for fallback context (tool input or agent input) */ entryInput: unknown; /** * Whether elicitation is enabled in a server configuration. * When false, calls to elicit() will throw ElicitationDisabledError. * @default false */ elicitationEnabled?: boolean; } /** * Perform an elicitation request. * * This helper encapsulates the common elicitation logic shared between * ToolContext and AgentContext. * * @param deps - Dependencies for the elicitation * @param message - Message to display to the user * @param requestedSchema - Zod schema for the expected response * @param options - Elicitation options (mode, ttl, elicitationId) * @returns The elicitation result * * @throws {ElicitationDisabledError} If elicitation is disabled in server configuration * @throws {ElicitationNotSupportedError} If no session is available * @throws {ElicitationNotSupportedError} If transport is not available * @throws {ElicitationFallbackRequired} If client doesn't support elicitation (caught by flow) */ export declare function performElicit(deps: ElicitHelperDeps, message: string, requestedSchema: S, options?: ElicitOptions): Promise ? O : unknown>>; /** * Generate a unique elicitation ID using cryptographically strong UUID. * * @returns A unique elicitation ID */ export declare function generateElicitationId(): string; //# sourceMappingURL=elicit.helper.d.ts.map