/** * Result of verifying a single library recommendation against Context7 MCP. */ export interface VerificationResult { status: 'verified' | 'unverified' | 'unavailable'; libraryId?: string; documentationUrl?: string; version?: string; note?: string; } /** * Client interface for Context7 MCP integration. * Designed for easy mocking in tests — the real implementation calls * Context7 MCP tools (`resolve-library-id` and `query-docs`). * * Per Context7 best practices: * - resolveLibraryId accepts both query (for ranking) and libraryName * - getLibraryDocs accepts libraryId and query * - Implementations should handle 202 (processing), 301 (redirect), 429 (rate limit) */ export interface Context7Client { /** * Resolve a library name to a Context7-compatible library ID. * @param libraryName — the library to search for * @param query — the user's question/task (used by Context7 to rank results) * @returns library ID string, or null if not found */ resolveLibraryId(libraryName: string, query?: string): Promise; /** * Fetch documentation for a library by its Context7 ID. * @param libraryId — Context7-compatible library ID (e.g., "/vercel/next.js") * @param query — the question/task to get relevant docs for */ getLibraryDocs(libraryId: string, query: string): Promise<{ url: string; version: string; } | null>; } /** * Verify a single library recommendation against Context7 MCP. * * Flow: * 1. Call `resolveLibraryId` to get the canonical library ID. * - If it returns `null` → status "unverified" (library not found / 404). * - If it throws → retry with exponential backoff (handles 429, 202, 5xx). * - After max retries → status "unavailable". * 2. Call `getLibraryDocs` with the library ID and use case. * - If it returns docs → status "verified" with URL and version. * - If it returns `null` → status "unverified" (use case not confirmed). * - If it throws → retry with exponential backoff. * - After max retries → status "unavailable". */ export declare function verifyRecommendation(client: Context7Client, libraryName: string, useCase: string): Promise; /** * Item describing a library recommendation to verify. * The libraryName and useCase come from the AI agent's recommendation, * NOT from hardcoded catalog data. */ export interface VerificationItem { libraryName: string; useCase: string; } /** * Verify all library recommendations provided by the AI agent (or caller). * * Each item in the array corresponds to a detection by index. Items that are * `null` are skipped (detection had no recommendation from the agent). * * Processes each item independently — a failure for one library does * not affect others. Returns a Map keyed by detection index. */ export declare function verifyAllRecommendations(client: Context7Client, items: Array): Promise>; //# sourceMappingURL=context7.d.ts.map