Skip to main content
Glama
BuyWhere

BuyWhere

Official

get_product

Retrieve complete product details using a BuyWhere product ID from search results.

Instructions

Fetch full details for a single product by its BuyWhere product ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
product_idYesThe BuyWhere product ID (returned by search_products as product_id)

Implementation Reference

  • src/index.ts:211-293 (registration)
    Tool 'get_product' is registered in the ListToolsRequestSchema handler with name, description, and inputSchema requiring product_id.
      {
        name: "get_product",
        description: "Fetch full details for a single product by its BuyWhere product ID.",
        inputSchema: {
          type: "object",
          properties: {
            product_id: {
              type: "string",
              description: "The BuyWhere product ID (returned by search_products as product_id)",
            },
          },
          required: ["product_id"],
        },
      },
      {
        name: "get_price",
        description:
          "Get current prices for a product across all available merchants. " +
          "Returns a ranked list of listings with price, shipping, merchant rating, and stock status. " +
          "Use this to find the cheapest place to buy a specific product.",
        inputSchema: {
          type: "object",
          properties: {
            product_id: {
              type: "string",
              description: "The BuyWhere product ID",
            },
          },
          required: ["product_id"],
        },
      },
      {
        name: "compare_prices",
        description:
          "Compare 2–5 products side-by-side. Returns structured differentiators, price range, " +
          "pros/cons, and a best-value recommendation — purpose-built for AI agent decision-making.",
        inputSchema: {
          type: "object",
          properties: {
            product_ids: {
              type: "array",
              items: { type: "string" },
              description: "Array of 2–5 BuyWhere product IDs to compare",
              minItems: 2,
              maxItems: 5,
            },
          },
          required: ["product_ids"],
        },
      },
      {
        name: "get_affiliate_link",
        description:
          "Get the click-tracked BuyWhere affiliate link for a product. " +
          "Share this link with users — it logs the referral and redirects to the merchant page. " +
          "Always use this instead of raw product URLs when sharing links.",
        inputSchema: {
          type: "object",
          properties: {
            product_id: {
              type: "string",
              description: "The BuyWhere product ID",
            },
          },
          required: ["product_id"],
        },
      },
      {
        name: "get_catalog",
        description:
          "List available product categories in the BuyWhere catalog. " +
          "Use this to discover what categories exist before searching or filtering.",
        inputSchema: {
          type: "object",
          properties: {
            parent_slug: {
              type: "string",
              description: "Parent category slug to list subcategories (optional — omit for top-level categories)",
            },
          },
        },
      },
    ],
  • Handler for 'get_product' tool call: validates product_id, calls apiFetch on /v1/products/{id}, and formats the result using formatProduct().
    // ── get_product ──────────────────────────────────────────────────────────
    if (name === "get_product") {
      const productId = args.product_id as string | undefined;
      if (!productId) {
        throw new McpError(ErrorCode.InvalidParams, "product_id is required");
      }
    
      const data = (await apiFetch(`/v1/products/${encodeURIComponent(productId)}`)) as Record<string, unknown>;
    
      return {
        content: [{ type: "text", text: formatProduct(data) }],
      };
    }
  • The formatProduct() helper is used by get_product to format the API response into a human-readable text block with title, ID, price, category, merchant, stock, URL, image, and description.
    function formatProduct(p: Record<string, unknown>): string {
      const price = p.price as Record<string, unknown> | undefined;
      const merchant = p.merchant as Record<string, unknown> | undefined;
      const avail = p.availability as Record<string, unknown> | undefined;
      const images = (p.images as Array<Record<string, unknown>> | undefined) ?? [];
    
      const lines: string[] = [
        `**${p.title ?? p.name}**`,
        `ID: ${p.product_id ?? p.id}`,
        `Price: ${price?.currency ?? "SGD"} ${price?.amount ?? "N/A"}`,
        `Category: ${p.category ?? ""}`,
        `Merchant: ${merchant?.name ?? merchant?.merchant_id ?? ""}` +
          (merchant?.platform ? ` (${merchant.platform})` : ""),
        `In stock: ${avail?.in_stock ? "Yes" : "No"}`,
        `URL: ${p.source_url ?? ""}`,
      ];
    
      if (images.length > 0) {
        lines.push(`Image: ${images[0].url}`);
      }
      if (p.description_short) {
        lines.push(`Description: ${p.description_short}`);
      }
      if (p.description_full) {
        const desc = p.description_full as string;
        lines.push(`Description: ${desc.length > 300 ? desc.slice(0, 300) + "…" : desc}`);
      }
    
      return lines.join("\n");
    }
  • Input schema for get_product: requires a single string parameter 'product_id' which is the BuyWhere product ID returned by search_products.
      description: "Fetch full details for a single product by its BuyWhere product ID.",
      inputSchema: {
        type: "object",
        properties: {
          product_id: {
            type: "string",
            description: "The BuyWhere product ID (returned by search_products as product_id)",
          },
        },
        required: ["product_id"],
      },
    },
Behavior2/5

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

No annotations provided; description carries full burden. Lacks details on what 'full details' includes, error behavior for invalid IDs, or any side effects. Vague behavioral expectations.

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?

Single sentence with no wasted words. Front-loaded with the core action and qualifier.

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

Completeness3/5

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

Adequate for a simple single-param tool, but missing details about output content and error states. No output schema to supplement, so description should clarify what 'full details' means.

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 coverage is 100% with a clear property description. Tool description adds no extra context beyond the schema's property text, so it meets baseline without enhancement.

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?

Description clearly states the action (fetch), resource (full details for a single product), and uniqueness (by BuyWhere product ID). It distinguishes from sibling tools like search_products which return multiple results.

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

Usage Guidelines2/5

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

No guidance on when to use this vs alternatives (e.g., get_price, get_catalog). No mention of prerequisites or when not to use.

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/BuyWhere/buywhere-mcp'

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