Agent Gateway 10 min read

Tool Reference

All tools require a valid Authorization: Bearer sk_live_... header. Credits are deducted atomically before execution — if balance is insufficient, a 402 error is returned.

The gateway exposes 8 tools — creating a site, listing/analyzing sites, generating and managing A/B test ideas, and creating/inspecting experiments.


create_site

Register a new website in your workspace for A/B testing. Returns the site ID along with the SplitKit tracking snippet and install instructions — the snippet must be added to the <head> of the target site before experiments can run.

Subject to the workspace's plan-based site limit (Starter: 1, Pro: 10, Enterprise: 25). Duplicate domains in the same workspace are rejected with a conflict error.

Credits: 5 Parameters:

Name Type Required Description
url string yes The website URL (e.g. https://example.com). Protocol is added if missing.
name string no Display name. Defaults to the domain (e.g. example.com).

Example (MCP):

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "create_site",
    "arguments": { "url": "https://mystore.com", "name": "My Store" }
  }
}

Response:

{
  "site": {
    "id": "ca7ee226-ebf1-4485-b993-a61c82464b35",
    "name": "My Store",
    "url": "https://mystore.com/",
    "public_key": "39cfc3dd2e26d9452e545073b7fdb29f"
  },
  "snippet": "<script src=\"https://splitkit.dev/s/39cfc3dd2e26d9452e545073b7fdb29f.js\"></script>",
  "instructions": "Site \"My Store\" created successfully (ID: ca7ee226-...).\n\nAdd this snippet to the <head> of https://mystore.com/, before any other scripts:\n\n<script src=\"https://splitkit.dev/s/39cfc3dd2e26d9452e545073b7fdb29f.js\"></script>\n\nThe script is synchronous and <1KB — placing it first in <head> prevents A/B variant flicker.\nOnce installed, call generate_ideas to generate AI-powered test ideas for this site."
}

After creating a site, the typical flow is: call generate_ideas with the returned site.id to produce AI-informed test ideas, then create_experiment to launch a test from one of them.


list_sites

List all websites registered in your workspace.

Credits: 1
Parameters: none

Example (MCP):

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "list_sites",
    "arguments": {}
  }
}

Response:

{
  "sites": [
    {
      "id": "uuid",
      "name": "My Store",
      "url": "https://mystore.com",
      "platform": "shopify",
      "crawl_status": "complete",
      "created_at": "2025-01-01T00:00:00Z"
    }
  ]
}

get_site_intelligence

Get AI-analyzed intelligence for a site: industry, business model, target audience, value propositions, competitors, and top keywords.

Credits: 2
Parameters:

Name Type Required Description
site_id string yes From list_sites

Response:

{
  "intelligence": {
    "industry": "e-commerce",
    "business_model": "DTC",
    "target_audience": "...",
    "value_propositions": ["..."],
    "brand_tone": "friendly",
    "pain_points": ["..."],
    "updated_at": "..."
  },
  "keywords": [
    { "keyword": "natural skincare", "tier": "primary", "relevance_score": 0.95 }
  ],
  "competitors": [
    { "domain": "competitor.com", "name": "Competitor", "confidence_score": 0.8 }
  ]
}

list_ideas

List A/B test ideas for a site.

Credits: 1
Parameters:

Name Type Required Description
site_id string yes From list_sites
status string no new | approved | implemented | rejected | archived
limit number no Max results, default 20, max 100

Response:

{
  "ideas": [
    {
      "id": "uuid",
      "title": "Test CTA button color",
      "hypothesis": "Changing from grey to green will increase CTR by 15%",
      "category": "cta",
      "priority": "high",
      "status": "new",
      "estimated_impact": "high",
      "created_at": "..."
    }
  ]
}

generate_ideas

Use AI to analyze a site and generate new CRO-informed A/B test ideas. Makes a live AI call — allow 15–30 seconds.

Credits: 10
Parameters:

Name Type Required Description
site_id string yes From list_sites
num_ideas number no Ideas to generate, default 5, max 10

Response:

{
  "success": true,
  "ideas": [
    {
      "id": "uuid",
      "title": "...",
      "hypothesis": "...",
      "category": "layout",
      "priority": "medium"
    }
  ]
}

list_experiments

List A/B experiments for a site.

Credits: 1
Parameters:

