Skip to main content
Glama

woolworths_remove_from_cart

Remove unwanted products from your Woolworths shopping cart by providing the product stockcode/ID to keep your cart organized with only the items you want.

Instructions

Remove a product from the shopping cart/trolley

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
stockcodeYesThe product stockcode/ID to remove

Implementation Reference

  • The handler function for woolworths_remove_from_cart. Removes a product from the cart by sending a POST request to the trolley/update endpoint with quantity set to 0 for the specified stockcode.
    async function handleRemoveFromCart(args: any): Promise<any> {
      const stockcode = args.stockcode;
    
      const url = `https://www.woolworths.com.au/api/v3/ui/trolley/update`;
    
      try {
        const data = await makeWoolworthsRequest(url, {
          method: "POST",
          headers: {
            "Content-Type": "application/json",
          },
          body: JSON.stringify({
            items: [
              {
                stockcode,
                quantity: 0,
                source: "ProductDetail",
                diagnostics: "0",
                searchTerm: null,
                evaluateRewardPoints: false,
                offerId: null,
                profileId: null,
                priceLevel: null,
              },
            ],
          }),
        });
        return {
          success: true,
          cart: data,
        };
      } catch (error: any) {
        return {
          success: false,
          error: error.message,
        };
      }
    }
  • The input schema and metadata definition for the woolworths_remove_from_cart tool, part of the TOOLS array used for listing tools.
    {
      name: "woolworths_remove_from_cart",
      description: "Remove a product from the shopping cart/trolley",
      inputSchema: {
        type: "object",
        properties: {
          stockcode: {
            type: "number",
            description: "The product stockcode/ID to remove",
          },
        },
        required: ["stockcode"],
      },
  • src/index.ts:663-665 (registration)
    The switch case in the CallToolRequest handler that registers and invokes the handleRemoveFromCart function for the tool name.
    case "woolworths_remove_from_cart":
      result = await handleRemoveFromCart(args || {});
      break;
  • Helper function used by the handler to make authenticated API requests to Woolworths endpoints with session cookies.
    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?

With no annotations provided, the description carries full burden for behavioral disclosure. It states the action but doesn't cover important aspects like whether removal is permanent, if it requires authentication, what happens on success/failure, or any rate limits. This is particularly problematic for a mutation tool with zero annotation coverage.

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 a single, clear sentence that efficiently communicates the core function without unnecessary words. It's appropriately sized for a simple tool with one parameter and gets straight to the point with zero waste.

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?

For a mutation tool with no annotations and no output schema, the description is insufficient. It doesn't explain what happens after removal (e.g., success confirmation, error cases, or what the cart state becomes). Given the complexity of modifying shopping cart state and the lack of structured safety information, more behavioral 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?

The description doesn't add any parameter information beyond what's already in the schema (which has 100% coverage). The schema clearly documents the single 'stockcode' parameter as 'The product stockcode/ID to remove.' Since schema coverage is complete, the baseline score of 3 is appropriate - the description doesn't compensate but doesn't need to.

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 ('Remove') and target ('a product from the shopping cart/trolley'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'woolworths_update_cart_quantity' which could also modify cart contents, leaving room for potential confusion about when to choose one over the other.

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 is provided on when to use this tool versus alternatives. For example, it doesn't specify if this is for complete removal versus quantity adjustment (which 'woolworths_update_cart_quantity' might handle) or mention prerequisites like having items in the cart. The description only states what it does, not when to use it.

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