Skip to main content
Glama

woolworths_get_cart

Retrieve your current Woolworths shopping cart contents to view items, quantities, and prices before checkout.

Instructions

Get the contents of the shopping cart/trolley

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function for the 'woolworths_get_cart' tool. It makes an authenticated API request to the Woolworths trolley endpoint to fetch cart contents and returns the data or an error.
    async function handleGetCart(args: any): Promise<any> {
      const url = `https://www.woolworths.com.au/apis/ui/Trolley`;
    
      try {
        const data = await makeWoolworthsRequest(url);
        return {
          success: true,
          cart: data,
        };
      } catch (error: any) {
        return {
          success: false,
          error: error.message,
        };
      }
  • The tool's schema definition in the TOOLS array, specifying name, description, and input schema (empty object, no required parameters). Used for tool listing and validation.
      name: "woolworths_get_cart",
      description: "Get the contents of the shopping cart/trolley",
      inputSchema: {
        type: "object",
        properties: {},
      },
    },
  • src/index.ts:659-661 (registration)
    The switch case in the main tool request handler that registers and routes 'woolworths_get_cart' calls to the handleGetCart function.
    case "woolworths_get_cart":
      result = await handleGetCart(args || {});
      break;
  • Helper function used by the handler to make authenticated requests to Woolworths API using 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?

No annotations are provided, so the description carries the full burden. It states the action ('Get') but doesn't disclose behavioral traits such as whether this requires authentication, if it's a read-only operation, what format the cart contents are returned in, or if there are any rate limits. The description is minimal and lacks essential context for safe and effective use.

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 directly states the tool's purpose without any unnecessary words. It's front-loaded and efficiently communicates the core function, making it easy to understand at a glance.

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?

Given the complexity of cart operations in e-commerce and the lack of annotations and output schema, the description is incomplete. It doesn't explain what the return value includes (e.g., items, quantities, prices) or any dependencies like needing an active session. For a tool that likely interacts with user data, more context is needed for effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters, and the schema description coverage is 100%, so there are no parameters to document. The description doesn't need to add parameter semantics, and it appropriately doesn't mention any. This meets the baseline for a parameterless tool.

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 verb ('Get') and resource ('contents of the shopping cart/trolley'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'woolworths_update_cart_quantity' or 'woolworths_remove_from_cart', which also involve cart operations but with different actions.

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?

The description provides no guidance on when to use this tool versus alternatives. For example, it doesn't clarify if this should be used to check cart contents before modifying it with 'woolworths_add_to_cart' or 'woolworths_remove_from_cart', or if it's for monitoring changes. There's no mention of prerequisites like requiring an open browser session.

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