search_ram
Find compatible RAM for desktop or laptop upgrades by specifying DDR generation, capacity, speed, and price. Sort results by budget or premium options, and filter by maximum results for tailored choices.
Instructions
Specialized memory (RAM) search tool. Find desktop or laptop memory by DDR generation, total capacity, speed, and price. Essential for system upgrades or new builds.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| capacity | No | Total memory capacity in GB. Common values: 8, 16, 32, 64. Example: 32 for 32GB total (can be 2x16GB or 4x8GB kit) | |
| frequency | No | Memory speed in MHz. DDR4 common: 3200, 3600. DDR5 common: 4800, 5600, 6000. Higher = better performance | |
| limit | No | Maximum results to return. Valid range: 1-50, default: 10. More results = more brand choices | |
| sort_by | No | Price sorting order. 'price_asc' = budget options first, 'price_desc' = premium/performance kits first | |
| type | No | RAM generation/type. Options: 'DDR4' (older systems, cheaper), 'DDR5' (newest, faster). Must match motherboard compatibility |
Implementation Reference
- src/index.ts:537-651 (handler)The handler function implementing the core logic for the 'search_ram' tool. It searches the product data for RAM matching the provided type (DDR4/DDR5), capacity (GB), frequency (MHz), applies sorting and limits the results, then returns formatted JSON.private searchRAM(args: any) { const { type, capacity, frequency, sort_by, limit = 10 } = args; const results: any[] = []; // Find RAM category const ramCategory = this.productData.find(cat => cat.category_name.includes('記憶體') || cat.category_name.includes('RAM') ); if (!ramCategory) { return { content: [ { type: "text", text: JSON.stringify({ error: "RAM category not found", results: [] }, null, 2), }, ], }; } // Search through all RAM subcategories for (const subcat of ramCategory.subcategories) { for (const product of subcat.products) { let matches = true; // Filter by type if specified (DDR4, DDR5) if (type && matches) { const typeLower = type.toLowerCase(); const subcatLower = subcat.name.toLowerCase(); const specsText = product.specs.join(' ').toLowerCase(); const rawTextLower = product.raw_text.toLowerCase(); if (!subcatLower.includes(typeLower) && !specsText.includes(typeLower) && !rawTextLower.includes(typeLower)) { matches = false; } } // Filter by capacity if specified if (capacity && matches) { const capPattern = new RegExp(`${capacity}GB`, 'i'); const specsText = product.specs.join(' '); const hasCapacity = capPattern.test(specsText) || capPattern.test(product.raw_text) || capPattern.test(product.model || ''); if (!hasCapacity) { matches = false; } } // Filter by frequency if specified if (frequency && matches) { const freqPattern = new RegExp(`${frequency}(?:MHz)?`, 'i'); const specsText = product.specs.join(' '); const hasFrequency = freqPattern.test(specsText) || freqPattern.test(product.raw_text); if (!hasFrequency) { matches = false; } } if (matches) { results.push({ ...product, category_name: ramCategory.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: { type: type || "any", capacity: capacity || "any", frequency: frequency || "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:167-196 (schema)The input schema definition for the 'search_ram' tool, defining parameters like type (DDR4/DDR5), capacity, frequency, sort_by, and limit.{ name: "search_ram", description: "Specialized memory (RAM) search tool. Find desktop or laptop memory by DDR generation, total capacity, speed, and price. Essential for system upgrades or new builds.", inputSchema: { type: "object", properties: { type: { type: "string", description: "RAM generation/type. Options: 'DDR4' (older systems, cheaper), 'DDR5' (newest, faster). Must match motherboard compatibility", }, capacity: { type: "number", description: "Total memory capacity in GB. Common values: 8, 16, 32, 64. Example: 32 for 32GB total (can be 2x16GB or 4x8GB kit)", }, frequency: { type: "number", description: "Memory speed in MHz. DDR4 common: 3200, 3600. DDR5 common: 4800, 5600, 6000. Higher = better performance", }, sort_by: { type: "string", enum: ["price_asc", "price_desc"], description: "Price sorting order. 'price_asc' = budget options first, 'price_desc' = premium/performance kits first", }, limit: { type: "number", description: "Maximum results to return. Valid range: 1-50, default: 10. More results = more brand choices", }, }, }, },
- src/index.ts:311-312 (registration)The switch case in the CallToolRequest handler that registers and dispatches calls to the searchRAM handler for the 'search_ram' tool.case "search_ram": return this.searchRAM(args);
- src/index.ts:82-299 (registration)The ListToolsRequest handler registration that includes 'search_ram' in the list of available tools with its schema.this.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ { name: "search_products", description: "General search across all computer components. Use this for broad searches or when component type is uncertain. For specific components, use dedicated search tools (search_cpu, search_gpu, etc.)", inputSchema: { type: "object", properties: { keyword: { type: "string", description: "Search keyword - can be brand name (Intel, AMD, NVIDIA), model number, or specifications. Examples: 'Intel', 'RTX', '32GB', 'B650'", }, category: { type: "string", description: "Filter by product category. Examples: 'CPU', 'GPU', 'RAM', 'SSD', 'MB' (motherboard). Leave empty to search all categories", }, min_price: { type: "number", description: "Minimum price in TWD. Example: 5000 for products above NT$5,000", }, max_price: { type: "number", description: "Maximum price in TWD. Example: 20000 for products under NT$20,000", }, limit: { type: "number", description: "Maximum number of results to return. Valid range: 1-100, default: 10", }, }, required: ["keyword"], }, }, { name: "search_cpu", description: "Specialized CPU/processor search tool. Find CPUs by socket compatibility, core count, and sort by price. Best for building compatible systems or finding CPUs with specific performance characteristics.", inputSchema: { type: "object", properties: { socket: { type: "string", description: "CPU socket type for motherboard compatibility. Intel examples: '1700' (12-14th gen), '1851' (Core Ultra). AMD examples: 'AM5' (Ryzen 7000/8000/9000), 'AM4' (older Ryzen)", }, cores: { type: "number", description: "Number of physical CPU cores (not threads). Common values: 4, 6, 8, 10, 12, 16, 24, 32. Example: 6 for hex-core CPUs", }, sort_by: { type: "string", enum: ["price_asc", "price_desc"], description: "Price sorting order. 'price_asc' = cheapest first (budget builds), 'price_desc' = most expensive first (high-end builds)", }, limit: { type: "number", description: "Maximum results to return. Valid range: 1-50, default: 10. Use higher values to see more options", }, }, }, }, { 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", }, }, }, }, { name: "search_ram", description: "Specialized memory (RAM) search tool. Find desktop or laptop memory by DDR generation, total capacity, speed, and price. Essential for system upgrades or new builds.", inputSchema: { type: "object", properties: { type: { type: "string", description: "RAM generation/type. Options: 'DDR4' (older systems, cheaper), 'DDR5' (newest, faster). Must match motherboard compatibility", }, capacity: { type: "number", description: "Total memory capacity in GB. Common values: 8, 16, 32, 64. Example: 32 for 32GB total (can be 2x16GB or 4x8GB kit)", }, frequency: { type: "number", description: "Memory speed in MHz. DDR4 common: 3200, 3600. DDR5 common: 4800, 5600, 6000. Higher = better performance", }, sort_by: { type: "string", enum: ["price_asc", "price_desc"], description: "Price sorting order. 'price_asc' = budget options first, 'price_desc' = premium/performance kits first", }, limit: { type: "number", description: "Maximum results to return. Valid range: 1-50, default: 10. More results = more brand choices", }, }, }, }, { name: "search_ssd", description: "Specialized SSD/solid-state drive search tool. Find storage drives by interface type, capacity, and price. Covers M.2 NVMe, SATA, and PCIe drives for OS and data storage.", inputSchema: { type: "object", properties: { interface: { type: "string", description: "Storage interface/connection type. Options: 'M.2' (compact, fast), 'NVMe' (PCIe-based, fastest), 'SATA' (2.5\", compatible), 'PCIe' (add-in card). 'M.2 NVMe' for modern builds", }, capacity: { type: "number", description: "Storage capacity in GB. Common values: 256, 512, 1000 (1TB), 2000 (2TB), 4000 (4TB). Example: 1000 for 1TB drives", }, sort_by: { type: "string", enum: ["price_asc", "price_desc"], description: "Price sorting order. 'price_asc' = value drives first, 'price_desc' = premium/high-performance drives first", }, limit: { type: "number", description: "Maximum results to return. Valid range: 1-50, default: 10. More results show various brands/speeds", }, }, }, }, { name: "search_motherboard", description: "Specialized motherboard (MB/mainboard) search tool. Find motherboards by CPU socket, chipset, and size. Critical for system compatibility - must match CPU socket and case size.", inputSchema: { type: "object", properties: { socket: { type: "string", description: "CPU socket - MUST match your CPU. Intel: '1700' (12-14th gen), '1851' (Core Ultra). AMD: 'AM5' (Ryzen 7000+), 'AM4' (older Ryzen). Check CPU specs first!", }, chipset: { type: "string", description: "Motherboard chipset determines features. Intel: 'Z790' (high-end), 'B760' (mainstream), 'H610' (budget). AMD: 'X670' (high-end), 'B650' (mainstream), 'A620' (budget)", }, form_factor: { type: "string", description: "Physical size - must fit your case. 'ATX' (full size, most expansion), 'mATX' or 'MATX' (compact, good balance), 'ITX' (mini, small builds)", }, sort_by: { type: "string", enum: ["price_asc", "price_desc"], description: "Price sorting order. 'price_asc' = budget boards first, 'price_desc' = feature-rich boards first", }, limit: { type: "number", description: "Maximum results to return. Valid range: 1-50, default: 10. More results = more brand/feature options", }, }, }, }, { name: "get_product_by_model", description: "Get detailed specifications and pricing for a specific product by exact model number. Use when you know the exact product model and need full details including specs, current price, and availability markers.", inputSchema: { type: "object", properties: { model: { type: "string", description: "Exact product model number (case-insensitive). Examples: 'i5-14400F', 'RTX 4060', 'B650M-PLUS', 'WD_BLACK SN770'. Must match exactly as listed", }, }, required: ["model"], }, }, { name: "list_categories", description: "Get a complete list of all product categories with statistics. Shows category names, product counts, and special markers (hot items, discounts). Useful for browsing available product types or understanding the catalog structure.", inputSchema: { type: "object", properties: {}, }, }, { name: "get_category_products", description: "Browse all products within a specific category. Useful for exploring all options in a product type when you don't have specific search criteria. Returns products with full details including prices and specifications.", inputSchema: { type: "object", properties: { category_id: { type: "string", description: "Category ID from list_categories. Examples: 'cat_cpu' for processors, 'cat_vga' for graphics cards. Use list_categories first to get valid IDs", }, subcategory_name: { type: "string", description: "Filter by specific subcategory name. Example: 'Intel Raptor Lake-s 14代1700 腳位' for 14th gen Intel CPUs. Optional - omit to see all subcategories", }, limit: { type: "number", description: "Maximum products to return. Valid range: 1-100, default: 20. Higher values to see more products in the category", }, }, required: ["category_id"], }, }, ], }; });