Skip to main content
Glama

woolworths_search_products

Search Woolworths products by name, filter by special offers, sort by price or relevance, and browse results with pagination.

Instructions

Search for products on Woolworths. Requires session cookies to be obtained first.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
searchTermYesThe product search term
pageNumberNoPage number for pagination (default: 1)
pageSizeNoNumber of results to return (default: 36)
sortTypeNoSort order: TraderRelevance, PriceAsc, PriceDesc, Name (default: TraderRelevance)TraderRelevance
isSpecialNoFilter for special offers only (default: false)

Implementation Reference

  • The main execution logic for the woolworths_search_products tool. Parses arguments, constructs a POST request to the Woolworths search API endpoint, and returns formatted search results or error.
    async function handleSearchProducts(args: any): Promise<any> {
      const searchTerm = args.searchTerm;
      const pageNumber = args.pageNumber ?? 1;
      const pageSize = args.pageSize ?? 36;
      const sortType = args.sortType ?? "TraderRelevance";
      const isSpecial = args.isSpecial ?? false;
    
      // Woolworths search API endpoint (POST method)
      const url = `https://www.woolworths.com.au/apis/ui/Search/products`;
    
      const requestBody = {
        searchTerm,
        pageNumber,
        pageSize,
        sortType,
        location: `/shop/search/products?searchTerm=${encodeURIComponent(searchTerm)}`,
        formatObject: JSON.stringify({ name: searchTerm }),
        isSpecial,
        isBundle: false,
        isMobile: false,
        filters: [],
        groupEdmVariants: false,
      };
    
      try {
        const data = await makeWoolworthsRequest(url, {
          method: "POST",
          headers: {
            "Content-Type": "application/json",
          },
          body: JSON.stringify(requestBody),
        });
    
        return {
          success: true,
          searchTerm,
          totalResults: data.SearchResultsCount || 0,
          products: data.Products || [],
          pagination: data.Pagination || {
            TotalRecords: data.SearchResultsCount || 0,
            PageNumber: pageNumber,
            PageSize: pageSize,
          },
        };
      } catch (error: any) {
        return {
          success: false,
          error: error.message,
        };
      }
    }
  • The input schema defining the parameters, types, descriptions, defaults, and requirements for the woolworths_search_products tool.
      name: "woolworths_search_products",
      description:
        "Search for products on Woolworths. Requires session cookies to be obtained first.",
      inputSchema: {
        type: "object",
        properties: {
          searchTerm: {
            type: "string",
            description: "The product search term",
          },
          pageNumber: {
            type: "number",
            description: "Page number for pagination (default: 1)",
            default: 1,
          },
          pageSize: {
            type: "number",
            description: "Number of results to return (default: 36)",
            default: 36,
          },
          sortType: {
            type: "string",
            description: "Sort order: TraderRelevance, PriceAsc, PriceDesc, Name (default: TraderRelevance)",
            enum: ["TraderRelevance", "PriceAsc", "PriceDesc", "Name"],
            default: "TraderRelevance",
          },
          isSpecial: {
            type: "boolean",
            description: "Filter for special offers only (default: false)",
            default: false,
          },
        },
        required: ["searchTerm"],
      },
    },
  • src/index.ts:639-641 (registration)
    The switch case in the main tool call handler that dispatches execution to the handleSearchProducts function.
    case "woolworths_search_products":
      result = await handleSearchProducts(args || {});
      break;
  • Helper function used by the tool handler to perform authenticated HTTP requests to Woolworths APIs, including cookie management and error handling.
    async function makeWoolworthsRequest(
      url: string,
      options: any = {}
    ): Promise<any> {
      if (sessionCookies.length === 0) {
        throw new Error(
          "No session cookies available. Please use woolworths_get_cookies first."
        );
      }
    
      const headers = {
        "User-Agent":
          "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
        Accept: "*/*",
        "Accept-Language": "en-US,en;q=0.9",
        Origin: "https://www.woolworths.com.au",
        Referer: "https://www.woolworths.com.au/",
        "sec-fetch-dest": "empty",
        "sec-fetch-mode": "cors",
        "sec-fetch-site": "same-origin",
        Priority: "u=1, i",
        Cookie: getCookieHeader(),
        ...options.headers,
      };
    
      const response = await fetch(url, {
        ...options,
        headers,
      });
    
      if (!response.ok) {
        const errorText = await response.text();
        throw new Error(
          `API request failed: ${response.status} ${response.statusText}. ${errorText}`
        );
      }
    
      return response.json();
    }
Behavior2/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. It mentions the requirement for session cookies, which is useful context about authentication needs. However, it doesn't describe other behavioral traits such as whether this is a read-only operation, potential rate limits, error handling, or the format of search results. For a search tool with zero annotation coverage, this is a significant gap in transparency.

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 two sentences, front-loaded with the core purpose followed by a prerequisite. Every sentence earns its place by providing essential information without waste. It is appropriately sized and structured for clarity.

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?

Given the complexity (a search tool with 5 parameters), no annotations, and no output schema, the description is incomplete. It covers the purpose and a key prerequisite but lacks details on behavioral traits, result format, or error handling. The schema handles parameters well, but without annotations or output schema, the description should do more to compensate, making it only adequate with clear gaps.

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%, meaning all parameters are documented in the input schema with descriptions and defaults. The description adds no additional parameter semantics beyond what the schema provides. According to the rules, with high schema coverage (>80%), the baseline score is 3 even with no param info in the description, which applies here.

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 action ('Search for products') and the resource ('on Woolworths'), providing a specific verb+resource combination. However, it doesn't explicitly differentiate this tool from sibling tools like 'woolworths_get_product_details' or 'woolworths_get_specials', which might also retrieve product information. The purpose is clear but lacks sibling distinction.

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?

The description provides explicit context for usage with 'Requires session cookies to be obtained first', indicating a prerequisite. This helps the agent understand when to use this tool (after authentication). However, it doesn't specify when to use this tool versus alternatives like 'woolworths_get_specials' for special offers or 'woolworths_get_product_details' for detailed product info, so it lacks full alternative guidance.

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/elijah-g/Woolworths-mcp'

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