search_gpu
Search for graphics cards by chipset model, VRAM capacity, and price to find suitable GPUs for gaming, content creation, or AI workloads.
Instructions
Specialized graphics card (VGA) search tool. Find GPUs by chipset model, VRAM capacity, and price. Perfect for gaming builds, content creation, or AI workloads.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chipset | No | GPU chipset model. NVIDIA examples: 'RTX 4090', 'RTX 4070', 'RTX 4060', 'RTX 3060'. AMD examples: 'RX 7900', 'RX 7600'. Intel: 'Arc B580', 'Arc B570' | |
| memory | No | Video memory (VRAM) capacity in GB. Common values: 8, 12, 16, 24. Example: 12 for 12GB VRAM cards suitable for 1440p gaming | |
| sort_by | No | Price sorting order. 'price_asc' = cheapest first (value gaming), 'price_desc' = most expensive first (premium performance) | |
| limit | No | Maximum results to return. Valid range: 1-50, default: 10. Higher values show more brand/model variations |
Implementation Reference
- src/index.ts:432-535 (handler)The main handler function that implements the logic for the 'search_gpu' tool. It filters products in the GPU category based on chipset, memory (VRAM), sorts by price if specified, limits results, and returns JSON-formatted results.private searchGPU(args: any) { const { chipset, memory, sort_by, limit = 10 } = args; const results: any[] = []; // Find GPU category const gpuCategory = this.productData.find(cat => cat.category_name.includes('顯示卡') || cat.category_name.includes('VGA') ); if (!gpuCategory) { return { content: [ { type: "text", text: JSON.stringify({ error: "GPU category not found", results: [] }, null, 2), }, ], }; } // Search through all GPU subcategories for (const subcat of gpuCategory.subcategories) { for (const product of subcat.products) { let matches = true; // Filter by chipset if specified if (chipset && matches) { const chipsetLower = chipset.toLowerCase(); const subcatLower = subcat.name.toLowerCase(); const specsText = product.specs.join(' ').toLowerCase(); const modelLower = product.model?.toLowerCase() || ''; const rawTextLower = product.raw_text.toLowerCase(); if (!subcatLower.includes(chipsetLower) && !specsText.includes(chipsetLower) && !modelLower.includes(chipsetLower) && !rawTextLower.includes(chipsetLower)) { matches = false; } } // Filter by memory if specified if (memory && matches) { const memPattern = new RegExp(`${memory}G(?:B)?`, 'i'); const specsText = product.specs.join(' '); const hasMemory = memPattern.test(specsText) || memPattern.test(product.raw_text) || memPattern.test(product.model || ''); if (!hasMemory) { matches = false; } } if (matches) { results.push({ ...product, category_name: gpuCategory.category_name, subcategory_name: subcat.name, }); } } } // Sort results if (sort_by === 'price_asc') { results.sort((a, b) => a.price - b.price); } else if (sort_by === 'price_desc') { results.sort((a, b) => b.price - a.price); } // Apply limit const limitedResults = results.slice(0, limit); return { content: [ { type: "text", text: JSON.stringify({ total_found: results.length, showing: limitedResults.length, filters: { chipset: chipset || "any", memory: memory || "any", sort_by: sort_by || "none" }, results: limitedResults.map(p => ({ brand: p.brand, model: p.model, specs: p.specs, price: p.price, original_price: p.original_price, discount_amount: p.discount_amount, subcategory: p.subcategory_name, markers: p.markers, })), }, null, 2), }, ], }; }
- src/index.ts:142-166 (schema)The input schema definition for the search_gpu tool, including parameters for chipset, memory, sorting, and limit, along with description.name: "search_gpu", description: "Specialized graphics card (VGA) search tool. Find GPUs by chipset model, VRAM capacity, and price. Perfect for gaming builds, content creation, or AI workloads.", inputSchema: { type: "object", properties: { chipset: { type: "string", description: "GPU chipset model. NVIDIA examples: 'RTX 4090', 'RTX 4070', 'RTX 4060', 'RTX 3060'. AMD examples: 'RX 7900', 'RX 7600'. Intel: 'Arc B580', 'Arc B570'", }, memory: { type: "number", description: "Video memory (VRAM) capacity in GB. Common values: 8, 12, 16, 24. Example: 12 for 12GB VRAM cards suitable for 1440p gaming", }, sort_by: { type: "string", enum: ["price_asc", "price_desc"], description: "Price sorting order. 'price_asc' = cheapest first (value gaming), 'price_desc' = most expensive first (premium performance)", }, limit: { type: "number", description: "Maximum results to return. Valid range: 1-50, default: 10. Higher values show more brand/model variations", }, }, }, },
- src/index.ts:309-310 (registration)The dispatch case in the CallToolRequestSchema handler that routes calls to the search_gpu tool to the searchGPU method.case "search_gpu": return this.searchGPU(args);