Skip to main content
Glama
Decodo

Decodo MCP Server

target_search

Read-only

Automatically scrape and parse Target search results. Customize with query, device type, delivery ZIP, and store ID for localized product data.

Instructions

Scrape Target Search results with automatic parsing

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query for Target products
jsRenderNoShould the request be opened in a headless browser, false by default
deviceTypeNoDevice type to emulate for the request
deliveryZipNoZIP code for delivery location
storeIdNoTarget store ID for local inventory

Implementation Reference

  • The TargetSearchTool class implements the tool handler logic. The register() method calls server.registerTool('target_search', ...) with the async handler that builds scrapi API params (headless html, target_search, markdown true), calls sapiClient.scrape(), strips 'suggested' and 'refinements' fields via transformResponse, and returns stringified JSON text content.
    export class TargetSearchTool extends Tool {
      toolset = TOOLSET.ECOMMERCE;
    
      private static FIELDS_WITH_HIGH_CHAR_COUNT = ['suggested', 'refinements'];
    
      transformResponse = ({ data }: { data: object }) => {
        for (const fieldToRemove of TargetSearchTool.FIELDS_WITH_HIGH_CHAR_COUNT) {
          data = removeKeyFromNestedObject({ obj: data, keyToRemove: fieldToRemove });
        }
    
        return { data: JSON.stringify(data) };
      };
    
      register = ({ server, sapiClient, auth }: ToolRegistrationArgs) => {
        server.registerTool(
          'target_search',
          {
            description: 'Scrape Target Search results with automatic parsing',
            inputSchema: {
              query: z.string().describe('Search query for Target products'),
              jsRender: zodJsRender,
              deviceType: zodDeviceType,
              deliveryZip: zodDeliveryZip,
              storeId: zodStoreId,
            },
            annotations: {
              readOnlyHint: true,
              openWorldHint: true,
            },
          },
          async (scrapingParams: ScrapingMCPParams, extra: ProgressExtra) => {
            const params = {
              headless: 'html',
              ...scrapingParams,
              target: SCRAPER_API_TARGETS.TARGET_SEARCH,
              markdown: true,
            } satisfies ScraperAPIParams;
    
            const { data } = await sapiClient.scrape<object>({ auth, scrapingParams: params, extra });
    
            const { data: text } = this.transformResponse({ data });
    
            return {
              content: [
                {
                  type: 'text',
                  text,
                },
              ],
            };
          }
        );
      };
    }
  • Zod schemas for deliveryZip and storeId input fields, which are optional strings specific to this Target search tool.
    const zodDeliveryZip = z.string().describe('ZIP code for delivery location').optional();
    
    const zodStoreId = z.string().describe('Target store ID for local inventory').optional();
  • The server calls registerAllTools() (or registerTools()) which iterates through allTools including new TargetSearchTool() at line 81 and calls its register() method, binding it to the MCP server.
    registerAllTools() {
      for (const tool of ScraperAPIBaseServer.allTools) {
        tool.register({ server: this.server, sapiClient: this.sapiClient, auth: this.auth });
      }
    }
  • Helper transformResponse method that removes high-character-count fields ('suggested', 'refinements') from the scraped data and stringifies it.
    transformResponse = ({ data }: { data: object }) => {
      for (const fieldToRemove of TargetSearchTool.FIELDS_WITH_HIGH_CHAR_COUNT) {
        data = removeKeyFromNestedObject({ obj: data, keyToRemove: fieldToRemove });
      }
    
      return { data: JSON.stringify(data) };
  • src/constants.ts:10-49 (registration)
    The SCRAPER_API_TARGETS enum defines TARGET_SEARCH = 'target_search' which is used as the target parameter value for the ScraperAPI call.
    export enum SCRAPER_API_TARGETS {
      GOOGLE_SEARCH = 'google_search',
      GOOGLE_TRAVEL_HOTELS = 'google_travel_hotels',
      GOOGLE_ADS = 'google_ads',
      GOOGLE_LENS = 'google_lens',
      GOOGLE_AI_MODE = 'google_ai_mode',
    
      AMAZON_SEARCH = 'amazon_search',
      AMAZON_PRODUCT = 'amazon_product',
      AMAZON_PRICING = 'amazon_pricing',
      AMAZON_SELLERS = 'amazon_sellers',
      AMAZON_BESTSELLERS = 'amazon_bestsellers',
    
      WALMART_SEARCH = 'walmart_search',
      WALMART_PRODUCT = 'walmart_product',
    
      TARGET_SEARCH = 'target_search',
      TARGET_PRODUCT = 'target_product',
    
      TIKTOK_POST = 'tiktok_post',
      TIKTOK_SHOP_SEARCH = 'tiktok_shop_search',
      TIKTOK_SHOP_PRODUCT = 'tiktok_shop_product',
      TIKTOK_SHOP_URL = 'tiktok',
    
      YOUTUBE_VIDEO = 'youtube_video',
      YOUTUBE_METADATA = 'youtube_metadata',
      YOUTUBE_CHANNEL = 'youtube_channel',
      YOUTUBE_SUBTITLES = 'youtube_subtitles',
      YOUTUBE_SEARCH = 'youtube_search',
    
      REDDIT_POST = 'reddit_post',
      REDDIT_SUBREDDIT = 'reddit_subreddit',
      REDDIT_USER = 'reddit_user',
    
      BING_SEARCH = 'bing_search',
    
      CHATGPT = 'chatgpt',
      PERPLEXITY = 'perplexity',
    }
Behavior3/5

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

Annotations already declare readOnlyHint=true and openWorldHint=true. The description adds 'automatic parsing' but lacks further behavioral details (e.g., pagination, rate limits). Adds some context but not rich.

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?

Short and front-loaded, but 'target_search results' is slightly redundant. Efficient but could be marginally improved.

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?

No output schema, and the description omits return format, error handling, or limitations. For a scraping tool, more context is needed.

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%, so the description does not add extra meaning beyond the schema. Baseline 3 is appropriate given no additional param details.

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 it scrapes Target Search results with automatic parsing, which is specific and distinguishes it from sibling tools like target_product or other platform search tools.

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 tool versus alternatives. The sibling list includes similar search tools (e.g., amazon_search, walmart_search) but no comparative context.

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

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/Decodo/mcp-server'

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