search_ssd
Search for SSDs by interface type, capacity, and price on CoolPC MCP Server. Filter M.2 NVMe, SATA, and PCIe drives to optimize storage 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 |
|---|---|---|---|
| capacity | No | Storage capacity in GB. Common values: 256, 512, 1000 (1TB), 2000 (2TB), 4000 (4TB). Example: 1000 for 1TB drives | |
| 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 | |
| limit | No | Maximum results to return. Valid range: 1-50, default: 10. More results show various brands/speeds | |
| sort_by | No | Price sorting order. 'price_asc' = value drives first, 'price_desc' = premium/high-performance drives first |
Implementation Reference
- src/index.ts:653-759 (handler)The main handler function that executes the 'search_ssd' tool logic. It searches the product data for SSDs matching the provided interface and capacity filters, sorts the results by price if specified, limits the output, and returns a JSON-formatted response with matching products.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:200-220 (schema)Input schema defining the parameters for the 'search_ssd' tool: interface (string), capacity (number in GB), sort_by (price_asc/desc), and limit (number). Provides validation and descriptions for tool inputs.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:197-222 (registration)Tool registration in the ListTools response, defining name 'search_ssd', description, and inputSchema. This makes the tool discoverable by MCP clients.{ 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)Dispatch case in the CallToolRequestSchema handler that routes calls to 'search_ssd' to the searchSSD method.case "search_ssd": return this.searchSSD(args);