Skip to main content
Glama

search_products

Search computer components by keyword, category, or price range to find products for building custom PCs. Use for broad searches when component type is uncertain.

Instructions

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.)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keywordYesSearch keyword - can be brand name (Intel, AMD, NVIDIA), model number, or specifications. Examples: 'Intel', 'RTX', '32GB', 'B650'
categoryNoFilter by product category. Examples: 'CPU', 'GPU', 'RAM', 'SSD', 'MB' (motherboard). Leave empty to search all categories
min_priceNoMinimum price in TWD. Example: 5000 for products above NT$5,000
max_priceNoMaximum price in TWD. Example: 20000 for products under NT$20,000
limitNoMaximum number of results to return. Valid range: 1-100, default: 10

Implementation Reference

  • The core handler function for the 'search_products' tool. It destructures input arguments, iterates through all product categories and subcategories, matches products based on keyword in brand/model/specs/raw_text, applies price filters if provided, limits results, and returns a JSON-formatted response with matching products.
    private searchProducts(args: any) {
      const { keyword, category, min_price, max_price, limit = 10 } = args;
      const results: any[] = [];
    
      for (const cat of this.productData) {
        if (category && !cat.category_name.toLowerCase().includes(category.toLowerCase())) {
          continue;
        }
    
        for (const subcat of cat.subcategories) {
          for (const product of subcat.products) {
            const searchText = `${product.brand} ${product.model} ${product.specs.join(" ")} ${product.raw_text}`.toLowerCase();
            
            if (!searchText.includes(keyword.toLowerCase())) {
              continue;
            }
    
            if (min_price && product.price < min_price) {
              continue;
            }
    
            if (max_price && product.price > max_price) {
              continue;
            }
    
            results.push({
              ...product,
              category_name: cat.category_name,
              subcategory_name: subcat.name,
            });
    
            if (results.length >= limit) {
              break;
            }
          }
    
          if (results.length >= limit) {
            break;
          }
        }
    
        if (results.length >= limit) {
          break;
        }
      }
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify({
              total_found: results.length,
              results: results.map(p => ({
                brand: p.brand,
                model: p.model,
                specs: p.specs,
                price: p.price,
                original_price: p.original_price,
                discount_amount: p.discount_amount,
                category: p.category_name,
                subcategory: p.subcategory_name,
                markers: p.markers,
              })),
            }, null, 2),
          },
        ],
      };
    }
  • Input schema defining the parameters for the search_products tool: keyword (required), optional category filter, price range (min_price, max_price), and result limit.
    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"],
    },
  • src/index.ts:85-114 (registration)
    Registration of the search_products tool in the ListToolsRequestSchema handler, providing the tool name, description, and input schema.
    {
      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"],
      },
    },
Behavior3/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. The description mentions it's a 'general search' which implies read-only behavior, but doesn't explicitly state whether this requires authentication, has rate limits, or what the return format looks like. It provides some context about scope but lacks details on behavioral traits like pagination, error handling, or performance characteristics.

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

Conciseness5/5

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

The description is extremely concise with just two sentences that each serve a clear purpose. The first sentence states the tool's purpose, and the second provides explicit usage guidelines. There's no wasted text, and the information is front-loaded with the most important details first.

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

Completeness4/5

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

Given the tool's moderate complexity (5 parameters, no output schema, no annotations), the description provides good contextual completeness. It clearly explains the tool's purpose and when to use it versus alternatives. However, without annotations or output schema, it could benefit from more information about what the search returns (e.g., result format, pagination) and any behavioral constraints.

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?

With 100% schema description coverage, the input schema already provides comprehensive documentation for all 5 parameters. The description doesn't add any parameter-specific information beyond what's in the schema. It mentions the tool's general purpose but doesn't explain parameter interactions or provide additional semantic context, so it meets the baseline for good schema coverage.

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

Purpose5/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 as a 'general search across all computer components' with a specific verb ('search') and resource ('computer components'). It explicitly distinguishes this from sibling tools by mentioning dedicated search tools for specific components (search_cpu, search_gpu, etc.), making it easy to understand when this tool is appropriate versus alternatives.

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

Usage Guidelines5/5

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

The description provides explicit guidance on when to use this tool ('for broad searches or when component type is uncertain') and when to use alternatives ('For specific components, use dedicated search tools'). This directly addresses the sibling tools listed, giving clear context for tool selection without any misleading information.

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