search_ssd
Search for solid-state drives by interface type, capacity, and price to find storage solutions for OS and data needs.
Instructions
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.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| interface | No | 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 | No | Storage capacity in GB. Common values: 256, 512, 1000 (1TB), 2000 (2TB), 4000 (4TB). Example: 1000 for 1TB drives | |
| sort_by | No | Price sorting order. 'price_asc' = value drives first, 'price_desc' = premium/high-performance drives first | |
| limit | No | Maximum results to return. Valid range: 1-50, default: 10. More results show various brands/speeds |
Implementation Reference
- src/index.ts:653-759 (handler)The handler function that implements the search_ssd tool logic. It filters SSD products from the product data based on interface type (e.g., M.2, NVMe), capacity (in GB, handles TB conversion), sorting by price, and limit. Searches category, subcategory names, specs, and raw text. Returns JSON-formatted results with total found, filters applied, and limited results.private searchSSD(args: any) { const { interface: interfaceType, capacity, sort_by, limit = 10 } = args; const results: any[] = []; // Find SSD category const ssdCategory = this.productData.find(cat => cat.category_name.includes('SSD') || cat.category_name.includes('固態硬碟') ); if (!ssdCategory) { return { content: [ { type: "text", text: JSON.stringify({ error: "SSD category not found", results: [] }, null, 2), }, ], }; } // Search through all SSD subcategories for (const subcat of ssdCategory.subcategories) { for (const product of subcat.products) { let matches = true; // Filter by interface if specified if (interfaceType && matches) { const interfaceLower = interfaceType.toLowerCase(); const subcatLower = subcat.name.toLowerCase(); const specsText = product.specs.join(' ').toLowerCase(); const rawTextLower = product.raw_text.toLowerCase(); if (!subcatLower.includes(interfaceLower) && !specsText.includes(interfaceLower) && !rawTextLower.includes(interfaceLower)) { matches = false; } } // Filter by capacity if specified if (capacity && matches) { // Handle both GB and TB const capPatternGB = new RegExp(`${capacity}GB`, 'i'); const capPatternTB = new RegExp(`${capacity / 1000}TB`, 'i'); const specsText = product.specs.join(' '); const hasCapacity = capPatternGB.test(specsText) || capPatternGB.test(product.raw_text) || capPatternGB.test(product.model || '') || (capacity >= 1000 && (capPatternTB.test(specsText) || capPatternTB.test(product.raw_text) || capPatternTB.test(product.model || ''))); if (!hasCapacity) { matches = false; } } if (matches) { results.push({ ...product, category_name: ssdCategory.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: { interface: interfaceType || "any", capacity: capacity || "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:197-222 (schema)The input schema definition for the search_ssd tool, including properties for interface, capacity, sort_by, and limit, as returned in the ListTools response.{ 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", }, }, }, },
- src/index.ts:313-314 (registration)The switch case in the CallToolRequestSchema handler that routes calls to the search_ssd tool to the searchSSD method.case "search_ssd": return this.searchSSD(args);