> For the complete documentation index, see [llms.txt](https://eraya.gitbook.io/eraya-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://eraya.gitbook.io/eraya-docs/mcp-server/available-tools.md).

# Available Tools

## Available Tools

The Eraya MCP Server provides **16 tools** across four categories:

* Store & Configuration — `list_stores`, `switch_store`, `get_eraya_schema`
* Experiments & Results — `list_experiments`, `get_experiment_details`, `get_experiment_results`, `get_experiment_statistics`, `get_experiment_orders`
* Store Data & Analytics — `get_store_orders`, `get_products`, `get_product_analytics`, `get_business_kpis`, `get_test_recommendations`
* Shopify Store Data — `list_collections`, `list_pages`, `search_policies`

***

### Store & Configuration

#### `list_stores`

List all Shopify stores your Eraya account has access to. Shows which store is currently active for the session.

**Parameters:** None

**Example response:**

```json
{
  "currentStoreId": "64a1f2e3c4d5e6f7a8b9c0d1",
  "stores": [
    {
      "id": "64a1f2e3c4d5e6f7a8b9c0d1",
      "name": "My Shopify Store",
      "isCurrent": true
    },
    {
      "id": "64a1f2e3c4d5e6f7a8b9c0d2",
      "name": "My Second Store",
      "isCurrent": false
    }
  ]
}
```

***

#### `switch_store`

Switch the active store for this session. All subsequent tool calls will use the selected store. Call `list_stores` first to find available store IDs.

> **Note:** The target store must be on an active Eraya Pro plan.

**Parameters:**

* `storeId` *(required)*: The ID of the store to switch to (use `list_stores` to find IDs)

**Example response:**

```json
{
  "message": "Switched to store: My Second Store. All subsequent tool calls will use this store.",
  "storeId": "64a1f2e3c4d5e6f7a8b9c0d2",
  "storeName": "My Second Store"
}
```

***

#### `get_eraya_schema`

Returns the complete Eraya data schema: test types, order property naming conventions, collection names, data flow, and a guide on which tool to use for each analytics task.

> **Recommended:** Call this at the start of a session to help the AI understand your store data before querying it.

**Parameters:** None

**Example response:**

```json
{
  "overview": "Eraya is an A/B testing platform for Shopify stores...",
  "testTypes": {
    "price": {
      "description": "Tests different prices for product variants.",
      "collection": "pricetests"
    },
    "shipping": {
      "description": "Tests different shipping rates via Shopify carrier service.",
      "collection": "shippingTests"
    }
  },
  "toolGuide": {
    "get_experiment_statistics": "USE THIS for significance testing, winner determination, lift analysis.",
    "get_experiment_results": "Use for live session-based funnel breakdown by variation/device/visitor-type."
  }
}
```

***

### Experiments & Results

#### `list_experiments`

List all A/B experiments for the active store. Returns all test types by default. Filter by status and/or test type.

**Parameters:**

* `status` *(required)*: Filter by test status — `"active"`, `"completed"`, or `"all"`
* `testType` *(optional)*: Filter by test type — `"price"`, `"shipping"`, `"theme"`, `"content"`, `"redirect"`, `"checkout"`, `"template"`, or `"offer"`

**Example response:**

```json
[
  {
    "id": "64b2c3d4e5f6a7b8c9d0e1f2",
    "name": "Summer Price Test — T-Shirt",
    "type": "pricing",
    "status": "active",
    "startDate": "2026-04-01T00:00:00.000Z",
    "variations": [
      { "name": "Control", "value": "29.99" },
      { "name": "Variation B", "value": "34.99" }
    ]
  }
]
```

***

#### `get_experiment_details`

Get the full configuration of a specific experiment: variations, goals, targeting, traffic allocation, and run dates.

**Parameters:**

* `experimentId` *(required)*: The ID of the experiment
* `testType` *(required)*: The type of test — `"price"`, `"shipping"`, `"theme"`, `"content"`, `"redirect"`, `"checkout"`, `"template"`, or `"offer"`

**Example response:**

```json
{
  "id": "64b2c3d4e5f6a7b8c9d0e1f2",
  "name": "Summer Price Test — T-Shirt",
  "testType": "price",
  "status": "active",
  "startDate": "2026-04-01T00:00:00.000Z",
  "endDate": null,
  "variations": [
    { "name": "Control", "value": "29.99" },
    { "name": "Variation B", "value": "34.99" }
  ],
  "targeting": { "audienceId": null },
  "trafficAllocation": { "Control": 50, "Variation B": 50 },
  "goals": ["revenue", "conversion_rate"],
  "metrics": {
    "sessions": 12400,
    "conversions": 487,
    "revenue": 18920.5,
    "orderCount": 487
  }
}
```

***

#### `get_experiment_results`

Get session-based funnel analytics for an experiment: sessions → add-to-cart → purchases, broken down by variation, device type, and visitor type (new vs. returning).

**Parameters:**

* `experimentId` *(required)*: The ID of the experiment
* `testType` *(required)*: The type of test — `"price"`, `"shipping"`, `"theme"`, `"content"`, `"redirect"`, `"checkout"`, `"template"`, or `"offer"`
* `startDate` *(optional)*: Start date filter (`YYYY-MM-DD`). Defaults to test start date.
* `endDate` *(optional)*: End date filter (`YYYY-MM-DD`). Defaults to today or test end date.

**Example response:**

```json
{
  "variations": [
    {
      "name": "Control",
      "sessions": 6200,
      "addToCart": 744,
      "addToCartRate": 12.0,
      "purchases": 248,
      "conversionRate": 4.0,
      "revenue": 9430.2
    },
    {
      "name": "Variation B",
      "sessions": 6200,
      "addToCart": 806,
      "addToCartRate": 13.0,
      "purchases": 239,
      "conversionRate": 3.85,
      "revenue": 9490.3
    }
  ]
}
```

***

#### `get_experiment_statistics`

Get pre-computed **Bayesian statistics** for an experiment. Includes win probability, revenue lift, credible intervals, statistical significance, and per-variation conversion rate, revenue, and AOV.

> **Use this tool for winner determination and reporting.** Statistics are computed nightly. More accurate than `get_experiment_results` for significance analysis.

**Parameters:**

* `experimentId` *(required)*: The ID of the experiment
* `asOfDate` *(optional)*: Get stats for a specific date (`YYYY-MM-DD`). Defaults to the most recent snapshot.

**Example response:**

```json
{
  "testId": "64b2c3d4e5f6a7b8c9d0e1f2",
  "asOfDate": "2026-05-04",
  "variations": [
    {
      "name": "Control",
      "isControl": true,
      "sessions": 6200,
      "conversions": 248,
      "conversionRate": 4.0,
      "revenue": 9430.2,
      "aov": 38.02,
      "winProbability": 0.18
    },
    {
      "name": "Variation B",
      "isControl": false,
      "sessions": 6200,
      "conversions": 271,
      "conversionRate": 4.37,
      "revenue": 10621.3,
      "aov": 39.19,
      "winProbability": 0.82,
      "liftVsControl": {
        "conversionRate": {
          "median": 0.093,
          "credibleInterval": [0.021, 0.168]
        },
        "revenue": { "median": 0.126, "credibleInterval": [0.041, 0.215] }
      }
    }
  ],
  "isSignificant": true
}
```

***

#### `get_experiment_orders`

Retrieve raw Shopify orders attributed to a specific experiment. Useful for revenue deep-dives, AOV analysis, and per-variation purchasing behaviour.

**Parameters:**

* `experimentId` *(required)*: The ID of the experiment
* `testType` *(required)*: The type of test — `"price"`, `"shipping"`, `"theme"`, `"content"`, `"redirect"`, `"checkout"`, `"template"`, or `"offer"`
* `startDate` *(optional)*: Start date filter (ISO format, e.g. `2026-01-01`)
* `endDate` *(optional)*: End date filter (ISO format, e.g. `2026-05-01`)
* `productIds` *(optional)*: Array of Shopify product ID strings to filter orders by specific products. Use `get_products` to find IDs.
* `limit` *(optional)*: Number of orders to return (max 500, default 100)
* `skip` *(optional)*: Number of orders to skip for pagination (default 0)

**Example response:**

```json
{
  "total": 487,
  "limit": 100,
  "skip": 0,
  "data": [
    {
      "orderId": "5123456789",
      "orderNumber": 1042,
      "orderDate": "2026-04-15T14:22:00.000Z",
      "totalPrice": "39.99",
      "currency": "USD",
      "lineItems": [
        {
          "name": "Organic Cotton T-Shirt - Medium",
          "quantity": 1,
          "price": "34.99",
          "properties": [
            { "name": "_eraya_test_id", "value": "64b2c3d4e5f6a7b8c9d0e1f2" },
            { "name": "_eraya_variation", "value": "Variation B" }
          ]
        }
      ],
      "shippingLocation": {
        "city": "Austin",
        "province": "Texas",
        "country": "United States",
        "countryCode": "US"
      }
    }
  ]
}
```

> **Privacy:** Customer names, email addresses, phone numbers, and billing addresses are automatically stripped from all order responses.

***

### Store Data & Analytics

#### `get_store_orders`

Retrieve all store orders for a date range regardless of experiment. Useful for analysing overall revenue trends, discount usage, product popularity, and customer purchasing behaviour.

**Parameters:**

* `startDate` *(optional)*: Start date (ISO format, e.g. `2026-01-01`)
* `endDate` *(optional)*: End date (ISO format, e.g. `2026-05-01`)
* `productIds` *(optional)*: Array of Shopify product ID strings to filter to specific products
* `limit` *(optional)*: Number of orders to return (max 500, default 100)
* `skip` *(optional)*: Number of orders to skip for pagination (default 0)

**Example response:**

```json
{
  "total": 3240,
  "limit": 100,
  "skip": 0,
  "data": [
    {
      "orderId": "5123456790",
      "orderNumber": 1043,
      "orderDate": "2026-05-04T09:14:00.000Z",
      "totalPrice": "79.98",
      "currency": "USD",
      "discountCodes": [{ "code": "SPRING20", "amount": "20.00" }],
      "lineItems": [
        {
          "name": "Organic Cotton T-Shirt - Large",
          "quantity": 2,
          "price": "49.99"
        }
      ],
      "shippingLocation": {
        "city": "Portland",
        "province": "Oregon",
        "country": "United States",
        "countryCode": "US"
      }
    }
  ]
}
```

> **Privacy:** Customer names, email addresses, phone numbers, and billing addresses are automatically stripped from all order responses.

***

#### `get_products`

Retrieve the full product catalogue including variants, prices, inventory levels, and status.

**Parameters:**

* `search` *(optional)*: Search by product name or tags
* `status` *(optional)*: Filter by product status — `"active"`, `"draft"`, or `"archived"`
* `limit` *(optional)*: Number of products to return (max 500, default 100)
* `skip` *(optional)*: Number of products to skip for pagination (default 0)

**Example response:**

```json
{
  "total": 84,
  "data": [
    {
      "id": "7234567890",
      "name": "Organic Cotton T-Shirt",
      "status": "ACTIVE",
      "variants": [
        {
          "id": "var_001",
          "title": "Small",
          "price": "29.99",
          "inventory": 48
        },
        {
          "id": "var_002",
          "title": "Medium",
          "price": "29.99",
          "inventory": 62
        },
        { "id": "var_003", "title": "Large", "price": "29.99", "inventory": 35 }
      ],
      "tags": ["organic", "sustainable", "cotton"]
    }
  ]
}
```

***

#### `get_product_analytics`

Retrieve daily per-product analytics: page views, add-to-cart events, orders, revenue, units sold, and price. Useful for understanding product performance trends over time.

**Parameters:**

* `productId` *(optional)*: Filter to a specific product ID
* `startDate` *(optional)*: Start date (`YYYY-MM-DD`)
* `endDate` *(optional)*: End date (`YYYY-MM-DD`)
* `limit` *(optional)*: Number of records to return (max 500, default 100)
* `skip` *(optional)*: Number of records to skip for pagination (default 0)

**Example response:**

```json
{
  "total": 252,
  "limit": 100,
  "skip": 0,
  "data": [
    {
      "date": "2026-05-04",
      "productId": "7234567890",
      "productName": "Organic Cotton T-Shirt",
      "views": 312,
      "addToCart": 41,
      "addToCartRate": 13.1,
      "orders": 18,
      "conversionRate": 5.8,
      "revenue": 539.82,
      "unitsSold": 18,
      "price": 29.99
    }
  ]
}
```

***

#### `get_business_kpis`

Get store-level daily KPIs: sessions, revenue, conversion rate, and average order value (AOV). Useful for tracking overall store health trends.

**Parameters:**

* `period` *(required)*: Preset period — `"last7days"`, `"last30days"`, or `"last90days"`
* `startDate` *(optional)*: Custom start date (`YYYY-MM-DD`). Overrides `period` when provided with `endDate`.
* `endDate` *(optional)*: Custom end date (`YYYY-MM-DD`). Overrides `period` when provided with `startDate`.

**Example response:**

```json
{
  "period": "last7days",
  "startDate": "2026-04-28",
  "endDate": "2026-05-04",
  "data": [
    {
      "date": "2026-05-04",
      "sessions": 1842,
      "revenue": 7210.4,
      "conversionRate": 3.24,
      "aov": 121.05
    },
    {
      "date": "2026-05-03",
      "sessions": 1765,
      "revenue": 6890.2,
      "conversionRate": 3.18,
      "aov": 122.61
    }
  ]
}
```

***

### Shopify Store Data

#### `list_collections`

List product collections in the Shopify store. Useful for understanding catalogue structure, finding collection handles for redirect or content tests, or browsing how products are organised.

**Parameters:**

* `query` *(optional)*: Filter collections by title (case-insensitive substring match)
* `limit` *(optional)*: Number of collections to return (max 250, default 50)
* `after` *(optional)*: Cursor for pagination (`endCursor` from a previous response)

**Example response:**

```json
{
  "pageInfo": { "hasNextPage": false, "endCursor": null },
  "totalFetched": 3,
  "collections": [
    {
      "id": "gid://shopify/Collection/123456789",
      "title": "Summer Sale",
      "handle": "summer-sale",
      "url": "https://mystore.com/collections/summer-sale",
      "productsCount": 24,
      "updatedAt": "2026-04-10T12:00:00Z",
      "templateSuffix": null
    },
    {
      "id": "gid://shopify/Collection/987654321",
      "title": "New Arrivals",
      "handle": "new-arrivals",
      "url": "https://mystore.com/collections/new-arrivals",
      "productsCount": 12,
      "updatedAt": "2026-05-01T09:30:00Z",
      "templateSuffix": null
    }
  ]
}
```

***

#### `list_pages`

List content pages in the Shopify store (About Us, FAQ, Contact, Terms of Service, etc.). Useful for finding pages to run content or redirect tests on.

**Parameters:**

* `query` *(optional)*: Filter pages by title (case-insensitive substring match)
* `limit` *(optional)*: Number of pages to return (max 250, default 50)
* `after` *(optional)*: Cursor for pagination (`endCursor` from a previous response)

**Example response:**

```json
{
  "pageInfo": { "hasNextPage": false, "endCursor": null },
  "totalFetched": 4,
  "pages": [
    {
      "id": "gid://shopify/Page/111222333",
      "title": "About Us",
      "handle": "about-us",
      "url": "https://mystore.com/pages/about-us",
      "isPublished": true,
      "updatedAt": "2026-03-15T10:00:00Z",
      "templateSuffix": null
    },
    {
      "id": "gid://shopify/Page/444555666",
      "title": "FAQ",
      "handle": "faq",
      "url": "https://mystore.com/pages/faq",
      "isPublished": true,
      "updatedAt": "2026-04-20T14:30:00Z",
      "templateSuffix": null
    }
  ]
}
```

***

#### `search_policies`

Retrieve store policies: privacy policy, refund policy, terms of service, shipping policy, and subscription policy. Useful for answering customer policy questions or analysing policy content.

**Parameters:**

* `query` *(optional)*: Filter policies by keyword in title or body (case-insensitive). Omit to return all policies.

**Example response:**

```json
{
  "policies": [
    {
      "type": "privacy_policy",
      "title": "Privacy Policy",
      "url": "https://mystore.com/policies/privacy-policy",
      "body": "We collect information you provide directly to us..."
    },
    {
      "type": "refund_policy",
      "title": "Refund Policy",
      "url": "https://mystore.com/policies/refund-policy",
      "body": "We have a 30-day return policy..."
    },
    {
      "type": "terms_of_service",
      "title": "Terms of Service",
      "url": "https://mystore.com/policies/terms-of-service",
      "body": "By using our website, you agree to these terms..."
    },
    {
      "type": "shipping_policy",
      "title": "Shipping Policy",
      "url": "https://mystore.com/policies/shipping-policy",
      "body": "We ship to all 50 US states. Standard shipping takes 3-5 business days..."
    }
  ]
}
```
