progressive_bug_search
Search Cisco bug reports using multiple strategies, handling version variations and product IDs to find relevant issues efficiently.
Instructions
Automatically tries multiple search strategies, starting specific and broadening scope if needed. Handles version normalization and product ID variations.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| primary_search_term | Yes | Primary search term (product name, model, or keyword) | |
| version | No | Software version (will try multiple formats: 17.09.06 -> 17.09 -> 17) | |
| severity_range | No | Severity range to search (will search each level separately) | high |
| status | No | Bug status filter |
Implementation Reference
- src/apis/bug-api.ts:813-908 (handler)Main handler function that executes the progressive_bug_search tool. It generates multiple search variations for product IDs and versions, searches across severity levels, tracks progress, selects the best result, and returns it.private async executeProgressiveSearch(args: ToolArgs, meta?: { progressToken?: string }): Promise<BugApiResponse> { const primaryTerm = args.primary_search_term as string; const version = args.version as string; const severityRange = (args.severity_range as string) || 'high'; const status = args.status as string; logger.info('Starting progressive search', { primaryTerm, version, severityRange }); // Send initial progress const { sendProgress } = await import('../mcp-server.js'); // Build search variations const searchVariations = []; // Try product ID approach first const productVariations = this.normalizeProductId(primaryTerm); for (const product of productVariations) { if (version) { const versionVariations = this.normalizeVersion(version); for (const v of versionVariations) { searchVariations.push({ type: 'keyword', args: { keyword: `${product} ${v}`, status } }); } } searchVariations.push({ type: 'product_id', args: { base_pid: product, status } }); searchVariations.push({ type: 'keyword', args: { keyword: product, status } }); } // Try searches with different severity levels based on range const severityLevels = severityRange === 'high' ? ['1', '2', '3'] : severityRange === 'medium' ? ['3', '4'] : ['1', '2', '3', '4', '5', '6']; const totalAttempts = searchVariations.length * severityLevels.length; let currentAttempt = 0; let bestResult: BugApiResponse = { bugs: [], total_results: 0, page_index: 1 }; sendProgress(meta?.progressToken, 0, totalAttempts); for (const variation of searchVariations) { for (const severity of severityLevels) { currentAttempt++; sendProgress(meta?.progressToken, currentAttempt, totalAttempts); try { const searchArgs = { ...variation.args, severity }; let result: BugApiResponse; if (variation.type === 'keyword') { result = await this.executeTool('search_bugs_by_keyword', searchArgs); } else { result = await this.executeTool('search_bugs_by_product_id', searchArgs); } if (result.bugs && result.bugs.length > bestResult.bugs!.length) { bestResult = result; logger.info('Found better result in progressive search', { variation: variation.type, args: searchArgs, resultCount: result.bugs.length }); } // If we found results, we can be less aggressive about continuing if (result.bugs && result.bugs.length >= 5) { break; } } catch (error) { logger.warn('Progressive search variation failed', { variation, severity, error: error instanceof Error ? error.message : error }); } } if (bestResult.bugs && bestResult.bugs.length >= 10) { // Send completion progress before breaking sendProgress(meta?.progressToken, totalAttempts, totalAttempts); break; // Good enough result found } } // Ensure final progress is sent sendProgress(meta?.progressToken, totalAttempts, totalAttempts); return bestResult; }
- src/apis/bug-api.ts:474-502 (schema)Input schema and metadata definition for the progressive_bug_search tool, including name, title, description, and validation schema.name: 'progressive_bug_search', title: 'Progressive Bug Search', description: 'Automatically tries multiple search strategies, starting specific and broadening scope if needed. Handles version normalization and product ID variations.', inputSchema: { type: 'object', properties: { primary_search_term: { type: 'string', description: 'Primary search term (product name, model, or keyword)' }, version: { type: 'string', description: 'Software version (will try multiple formats: 17.09.06 -> 17.09 -> 17)' }, severity_range: { type: 'string', description: 'Severity range to search (will search each level separately)', enum: ['high', 'medium', 'all'], default: 'high' }, status: { type: 'string', description: 'Bug status filter', enum: ['O', 'F', 'T'] } }, required: ['primary_search_term'] } },
- src/apis/enhanced-analysis-api.ts:18-24 (registration)Registration of progressive_bug_search as an exposed tool in the EnhancedAnalysisApi by including it in the filter list of tools from the parent BugApi.'smart_search_strategy', 'progressive_bug_search', 'multi_severity_search', 'comprehensive_analysis', 'compare_software_versions', 'product_name_resolver' ];
- src/apis/bug-api.ts:702-703 (registration)Dispatch/registration in the executeTool switch statement that routes calls to the progressive_bug_search handler.case 'progressive_bug_search': return this.executeProgressiveSearch(processedArgs, meta);
- src/apis/bug-api.ts:28-58 (helper)Helper function to generate multiple normalized version variations for progressive searching, used within executeProgressiveSearch.private normalizeVersion(version: string): string[] { const versions = []; // Convert to Cisco API format first: 17.09.06 -> 17.9.6 (remove leading zeros) const ciscoFormat = this.normalizeVersionString(version); versions.push(ciscoFormat); // Also keep original version in case it's already in correct format if (ciscoFormat !== version) { versions.push(version); } // Create abbreviated versions: 17.09.06 -> 17.09 -> 17.9 if (version.includes('.')) { const parts = version.split('.'); if (parts.length >= 3) { const shortVersion = parts.slice(0, 2).join('.'); const shortCiscoFormat = this.normalizeVersionString(shortVersion); versions.push(shortCiscoFormat); if (shortCiscoFormat !== shortVersion) { versions.push(shortVersion); } } if (parts.length >= 2) { versions.push(parts[0]); } } // Remove duplicates and return return [...new Set(versions)]; }