> For the complete documentation index, see [llms.txt](https://docs.boldmetrics.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.boldmetrics.io/agentic-sizing-protocol.md). Agents can also search and read this documentation through its [MCP server](https://docs.boldmetrics.io/~gitbook/mcp).

# Agentic Sizing Protocol

A protocol for adding apparel size recommendations to agentic shopping experiences.

The Agentic Sizing Protocol (ASP) is for companies building agentic shopping experiences that want to add apparel sizing recommendations. If your platform lets shoppers browse or buy through an AI agent, whether that is a shopping assistant, a chat commerce surface, or an agentic checkout integration, ASP gives your agent runtime a safe way to collect shopper inputs over multiple turns and return a final size recommendation without reproducing sizing logic inside prompts or agent code.

ASP is built on four rules:

* **The agent never invents sizing questions.** ASP returns the exact questions to ask in `questions_needed`, and the agent asks those.
* **The runtime never calls the sizing engine directly.** ASP validates completeness and only invokes the underlying engine when the required inputs are complete.
* **Merchant credentials stay server-side.** The ASP token binds only to merchant credentials, never per-product metadata.
* **Recommendations are deterministic.** A final recommendation is returned only after the required input set is complete. No partial guesses.

The canonical ASP capability is `dev.asp.shopping.agentic_sizing`. ASP uses date-based versions in `YYYY-MM-DD` format, returned in the `asp.version` envelope on every response.

ASP is available over two transports that carry the same tool contract and return the same responses:

| Transport | Best for                                                                                   | How the agent reaches ASP                                                              |
| --------- | ------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------- |
| HTTPS     | Runtimes with their own tool-calling layer                                                 | You register `asp_get_size` and a small handler POSTs to `/asp/v1/size-recommendation` |
| MCP       | Runtimes with an MCP client, such as Claude, ChatGPT, or agent frameworks with MCP support | You connect to the ASP MCP server, and `asp_get_size` is discovered automatically      |

Pick one per integration. The question loop, statuses, session identifier, and response payloads are identical across both, so everything on this page applies to either transport. See [MCP Transport](#mcp-transport) for the MCP specifics.

{% hint style="info" %}
This page covers the native ASP integration, where your agent calls ASP as a tool and drives a multi-turn question flow. If you are exposing sizing to Google or Gemini, see [Google UCP Integration](https://docs.boldmetrics.io/google-ucp-integration.md) for the single-call UCP edge that sits in front of this same sizing core.
{% endhint %}

## How It Works

Your agent calls ASP the same way it calls any other tool. The whole flow is one loop:

1. When a shopper wants sizing help for a product, the model calls the ASP tool with the `product_id`, plus `product_context` carrying whatever your product data knows. ASP must be able to resolve `product_gender`, `desired_brand`, and `desired_garment_type` for every request, and it has three deterministic ways to do it: the explicit values you send, its own catalog record for the `product_id`, or a validated fallback derived from `brand` plus `garment_type` or `category`.
2. ASP responds with a session identifier (`anon_id`) plus either questions or a recommendation. If the status is `inputs_required`, the agent asks the shopper the exact questions returned in `questions_needed`.
3. The model merges the shopper's answers into a single `collected_inputs` object and calls the tool again with the full set of answers collected so far.
4. Steps 2 and 3 repeat until ASP returns a terminal status, and the agent presents the recommendation to the shopper.

The status values your runtime will handle are:

| Status                  | Type         | Meaning                                                                                                                    |
| ----------------------- | ------------ | -------------------------------------------------------------------------------------------------------------------------- |
| `inputs_required`       | Non-terminal | Flow in progress. Ask `questions_needed` and call again                                                                    |
| `ok`                    | Terminal     | Recommendation returned                                                                                                    |
| `low_confidence`        | Terminal     | Recommendation returned, below the confidence threshold                                                                    |
| `product_not_supported` | Terminal     | ASP cannot size this product. Reserved: today an unsupported product returns an `error` with `product_mapping_unsupported` |
| `error`                 | Terminal     | Protocol or upstream error. See `reason_codes`                                                                             |

## Prerequisites

Before integrating ASP, make sure you have:

* Your ASP base URL (or ASP MCP server URL, if you use the MCP transport) and ASP token, provided by Bold Metrics during onboarding. The token identifies the merchant credential set only, for example `client_id` and `user_key`, and must be stored securely on your side
* A stable `product_id` from your catalog or commerce platform
* Conversation state in your agent runtime that can hold the `anon_id` ASP issues until the purchase completes

## The Integration: One Tool, One Handler

Agents consume ASP as a tool. There are two layers, and keeping them separate is the point:

* **What the model sees** is a tool definition: a name, a description, and an input schema registered with your agent framework. The model decides when to call it and fills in the arguments.
* **What your tool handler does** is make one HTTPS request, adding the ASP token and managing the session identifier. The model never sees the token and never manages session state.

Register the tool and implement the handler below, and the integration is done. The model runs the question loop on its own, because the tool description tells it how.

### The tool definition

```json
{
  "name": "asp_get_size",
  "description": "Get an apparel size recommendation for a shopper and product. Call this before asking the shopper any sizing questions. The response either contains follow-up questions to ask the shopper (status inputs_required) or a final recommendation. When the shopper answers, call this tool again with all answers collected so far in collected_inputs.",
  "input_schema": {
    "type": "object",
    "required": ["product_id"],
    "properties": {
      "product_id": {
        "type": "string",
        "description": "Merchant product identifier for the apparel item being sized."
      },
      "product_context": {
        "type": "object",
        "required": [],
        "properties": {
          "product_gender": {
            "type": "string",
            "enum": ["men", "women", "unknown"],
            "description": "Whether the product uses men's or women's sizing, from the product data. Send unknown or omit the field if the product data does not say; never guess."
          },
          "desired_brand": {
            "type": "string",
            "description": "Explicit brand identifier from the merchant's product data. Omit if unknown; never guess."
          },
          "desired_garment_type": {
            "type": "string",
            "description": "Explicit garment type identifier from the merchant's product data. Omit if unknown; never guess."
          },
          "brand": {
            "type": "string",
            "description": "Brand name from the product data. Used for fallback mapping when desired_brand is unavailable."
          },
          "garment_type": {
            "type": "string",
            "description": "Product type or subtype from the product data. Used for fallback mapping when desired_garment_type is unavailable."
          },
          "category": {
            "type": "string",
            "description": "High-level product category such as tops or bottoms. Used for fallback mapping when garment_type is unavailable."
          }
        },
        "description": "Product metadata ASP uses to resolve the sizing question set and the downstream product parameters. Pass every value the product data provides and omit the rest; ASP applies a deterministic precedence over what it receives.",
        "additionalProperties": true
      },
      "collected_inputs": {
        "type": "object",
        "description": "All shopper answers collected so far in this sizing flow, keyed by the field names ASP returned in questions_needed. Always send the full cumulative set, not just the latest answer.",
        "additionalProperties": true
      }
    },
    "additionalProperties": false
  }
}
```

{% hint style="info" %}
This is the standard tool-calling shape, so it ports across frameworks with one rename: Claude calls the schema field `input_schema`, while OpenAI and Gemini call the same object `parameters`. Everything inside it is unchanged. If you use OpenAI's strict mode, it additionally requires `additionalProperties: false` on every nested object and every property listed in `required`, so `product_context` needs adjusting for that mode specifically.
{% endhint %}

### The handler

Every tool call becomes one HTTPS request:

|                 |                                                 |
| --------------- | ----------------------------------------------- |
| Method          | `POST`                                          |
| Path            | `/asp/v1/size-recommendation`                   |
| Authentication  | `Authorization: Bearer <ASP_TOKEN>` header      |
| Body            | The tool call arguments plus `anon_id`, as JSON |
| First call only | `Idempotency-Key: <opaque-client-key>` header   |

The tool schema deliberately leaves out `anon_id`. Your handler injects it into each request the same way it injects the ASP token, so the model never has to remember or retype the session identifier. A mistyped ID would silently split the flow:

```js
async function handleAspGetSize(input, session) {
  const saved = session.anonId;

  const response = await fetch(`${ASP_BASE_URL}/asp/v1/size-recommendation`, {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${process.env.ASP_TOKEN}`,
      'Content-Type': 'application/json',
      ...(saved ? {} : { 'Idempotency-Key': session.id }),
    },
    body: JSON.stringify(saved ? { ...input, anon_id: saved } : input),
  }).then((r) => r.json());

  if (!saved && response.anon_id) {
    session.anonId = response.anon_id;
  }

  return response;
}
```

The handler returns ASP's response as the tool result, unmodified. The model reads `questions_needed` from it, asks the shopper, and calls the tool again. No sizing logic lives in the prompt or the handler.

{% hint style="info" %}
The protocol status lives in the response body, not the HTTP status code. A `200` response can carry `inputs_required`, `ok`, or `low_confidence`. Non-`200` codes map to `status: "error"` responses: `400` for `invalid_request` and every `product_mapping_*` code, `401` for an invalid token, `404` for an unknown product, `409` for `idempotency_conflict`, `429` for rate limiting, `503` for an unavailable upstream, and `504` for an upstream timeout. Note that an unresolvable product mapping is a `400`, not a `404`, because the product may well exist.

Error responses include an `error_code`, a `request_id` for support, and a `retryable` flag. Branch your retry logic on the `retryable` flag rather than matching `error_code` against a list of your own, so your handler stays correct as codes are added.
{% endhint %}

{% hint style="info" %}
The full canonical tool definition, including the runtime contract for credential handling and the protocol state machine, is published in the ASP specification as `asp_get_size`. The schema above is the model-facing subset most agent frameworks need.
{% endhint %}

## MCP Transport

If your agent runtime speaks the [Model Context Protocol](https://modelcontextprotocol.io), you can skip writing the tool definition and HTTPS handler and connect to the ASP MCP server instead. The server exposes the same `asp_get_size` tool, runs the same sizing core, and returns the same response bodies documented on this page.

### Connecting

|                |                                                                                                                                                      |
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| Transport      | MCP Streamable HTTP                                                                                                                                  |
| Server URL     | One ASP MCP server URL for all merchants, provided by Bold Metrics during onboarding. Your credential, not the URL, identifies your merchant account |
| Authentication | ASP token as a Bearer header, or MCP OAuth                                                                                                           |
| Tools exposed  | `asp_get_size`                                                                                                                                       |

ASP supports two ways to authenticate. Both resolve to the same merchant credential set, and the model sees neither. Use the Bearer token unless your MCP client only accepts OAuth.

**Bearer token (recommended).** For agent runtimes you operate yourself, which covers most merchant integrations. Configure the ASP token in your MCP client's connection settings so it is sent as `Authorization: Bearer <ASP_TOKEN>` on every request. Never put it in the prompt or in tool arguments.

```json
{
  "mcpServers": {
    "bold-metrics": {
      "type": "http",
      "url": "<ASP_MCP_SERVER_URL>",
      "headers": {
        "Authorization": "Bearer ${ASP_TOKEN}"
      }
    }
  }
}
```

The exact configuration format depends on your MCP client; the shape above is typical.

**OAuth.** For hosted MCP clients that only accept OAuth connectors, such as custom connectors added to a Claude or ChatGPT workspace by your team. ASP follows the MCP authorization specification:

1. The client connects without credentials and receives an HTTP `401` with a `WWW-Authenticate` header pointing at the ASP protected resource metadata.
2. The client discovers the ASP authorization server from that metadata and starts an OAuth 2.1 authorization code flow with PKCE, requesting the `asp:sizing` scope. ASP supports dynamic client registration, so clients can connect without being registered with Bold Metrics first.
3. Someone on your team signs in with your Bold Metrics account and approves access. Shoppers never see this step.
4. The client receives an access token scoped to that merchant and sends it as a Bearer token on every MCP request, refreshing it as needed.

Most MCP clients run this flow for you once you add the server URL. Once connected by either method, the client discovers `asp_get_size` through `tools/list`, with the same description and input schema shown in [The tool definition](#the-tool-definition), plus an optional `anon_id` argument described below. The tool also declares an `outputSchema` for its result and carries the `readOnlyHint: true` annotation: a sizing call changes nothing on the shopper's behalf, so clients that ask for approval before side-effecting tools do not interrupt the shopper for it.

### Calling the tool

The model calls the tool with a standard MCP `tools/call` request. The arguments are the same as over HTTPS, plus the `anon_id` on follow-up calls:

```json
{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "tools/call",
  "params": {
    "name": "asp_get_size",
    "arguments": {
      "product_id": "farah-tshirt-123",
      "anon_id": "8b1f0c1a-4a1e-4b6c-9f4e-2d7a9c1e5b30",
      "product_context": {
        "product_gender": "men",
        "desired_brand": "farah",
        "desired_garment_type": "mens_tshirts"
      },
      "collected_inputs": {
        "height": "5 ft 10 in",
        "weight": "170 lb"
      }
    }
  }
}
```

The ASP response body is returned in the tool result as `structuredContent`, with the same JSON serialized in a `text` content block for clients that do not read structured content. The model reads `status` and `questions_needed` from it exactly as it would from the HTTPS response.

### Session identifier over MCP

Over HTTPS, your handler adds `anon_id` to each request. Over MCP there may be no code of yours between the model and ASP, so `anon_id` travels as a tool argument instead:

* On the first call, omit `anon_id`. ASP issues one and returns it in the response.
* On every follow-up call in the same sizing flow, pass the `anon_id` from the first response unchanged. The MCP tool description instructs the model to do this.
* Keep the `anon_id` from the tool result in your conversation state for checkout linking and purchase reporting.

If your runtime can intercept tool calls before they reach the MCP server, for example through a proxy or a tool-call hook, inject `anon_id` from conversation state there instead of relying on the model, so a mistyped ID cannot split the flow.

Do not use the MCP session (`Mcp-Session-Id`) as the sizing session. MCP clients decide when sessions open and close, and hosted clients may reuse one session across conversations or reconnect in the middle of one. ASP does not tie `anon_id` to the MCP session, so a reconnect never loses the flow and two conversations on one session never share an ID. All the rules in [The Session Identifier](#the-session-identifier) apply unchanged, including discarding `anon_id` when the conversation ends.

### Retries

There is no idempotency key to manage over MCP. If a first call is retried before its response arrives, ASP may issue two `anon_id` values. Use the one from the response the model acts on, and the other expires unused. Retried follow-up calls are safe because they carry the established `anon_id`.

### Errors over MCP

Protocol outcomes are carried in the tool result, not as JSON-RPC errors. An ASP `error` response, such as `product_mapping_missing` or an upstream timeout, comes back as a tool result with `isError: true` and the same `status: "error"` body, including `error_code`, `request_id`, and `retryable`. Branch on `retryable` just as you would over HTTPS.

JSON-RPC errors are reserved for MCP-level failures, such as an unknown tool name or a malformed request. A missing, invalid, or expired credential is rejected with HTTP `401` before any tool is called; OAuth clients should refresh the token or rerun the authorization flow.

## Product Data Requirements

ASP needs three resolved values to size a product: `product_gender`, `desired_brand`, and `desired_garment_type`.

| Field                  | Values                                                    | If ASP cannot resolve it                               |
| ---------------------- | --------------------------------------------------------- | ------------------------------------------------------ |
| `product_gender`       | `men` or `women`                                          | ASP asks the shopper as the first question             |
| `desired_brand`        | Brand identifier from your Bold Metrics onboarding        | Call fails with `product_mapping_missing` (HTTP `400`) |
| `desired_garment_type` | Garment type identifier from your Bold Metrics onboarding | Call fails with `product_mapping_missing` (HTTP `400`) |

ASP resolves `desired_brand` and `desired_garment_type` through a fixed precedence, and reports which step it used in `resolved_product_context.mapping_source`:

| Precedence | What ASP uses                                                                     | `mapping_source`     |
| ---------- | --------------------------------------------------------------------------------- | -------------------- |
| 1          | Explicit `desired_brand` **and** `desired_garment_type` in your `product_context` | `explicit`           |
| 2          | A server-side catalog record for your `product_id`                                | `catalog_record`     |
| 3          | Validated fallback from `brand` plus `garment_type` or `category`                 | `validated_fallback` |

Pass explicit values when your feed has them, because step 1 is the only path that needs nothing configured server-side. Step 3 requires fallback mappings registered for your account during onboarding, and an ambiguous match fails with `product_mapping_ambiguous` rather than picking one. A product that ASP knows but does not support fails with `product_mapping_unsupported`.

ASP never guesses. It resolves each value through one of those three steps, asks the shopper (for `product_gender` only), or fails with an explicit error.

{% hint style="warning" %}
`product_name` is diagnostic only. ASP will not infer product mapping from free-form product names. Pass `desired_brand` and `desired_garment_type` explicitly, or enough context for ASP to derive them deterministically. The `resolved_product_context` object in every response tells you what mapping ASP used and its `mapping_source`.
{% endhint %}

## The Session Identifier

In ASP, the session is the agent conversation. `anon_id` is a random identifier scoped to one conversation: it ties together the ASP calls within that conversation and the purchase that completes in it, so the recommendation can be attributed. It is not meant to recognize the shopper across conversations, and it should not outlive the conversation it was created for.

**You do not need to create it.** The handler above already implements the full lifecycle:

1. The first call omits `anon_id` and carries an `Idempotency-Key` header, so a retried first call receives the same identifier instead of starting a second flow.
2. ASP issues the identifier and returns it in the response `anon_id` field; the handler keeps it in conversation state.
3. The handler includes it on every follow-up call, and your attribution calls carry it when checkout completes.
4. Discard it when the conversation ends or the purchase has been attributed, whichever comes first.

At purchase, `anon_id` is tied to the order identifier over two calls: first link the checkout, sending the `anon_id` inside `asp_attribution`, then report the purchase with that `checkout_id` and your `order_id`. Reporting a purchase against a checkout that was never linked is rejected, as is an `anon_id` that does not match the linked checkout. From then on the order record carries the linkage, so a later event like a return two weeks after the purchase can still be connected to the sizing recommendation with no conversation identifier persisting anywhere. Because the value is randomly generated, contains no personal information, and is destroyed at the end of the conversation, it does not build up a profile of the shopper.

Key the conversation state by something stable for the whole conversation, such as the conversation or thread ID. A per-request or per-turn ID does not work, because the value must still be available when the purchase completes.

{% hint style="info" %}
If your agent hands the shopper off to an external checkout that completes outside the conversation, pass the same `anon_id` through with that handoff so purchase reporting can still include it. If the identifier cannot travel with the handoff, attribution ends there.
{% endhint %}

**Prefer to supply your own?** Runtimes that already manage a suitable random conversation identifier may pass their own `anon_id` on the first call instead of adopting the issued one. A supplied value must be random (a UUIDv4 works) and scoped to the conversation, and ASP echoes it back the same way.

**What not to do:**

* Do not switch to a different `anon_id` mid-conversation; every follow-up call echoes the established value
* Do not persist `anon_id` beyond the conversation or reuse it in a later one
* Do not use a logged-in account ID or email address as `anon_id`, and do not keep a mapping from `anon_id` to an account, email, or other identity data
* Do not encode `product_id` or other request-specific values into a supplied `anon_id`
* Do not use one ID for the sizing calls and a different ID in purchase reporting

## Response Reference

The tool and handler above are the whole integration. This section is reference for the responses ASP returns, for building your shopper experience and debugging your handler.

### `inputs_required`: questions to ask

When ASP needs shopper data, it returns the exact questions with their formats and units:

```json
{
  "asp": {
    "version": "2026-07-09",
    "capabilities": [
      { "name": "dev.asp.shopping.agentic_sizing", "version": "2026-07-09" }
    ]
  },
  "status": "inputs_required",
  "anon_id": "8b1f0c1a-4a1e-4b6c-9f4e-2d7a9c1e5b30",
  "resolved_product_gender": "men",
  "resolved_product_context": {
    "desired_brand": "farah",
    "desired_garment_type": "mens_tshirts",
    "product_gender": "men",
    "mapping_source": "explicit"
  },
  "applicable_fields": ["height", "weight", "jean_waist", "age"],
  "missing_fields": ["height", "weight", "jean_waist", "age"],
  "questions_needed": [
    {
      "field": "height",
      "prompt": "What is your height? You can answer in feet and inches or centimeters.",
      "type": "string",
      "normalizes_to": "height",
      "normalized_unit": "in",
      "accepted_units": ["ft_in", "cm"],
      "examples": ["5 ft 10 in", "178 cm"]
    },
    {
      "field": "jean_waist",
      "prompt": "What jean waist size do you usually wear?",
      "type": "string",
      "normalizes_to": "waist_circum_preferred",
      "normalized_unit": "in",
      "accepted_units": ["in"],
      "examples": ["30 in"]
    }
  ]
}
```

The agent asks these exact questions, preserving field names, accepted formats, and units. Do not flatten the ASP question model into a generic measurement form. ASP may ask shopper-friendly aliases such as `jean_waist` while separately telling you which internal field that answer maps to; the `normalizes_to` value here is the internal `waist_circum_preferred` measurement.

The response separates `applicable_fields` (the full set of fields relevant for the current product) from `missing_fields` (the subset still requiring shopper input), so the runtime can see both the target shape of the flow and the remaining work.

ASP chooses the question set by product gender:

| Product gender | Field set                                                       |
| -------------- | --------------------------------------------------------------- |
| `men`          | `height`, `weight`, `jean_waist`, `age`                         |
| `women`        | `height`, `weight`, `bra_size`, `age`, and `locale` when needed |
| `unknown`      | ASP may request `product_gender` before selecting the final set |

These are the mandatory base sets, not the whole story: the resolved `desired_garment_type` can layer additional fields on top, such as `shoe_size_us` for men's jeans. Read the field set off `applicable_fields` on every response rather than assuming the base set.

These rules are protocol behavior. Do not replicate them as hard-coded shopper forms.

### Follow-up calls: cumulative answers

Each follow-up tool call carries the **full** `collected_inputs` object accumulated so far, not just the most recent answer. ASP reevaluates completeness from the full set of known answers. The tool description already instructs the model to do this; the handler adds the `anon_id`:

```json
{
  "product_id": "farah-tshirt-123",
  "anon_id": "8b1f0c1a-4a1e-4b6c-9f4e-2d7a9c1e5b30",
  "collected_inputs": {
    "height": "5 ft 10 in",
    "weight": "170 lb",
    "jean_waist": "32 in",
    "age": 34
  }
}
```

ASP accepts unit-bearing values and normalizes them before making a recommendation: feet/inches or centimeters for height, pounds or kilograms for weight, locale-aware `bra_size` when paired with `locale`. Preserve shopper intent and pass the structured answer back as ASP requested it; ASP owns normalization.

ASP never calls the underlying sizing engine with partial data. If the required fields are not complete, the protocol outcome is `inputs_required`, not a partial or tentative recommendation. This keeps the protocol deterministic and prevents agents from treating guesses as recommendations.

### Terminal statuses: the recommendation

When ASP reaches a terminal outcome, the `recommendation` object is the canonical final payload:

```json
{
  "asp": {
    "version": "2026-07-09",
    "capabilities": [
      { "name": "dev.asp.shopping.agentic_sizing", "version": "2026-07-09" }
    ]
  },
  "status": "ok",
  "anon_id": "8b1f0c1a-4a1e-4b6c-9f4e-2d7a9c1e5b30",
  "resolved_product_context": {
    "desired_brand": "farah",
    "desired_garment_type": "mens_tshirts",
    "product_gender": "men",
    "mapping_source": "explicit"
  },
  "recommendation": {
    "size": "M",
    "confidence": 0.86,
    "fit_breakdown": {
      "chest": "slightly_snug",
      "waist": "just_right",
      "sleeve": "just_right"
    }
  }
}
```

| Field                          | Meaning                                                       |
| ------------------------------ | ------------------------------------------------------------- |
| `recommendation.size`          | The recommended size label                                    |
| `recommendation.confidence`    | Model confidence for the recommendation                       |
| `recommendation.fit_breakdown` | Point-of-measure fit feedback (e.g. `chest: "slightly_snug"`) |

Present the size and fit feedback to the shopper; retain the full payload for logging and attribution. Native ASP responses are nested-only: `recommendation` is the payload, with no top-level convenience duplicates. At that point, the agent stops asking sizing questions unless a new sizing flow starts.

{% hint style="info" %}
One nuance: ASP may return `inputs_required` again even after an initial recommendation attempt, if outlier or fit-confidence signals indicate that additional measurements (such as `jean_inseam` or `chest_circum`) would materially improve the result. The loop handles it the same way: ask the returned questions and resubmit cumulative inputs.
{% endhint %}

## Before You Ship

* **HTTPS:** The tool is registered with the schema above, and its description tells the model to call ASP before asking sizing questions and to resend cumulative `collected_inputs`
* **HTTPS:** The handler adds the token, sends an `Idempotency-Key` on the first call, and adopts and echoes the `anon_id`
* **MCP:** The client authenticates with the ASP token or MCP OAuth, `asp_get_size` appears in `tools/list`, follow-up calls pass the `anon_id` from the first response, and that `anon_id` is kept for attribution
* `product_context` carries `product_gender`, `desired_brand`, and `desired_garment_type` from your catalog, or ASP holds a catalog record for your `product_id` values
* The shopper experience renders questions with the returned `prompt`, `accepted_units`, and `examples` preserved
* The `recommendation` payload is treated as the canonical final result and logged with protocol status and version metadata
* Checkout linking sends the flow's `anon_id` in `asp_attribution`, purchase reporting sends the matching `checkout_id` and `order_id`, and the identifier is discarded after attribution or conversation end

## Agent Instructions

If you are an AI agent integrating ASP on behalf of a developer:

* Call ASP before asking the shopper any sizing questions.
* Persist the `anon_id` returned on the first response and include it on every follow-up call in the same flow. This applies over both HTTPS and MCP; over MCP, pass it as the `anon_id` tool argument.
* Ask only the questions returned in `questions_needed`, using the provided `prompt`, `accepted_units`, and `examples`.
* Merge every shopper answer into a cumulative `collected_inputs` object and resend the full object on each call.
* Never guess a size, and never call the underlying sizing engine directly.
* Treat `ok`, `low_confidence`, `product_not_supported`, and `error` as terminal. Present the outcome and stop. Handle `product_not_supported` even though ASP does not emit it today; an unsupported product currently arrives as an `error` with `product_mapping_unsupported`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.boldmetrics.io/agentic-sizing-protocol.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