Name Type Required Description
site_id string yes From list_sites
status string no draft | active | paused | completed | archived
limit number no Max results, default 20

get_experiment

Get full details for an experiment including all variants and goals.

Credits: 2
Parameters:

Name Type Required Description
experiment_id string yes From list_experiments

create_experiment

Create a new A/B experiment.

Credits: 5
Parameters:

Name Type Required Description
site_id string yes From list_sites
name string yes Experiment name
idea_id string no Link to an existing idea
variants array no [{ name: string, traffic_split?: number }]

Error Responses

Status Meaning
401 Invalid or missing API key
402 Insufficient credits
403 API access not enabled for workspace
404 Tool or resource not found
500 Upstream error

For MCP, errors are returned as isError: true in the tool result content. For A2A, status.state is "failed".


SplitKit Runtime Integration

Once a site is created and experiments are running, the SplitKit snippet exposes a synchronous JavaScript API that lets any code on the page read which variant the current visitor was assigned to.

How the snippet works

The snippet (<script src="https://splitkit.dev/s/{public_key}.js"></script>) runs synchronously in <head> before first paint. By the time DOMContentLoaded fires, the window.__sk object is fully populated:

window.__sk = {
  v:   'visitor-uuid',   // persistent visitor ID (localStorage)
  s:   'session-uuid',   // session ID (sessionStorage)
  dt:  'desktop',        // 'desktop' | 'tablet' | 'mobile'
  sk:  'site-public-key',
  a:   [                 // one entry per running experiment
    {
      eid: 'experiment-uuid',  // experiment ID
      vid: 'variant-uuid',     // assigned variant ID
      ic:  false,              // true if this is the control variant
      gs:  [...],              // goals
      ch:  [...]               // DOM changes (mutations)
    }
  ],
  preview: false         // true when ?sk_preview=<variantId> is in the URL
}

Reading the assigned variant

Use window.__sk.getVariant(experimentId) — it returns { variantId, isControl } or null if the experiment isn't running:

var assignment = window.__sk && window.__sk.getVariant('YOUR_EXPERIMENT_UUID')
// { variantId: 'abc123...', isControl: false }  — or null

Find your experiment UUID in the dashboard URL (/experiments/{uuid}) or via the get_experiment tool.

This is the standard pattern for a pricing page where Variant B shows a discounted price with a different Stripe payment link:

<!-- 1. SplitKit snippet — must be first script in <head> -->
<script src="https://splitkit.dev/s/YOUR_PUBLIC_KEY.js"></script>

<!-- 2. Price text and buy button in your markup -->
<span id="sk-price">$29/mo</span>
<a id="sk-buy-btn" href="https://buy.stripe.com/CONTROL_LINK">Get started</a>

<!-- 3. Variant bridge — reads assignment, updates DOM before paint -->
<script>
  (function () {
    var EXP_ID = 'YOUR_EXPERIMENT_UUID'
    var VARIANTS = {
      'CONTROL_VARIANT_UUID': {
        price: '$29/mo',
        href:  'https://buy.stripe.com/CONTROL_LINK'
      },
      'VARIANT_B_UUID': {
        price: '$19/mo',
        href:  'https://buy.stripe.com/VARIANT_B_LINK'
      }
    }

    var assignment = window.__sk && window.__sk.getVariant(EXP_ID)
    var v = (assignment && VARIANTS[assignment.variantId]) || VARIANTS['CONTROL_VARIANT_UUID']

    document.getElementById('sk-price').textContent = v.price
    document.getElementById('sk-buy-btn').href = v.href
  })()
</script>

Place the bridge <script> immediately after any element it reads — since the SplitKit snippet already ran synchronously, window.__sk is available inline.

Recipe: show/hide entire sections

var assignment = window.__sk && window.__sk.getVariant('YOUR_EXPERIMENT_UUID')
var isVariantB = assignment && !assignment.isControl

document.getElementById('section-a').style.display = isVariantB ? 'none'  : ''
document.getElementById('section-b').style.display = isVariantB ? ''      : 'none'

Preview mode

Append ?sk_preview=VARIANT_UUID to any URL to force a specific variant without being tracked. Useful when testing your bridge code before the experiment is live.

Finding your IDs

Value Where to find it
Experiment UUID Dashboard URL /experiments/{uuid} or get_experiment tool response
Variant UUIDs get_experimentvariants[].id
Public key create_site or list_sitessites[].public_key