Skip to main content
Glama

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
NameRequiredDescriptionDefault
socketNoCPU socket type for motherboard compatibility. Intel examples: '1700' (12-14th gen), '1851' (Core Ultra). AMD examples: 'AM5' (Ryzen 7000/8000/9000), 'AM4' (older Ryzen)
coresNoNumber of physical CPU cores (not threads). Common values: 4, 6, 8, 10, 12, 16, 24, 32. Example: 6 for hex-core CPUs
sort_byNoPrice sorting order. 'price_asc' = cheapest first (budget builds), 'price_desc' = most expensive first (high-end builds)
limitNoMaximum results to return. Valid range: 1-50, default: 10. Use higher values to see more options

Implementation Reference

  • 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),
          },
        ],
      };
    }
  • 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);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions search functionality and sorting but doesn't describe what the tool returns (list of CPUs? with what fields?), pagination behavior, error conditions, or rate limits. For a search tool with 4 parameters and no output schema, this is inadequate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two concise sentences with zero waste. First sentence states purpose and key parameters, second provides usage context. Well-structured and appropriately sized for the tool's complexity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a search tool with 4 parameters, no annotations, and no output schema, the description is incomplete. It doesn't explain what results look like, what fields are returned, or how to interpret results. The schema covers parameters well, but the overall context for using the tool effectively is lacking.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description mentions the three main parameters (socket, cores, sort_by) but adds no meaningful semantics beyond what's in the schema descriptions. Baseline 3 is appropriate when schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Specialized CPU/processor search tool' with specific search criteria (socket compatibility, core count, price sorting). It distinguishes from generic search tools but doesn't explicitly differentiate from 'search_products' or other hardware-specific search siblings.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides implied usage context ('Best for building compatible systems or finding CPUs with specific performance characteristics') but doesn't explicitly state when to use this vs. alternatives like 'search_products' or 'get_product_by_model'. No when-not-to-use guidance is provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/shyuan/coolpc-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server