search_cpu
Find compatible CPUs for your PC build by filtering socket type, core count, and price. Use this tool to identify processors that match your motherboard and performance requirements.
Instructions
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.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| socket | No | 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 | No | 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 | No | Price sorting order. 'price_asc' = cheapest first (budget builds), 'price_desc' = most expensive first (high-end builds) | |
| limit | No | Maximum results to return. Valid range: 1-50, default: 10. Use higher values to see more options |
Implementation Reference
- src/index.ts:329-430 (handler)The core handler function for the 'search_cpu' tool. It searches CPU products by socket and core count filters, sorts by price if specified, applies limits, and returns JSON-formatted results.private searchCPU(args: any) { const { socket, cores, sort_by, limit = 10 } = args; const results: any[] = []; // Find CPU category const cpuCategory = this.productData.find(cat => cat.category_name.includes('CPU') || cat.category_name.includes('處理器') ); if (!cpuCategory) { return { content: [ { type: "text", text: JSON.stringify({ error: "CPU category not found", results: [] }, null, 2), }, ], }; } // Search through all CPU subcategories for (const subcat of cpuCategory.subcategories) { for (const product of subcat.products) { let matches = true; // Filter by socket if specified if (socket) { const socketLower = socket.toLowerCase(); const subcatLower = subcat.name.toLowerCase(); const specsText = product.specs.join(' ').toLowerCase(); const rawTextLower = product.raw_text.toLowerCase(); if (!subcatLower.includes(socketLower) && !specsText.includes(socketLower) && !rawTextLower.includes(socketLower)) { matches = false; } } // Filter by cores if specified if (cores && matches) { const corePattern = new RegExp(`${cores}核`, 'i'); const specsText = product.specs.join(' '); const hasCore = corePattern.test(specsText) || corePattern.test(product.raw_text) || corePattern.test(subcat.name); if (!hasCore) { matches = false; } } if (matches) { results.push({ ...product, category_name: cpuCategory.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: { socket: socket || "any", cores: cores || "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:118-139 (schema)The input schema defining parameters for the search_cpu tool: socket, cores, sort_by, and limit.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", }, }, },
- src/index.ts:115-140 (registration)Tool registration in the ListTools response, including name, description, and inputSchema.{ 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", }, }, }, },
- src/index.ts:307-308 (registration)Dispatch registration in the CallToolRequestHandler switch statement that routes to the searchCPU handler.case "search_cpu": return this.searchCPU(args);