Skip to main content
Glama

enrich_basic

Extract essential product attributes like name, price, brand, and availability from any product page URL using structured data extraction.

Instructions

Extract basic product attributes from a URL (name, price, brand, availability). Faster and cheaper than enrich_product. Costs $0.01 per call (cached results are free).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesProduct page URL to extract data from
payment_method_idNoStripe payment method ID for MPP payment

Implementation Reference

  • Registration of the 'enrich_basic' tool within the McpServer, which delegates the logic to the 'handleEnrichment' function.
    server.tool(
      'enrich_basic',
      'Extract basic product attributes from a URL (name, price, brand, availability). Faster and cheaper than enrich_product. Costs $0.01 per call (cached results are free).',
      {
        url: z.string().url().describe('Product page URL to extract data from'),
        payment_method_id: z.string().optional().describe('Stripe payment method ID for MPP payment'),
      },
      async ({ url, payment_method_id }) => {
        return handleEnrichment('enrich_basic', url, payment_method_id, cache, payments);
      },
  • The 'handleEnrichment' function handles the actual execution logic for 'enrich_basic', including caching, payment processing, and field stripping for basic enrichment.
    async function handleEnrichment(
      toolName: 'enrich_product' | 'enrich_basic',
      url: string,
      paymentMethodId: string | undefined,
      cache: EnrichmentCache,
      payments: PaymentManager,
    ): Promise<{ content: Array<{ type: 'text'; text: string }>; isError?: boolean }> {
      // Check cache first (free, no payment needed)
      const cached = cache.get(url);
      if (cached) {
        const result: EnrichmentResult = {
          product: cached,
          cached: true,
        };
        return {
          content: [{ type: 'text' as const, text: JSON.stringify(result, null, 2) }],
        };
      }
    
      // No payment method — return 402 challenge
      if (!paymentMethodId) {
        const challenge: MppChallenge = payments.createChallenge(toolName);
        return {
          content: [{
            type: 'text' as const,
            text: JSON.stringify({
              error: 'payment_required',
              status: 402,
              challenge,
              message: `Payment required. Include a payment_method_id to proceed. Cost: $${(TOOL_PRICING[toolName] / 100).toFixed(2)}`,
            }, null, 2),
          }],
          isError: true,
        };
      }
    
      // Process payment
      let receipt;
      try {
        receipt = await payments.processPayment(toolName, paymentMethodId);
      } catch (err) {
        const message = err instanceof Error ? err.message : 'Payment processing failed';
        return {
          content: [{
            type: 'text' as const,
            text: JSON.stringify({ error: 'payment_failed', message }, null, 2),
          }],
          isError: true,
        };
      }
    
      // Extract product data
      let product: ProductData;
      try {
        product = await extractProduct(url);
      } catch (err) {
        const message = err instanceof Error ? err.message : 'Extraction failed';
        return {
          content: [{
            type: 'text' as const,
            text: JSON.stringify({
              error: 'extraction_failed',
              message,
              receipt,
            }, null, 2),
          }],
          isError: true,
        };
      }
    
      // For basic enrichment, strip image analysis fields
      if (toolName === 'enrich_basic') {
        product.image_urls = [];
        product.primary_image_url = null;
      }
    
      // Cache the result
      cache.set(url, product);
    
      const result: EnrichmentResult = {
        product,
        receipt,
        cached: false,
      };
    
      return {
        content: [{ type: 'text' as const, text: JSON.stringify(result, null, 2) }],
      };
    }
Behavior4/5

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

With no annotations provided, description carries full disclosure burden and successfully reveals cost model ($0.01 per call), caching behavior ('cached results are free'), and performance characteristics ('Faster'). Missing minor details like rate limits or error modes, but covers critical behavioral economics.

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?

Three tightly constructed sentences: capability definition, sibling differentiation, and economic model. Every sentence delivers unique value with zero redundancy. Logical flow moves from what it does to how it compares to alternatives to operational costs.

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?

For a 2-parameter tool with no output schema, description adequately compensates by listing specific extracted attributes (name, price, brand, availability) and disclosing financial/caching behavior. Sufficiently complete for agent selection, though could benefit from brief error condition mention.

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% (both url and payment_method_id fully described in schema), establishing baseline 3. Description mentions URL in context of extraction but adds no validation rules, format constraints, or explicit linkage between payment_method_id and the disclosed $0.01 cost beyond implicit inference.

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 uses specific verb 'Extract' with clear resource scope 'basic product attributes from a URL' and explicitly lists returned fields (name, price, brand, availability). It distinguishes from sibling tool enrich_product by stating it is 'Faster and cheaper,' clearly positioning this as the lightweight alternative.

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

Usage Guidelines4/5

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

Provides explicit comparison to sibling ('Faster and cheaper than enrich_product') which implies selection criteria based on cost and speed requirements. Includes economic context ($0.01 per call, cached free) that helps agents decide when to invoke. Lacks explicit 'when NOT to use' guidance (e.g., when comprehensive data is required).

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/laundromatic/shopgraph'

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