Skip to main content
Glama

create_cart

Idempotent

Create a shopping cart in Demo Store. Returns a cart_id (the same value as checkout_session_id in preview_checkout, complete_checkout and get_trust_receipt) for use with get_shipping_rates, preview_checkout, and complete_checkout.

SKYFIRE TOKEN (optional): Provide a kya or kya-pay Skyfire token in the skyfire-pay-id request header to boost your agent trust score (up to +0.35), which may unlock better pricing or priority service. No token required — request proceeds with neutral trust score (0.50) if omitted or invalid. Checkout guide: https://trusteed.xyz/.well-known/agent-checkout-guide.json. CREDENTIAL: this store needs one. Call the create_sandbox_key tool first (it is in this tool list and needs no credential), then pass the key you get back as the agent_key argument — or as an Authorization: Bearer header if your client can set headers. Do not ask a person to log in: there is no human login for this store.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
itemsYesItems to add to cart
agent_keyNoSandbox credential from `create_sandbox_key`. Use this when your client cannot set an `Authorization: Bearer` header.
agent_tokenNoJWS compact (EdDSA/Ed25519) signed by the agent. Required for Shopify enforcement rules R001/R002/R004. The token is embedded as a server-authoritative cart attribute — Trusteed does NOT verify the signature here; that is done offline by the Shopify Function WASM.
display_contextNoAgent display capability: webview (browser) or headlessheadless
idempotency_keyNoIdempotency key for this cart creation (UUID-v4 or bounded ASCII token, 1-128 chars). Equivalent to the `Idempotency-Key` header — send it here if your client cannot set headers. Retrying with the same key returns the same cart instead of creating a second one.
agent_session_idNoOpaque agent session identifier for cart resume across sessions

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
itemsYes
statusYes
cart_idYes
currencyYes
next_stepYes
expires_atNoISO-8601 UTC instant at which this checkout SESSION stops being usable. It is not a stock reservation and not a price guarantee.
store_nameYes
session_stateYes
subtotal_centsYes
display_contextYes
agent_session_idYes
expires_in_secondsNoWhole seconds left on this checkout SESSION at response time (0 when already past). It is not a stock reservation and not a price guarantee.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • addedOutput schema / properties / expires_at
      Added value: +{
      +  "description": "ISO-8601 UTC instant at which this checkout SESSION stops being usable. It is not a stock reservation and not a price guarantee.",
      +  "type": "string"
      +}
    • addedOutput schema / properties / expires_in_seconds
      Added value: +{
      +  "description": "Whole seconds left on this checkout SESSION at response time (0 when already past). It is not a stock reservation and not a price guarantee.",
      +  "minimum": 0,
      +  "type": "integer"
      +}
  2. Changed2 schema fields changed
    • addedOutput schema / properties / next_step
      Added value: +{
      +  "type": "string"
      +}
    • changedOutput schema / required
      Previous value: -[
      -  "cart_id",
      -  "store_name",
      -  "items",
      -  "subtotal_cents",
      -  "currency",
      -  "status",
      -  "agent_session_id",
      -  "session_state",
      -  "display_context"
      -]New value: +[
      +  "cart_id",
      +  "store_name",
      +  "items",
      +  "subtotal_cents",
      +  "currency",
      +  "status",
      +  "agent_session_id",
      +  "session_state",
      +  "display_context",
      +  "next_step"
      +]
  3. Changed2 schema fields changed
    • addedOutput schema / properties / items / items / properties / line_price_cents
      Added value: +{
      +  "type": "number"
      +}
    • addedOutput schema / properties / items / items / properties / unit_price_cents
      Added value: +{
      +  "type": "number"
      +}
  4. Changed1 schema field changed
    • addedOutput schema / properties / items / items / properties / image
      Added value: +{
      +  "type": "string"
      +}
  5. Changed1 schema field changed
    • removedInput schema / properties / payment_mandate
      Removed value: -{
      -  "anyOf": [
      -    {
      -      "additionalProperties": {},
      -      "type": "object"
      -    },
      -    {
      -      "type": "string"
      -    }
      -  ],
      -  "description": "Payment mandate with `mandate_id`, `max_amount_cents` (integer, minor units), `currency` (3 letters, must match the cart's), `exp` (expiry as an INTEGER of Unix seconds — not an ISO 8601 date string), `sub` (your agent id) and `aud` (the store slug this mandate is for, e.g. the slug in the URL you are calling — not a domain). Use this when your client cannot set an `X-Payment-Mandate` header."
      -}
  6. Changed2 schema fields changed
    • addedInput schema / properties / agent_key
      Added value: +{
      +  "description": "Sandbox credential from `create_sandbox_key`. Use this when your client cannot set an `Authorization: Bearer` header.",
      +  "type": "string"
      +}
    • addedInput schema / properties / payment_mandate
      Added value: +{
      +  "anyOf": [
      +    {
      +      "additionalProperties": {},
      +      "type": "object"
      +    },
      +    {
      +      "type": "string"
      +    }
      +  ],
      +  "description": "Payment mandate with `mandate_id`, `max_amount_cents` (integer, minor units), `currency` (3 letters, must match the cart's), `exp` (expiry as an INTEGER of Unix seconds — not an ISO 8601 date string), `sub` (your agent id) and `aud` (the store slug this mandate is for, e.g. the slug in the URL you are calling — not a domain). Use this when your client cannot set an `X-Payment-Mandate` header."
      +}
  7. Changed1 schema field changed
    • addedInput schema / properties / idempotency_key
      Added value: +{
      +  "description": "Idempotency key for this cart creation (UUID-v4 or bounded ASCII token, 1-128 chars). Equivalent to the `Idempotency-Key` header — send it here if your client cannot set headers. Retrying with the same key returns the same cart instead of creating a second one.",
      +  "type": "string"
      +}
  8. Changed2 schema fields changed
    • changedOutput schema / additionalProperties
      Previous value: -falseNew value: +true
    • changedOutput schema / properties / items / items / additionalProperties
      Previous value: -falseNew value: +true
  9. Changed4 schema fields changed
    • changedInput schema / properties / items / items / properties / variant_id / description
      Previous value: -"Variant ID (optional)"New value: +"Variant ID (optional). Must match a variant id listed by get_product_details; an unknown id is rejected rather than silently replaced by the default variant."
    • addedOutput schema / properties / items / items / properties / sku
      Added value: +{
      +  "type": "string"
      +}
    • addedOutput schema / properties / items / items / properties / variant_id
      Added value: +{
      +  "type": "string"
      +}
    • addedOutput schema / properties / items / items / properties / variant_title
      Added value: +{
      +  "type": "string"
      +}
  10. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "http://json-schema.org/draft-07/schema#",
      +  "additionalProperties": false,
      +  "properties": {
      +    "agent_session_id": {
      +      "type": "string"
      +    },
      +    "cart_id": {
      +      "type": "string"
      +    },
      +    "currency": {
      +      "type": "string"
      +    },
      +    "display_context": {
      +      "enum": [
      +        "webview",
      +        "headless"
      +      ],
      +      "type": "string"
      +    },
      +    "items": {
      +      "items": {
      +        "additionalProperties": false,
      +        "properties": {
      +          "line_price": {
      +            "type": "number"
      +          },
      +          "name": {
      +            "type": "string"
      +          },
      +          "quantity": {
      +            "type": "number"
      +          },
      +          "unit_price": {
      +            "type": "number"
      +          }
      +        },
      +        "required": [
      +          "name",
      +          "quantity",
      +          "unit_price",
      +          "line_price"
      +        ],
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "session_state": {
      +      "enum": [
      +        "new",
      +        "resumed"
      +      ],
      +      "type": "string"
      +    },
      +    "status": {
      +      "const": "NOT_READY_FOR_PAYMENT",
      +      "type": "string"
      +    },
      +    "store_name": {
      +      "type": "string"
      +    },
      +    "subtotal_cents": {
      +      "type": "number"
      +    }
      +  },
      +  "required": [
      +    "cart_id",
      +    "store_name",
      +    "items",
      +    "subtotal_cents",
      +    "currency",
      +    "status",
      +    "agent_session_id",
      +    "session_state",
      +    "display_context"
      +  ],
      +  "type": "object"
      +}
  11. Changed4 schema fields changed
    • addedInput schema / $schema
      Added value: +"http://json-schema.org/draft-07/schema#"
    • addedInput schema / additionalProperties
      Added value: +false
    • addedInput schema / properties
      Added value: +{
      +  "agent_session_id": {
      +    "description": "Opaque agent session identifier for cart resume across sessions",
      +    "type": "string"
      +  },
      +  "agent_token": {
      +    "description": "JWS compact (EdDSA/Ed25519) signed by the agent. Required for Shopify enforcement rules R001/R002/R004. The token is embedded as a server-authoritative cart attribute — Trusteed does NOT verify the signature here; that is done offline by the Shopify Function WASM.",
      +    "type": "string"
      +  },
      +  "display_context": {
      +    "default": "headless",
      +    "description": "Agent display capability: webview (browser) or headless",
      +    "enum": [
      +      "webview",
      +      "headless"
      +    ],
      +    "type": "string"
      +  },
      +  "items": {
      +    "description": "Items to add to cart",
      +    "items": {
      +      "additionalProperties": false,
      +      "properties": {
      +        "product_id": {
      +          "description": "Product ID",
      +          "type": "string"
      +        },
      +        "quantity": {
      +          "default": 1,
      +          "description": "Quantity",
      +          "minimum": 1,
      +          "type": "integer"
      +        },
      +        "variant_id": {
      +          "description": "Variant ID (optional)",
      +          "type": "string"
      +        }
      +      },
      +      "required": [
      +        "product_id"
      +      ],
      +      "type": "object"
      +    },
      +    "minItems": 1,
      +    "type": "array"
      +  }
      +}
    • addedInput schema / required
      Added value: +[
      +  "items"
      +]
  12. Changed5 schema fields changed
    • removedInput schema / $schema
      Removed value: -"http://json-schema.org/draft-07/schema#"
    • removedInput schema / additionalProperties
      Removed value: -false
    • removedInput schema / properties
      Removed value: -{
      -  "agent_session_id": {
      -    "description": "Opaque agent session identifier for cart resume across sessions",
      -    "type": "string"
      -  },
      -  "display_context": {
      -    "default": "headless",
      -    "description": "Agent display capability: webview (browser) or headless",
      -    "enum": [
      -      "webview",
      -      "headless"
      -    ],
      -    "type": "string"
      -  },
      -  "items": {
      -    "description": "Items to add to cart",
      -    "items": {
      -      "additionalProperties": false,
      -      "properties": {
      -        "product_id": {
      -          "description": "Product ID",
      -          "type": "string"
      -        },
      -        "quantity": {
      -          "default": 1,
      -          "description": "Quantity",
      -          "minimum": 1,
      -          "type": "integer"
      -        },
      -        "variant_id": {
      -          "description": "Variant ID (optional)",
      -          "type": "string"
      -        }
      -      },
      -      "required": [
      -        "product_id"
      -      ],
      -      "type": "object"
      -    },
      -    "minItems": 1,
      -    "type": "array"
      -  }
      -}
    • removedInput schema / required
      Removed value: -[
      -  "items"
      -]
    • changedOutput schema / (root)
      Previous value: -{
      -  "$schema": "http://json-schema.org/draft-07/schema#",
      -  "additionalProperties": false,
      -  "properties": {
      -    "agent_session_id": {
      -      "type": "string"
      -    },
      -    "cart_id": {
      -      "type": "string"
      -    },
      -    "currency": {
      -      "type": "string"
      -    },
      -    "display_context": {
      -      "enum": [
      -        "webview",
      -        "headless"
      -      ],
      -      "type": "string"
      -    },
      -    "items": {
      -      "items": {
      -        "additionalProperties": false,
      -        "properties": {
      -          "line_price": {
      -            "type": "number"
      -          },
      -          "name": {
      -            "type": "string"
      -          },
      -          "quantity": {
      -            "type": "number"
      -          },
      -          "unit_price": {
      -            "type": "number"
      -          }
      -        },
      -        "required": [
      -          "name",
      -          "quantity",
      -          "unit_price",
      -          "line_price"
      -        ],
      -        "type": "object"
      -      },
      -      "type": "array"
      -    },
      -    "session_state": {
      -      "enum": [
      -        "new",
      -        "resumed"
      -      ],
      -      "type": "string"
      -    },
      -    "status": {
      -      "const": "NOT_READY_FOR_PAYMENT",
      -      "type": "string"
      -    },
      -    "store_name": {
      -      "type": "string"
      -    },
      -    "subtotal_cents": {
      -      "type": "number"
      -    }
      -  },
      -  "required": [
      -    "cart_id",
      -    "store_name",
      -    "items",
      -    "subtotal_cents",
      -    "currency",
      -    "status",
      -    "agent_session_id",
      -    "session_state",
      -    "display_context"
      -  ],
      -  "type": "object"
      -}New value: +null
  13. First observed

TDQS

Score is being calculated.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources