commerce $0.0003 / call
GTIN Validate
Validate GTIN-8, UPC/GTIN-12, EAN/GTIN-13 and GTIN-14 check digits; no product lookup.
commerce.gtin-validatecommerce.main-product · v1.0.0
Identify the main Product or ProductGroup from supplied JSON-LD HTML using identity, mainEntity and canonical evidence; abstain on ambiguity.
FREE, no key. Identify the main Product or ProductGroup from supplied JSON-LD HTML using identity, mainEntity and canonical evidence; abstain on ambiguity. Entire JSON input: 16384 UTF-8 bytes. Supplied data only; no fetch, payment or automatic paid fallback.
Hosted MCP: agent_utilities_main_product_preview. Inspect the result status, reasons and source evidence before using an answer.
POST https://agent-utilities.agent-utilities.workers.dev/v1/preview/commerce.main-product
Content-Type: application/json
{
"html": "<link rel=\"canonical\" href=\"https://example.com/coffee\"><script type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https://example.com/coffee\",\"mainEntity\":{\"@id\":\"#coffee\"}},{\"@type\":\"Product\",\"@id\":\"#coffee\",\"name\":\"Coffee beans\",\"sku\":\"COFFEE-500\",\"offers\":{\"@type\":\"Offer\",\"price\":\"8.99\",\"priceCurrency\":\"USD\",\"availability\":\"https://schema.org/InStock\"}},{\"@type\":\"Product\",\"name\":\"Related mug\",\"sku\":\"MUG-1\",\"offers\":{\"@type\":\"Offer\",\"price\":\"12.00\",\"priceCurrency\":\"USD\"}}]}</script>",
"pageUrl": "https://example.com/coffee"
}{
"html": "<link rel=\"canonical\" href=\"https://example.com/coffee\"><script type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https://example.com/coffee\",\"mainEntity\":{\"@id\":\"#coffee\"}},{\"@type\":\"Product\",\"@id\":\"#coffee\",\"name\":\"Coffee beans\",\"sku\":\"COFFEE-500\",\"offers\":{\"@type\":\"Offer\",\"price\":\"8.99\",\"priceCurrency\":\"USD\",\"availability\":\"https://schema.org/InStock\"}},{\"@type\":\"Product\",\"name\":\"Related mug\",\"sku\":\"MUG-1\",\"offers\":{\"@type\":\"Offer\",\"price\":\"12.00\",\"priceCurrency\":\"USD\"}}]}</script>",
"pageUrl": "https://example.com/coffee"
}{
"status": "selected",
"reason": "webpage_main_entity",
"selectedId": "product-1",
"selected": {
"id": "product-1",
"kind": "Product",
"name": "Coffee beans",
"sku": "COFFEE-500",
"gtin": null,
"brand": null,
"mpn": null,
"url": null,
"variantCount": 0,
"sources": [
{
"block": 0,
"pointer": "/@graph/1"
}
],
"offers": [
{
"productName": "Coffee beans",
"sku": "COFFEE-500",
"gtin": null,
"offerType": "Offer",
"price": "8.99",
"currency": "USD",
"lowPrice": null,
"highPrice": null,
"url": null,
"availability": "https://schema.org/InStock",
"itemCondition": null,
"priceValidUntil": null,
"source": {
"productBlock": 0,
"productPointer": "/@graph/1",
"offerBlock": 0,
"offerPointer": "/@graph/1/offers"
},
"warnings": []
}
]
},
"candidates": [
{
"id": "product-1",
"kind": "Product",
"name": "Coffee beans",
"sku": "COFFEE-500",
"gtin": null,
"brand": null,
"mpn": null,
"url": null,
"variantCount": 0,
"sources": [
{
"block": 0,
"pointer": "/@graph/1"
}
],
"offers": [
{
"productName": "Coffee beans",
"sku": "COFFEE-500",
"gtin": null,
"offerType": "Offer",
"price": "8.99",
"currency": "USD",
"lowPrice": null,
"highPrice": null,
"url": null,
"availability": "https://schema.org/InStock",
"itemCondition": null,
"priceValidUntil": null,
"source": {
"productBlock": 0,
"productPointer": "/@graph/1",
"offerBlock": 0,
"offerPointer": "/@graph/1/offers"
},
"warnings": []
}
]
},
{
"id": "product-2",
"kind": "Product",
"name": "Related mug",
"sku": "MUG-1",
"gtin": null,
"brand": null,
"mpn": null,
"url": null,
"variantCount": 0,
"sources": [
{
"block": 0,
"pointer": "/@graph/2"
}
],
"offers": [
{
"productName": "Related mug",
"sku": "MUG-1",
"gtin": null,
"offerType": "Offer",
"price": "12.00",
"currency": "USD",
"lowPrice": null,
"highPrice": null,
"url": null,
"availability": null,
"itemCondition": null,
"priceValidUntil": null,
"source": {
"productBlock": 0,
"productPointer": "/@graph/2",
"offerBlock": 0,
"offerPointer": "/@graph/2/offers"
},
"warnings": []
}
]
}
],
"distinctProducts": 2,
"canonicalUrl": "https://example.com/coffee",
"pageTypes": [
"WebPage"
],
"warnings": [],
"scope": "Deterministic selection from supplied JSON-LD only. Grouped variants remain a ProductGroup; no variant or buybox is guessed. Source pointers refer to JSON-LD blocks. No fetching, rendering, microdata parsing, context expansion or live price/stock verification."
}Generated from the actual handler using this example input; this is a preview, not a paid API call. Paid responses wrap the result with a receipt and recovery expiry.
Add credits in the workspace and keep your API key in private environment storage. Use the same request ID and exact body to recover a lost response within ten minutes.
// Node.js 22+. Read the key from your private environment.
const requestId = Date.now() + '_' + crypto.randomUUID();
const response = await fetch('https://agent-utilities.agent-utilities.workers.dev/v1/tools/commerce.main-product', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + process.env.AGENT_UTILITIES_API_KEY,
'Idempotency-Key': requestId
},
body: JSON.stringify({
"html": "<link rel=\"canonical\" href=\"https://example.com/coffee\"><script type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https://example.com/coffee\",\"mainEntity\":{\"@id\":\"#coffee\"}},{\"@type\":\"Product\",\"@id\":\"#coffee\",\"name\":\"Coffee beans\",\"sku\":\"COFFEE-500\",\"offers\":{\"@type\":\"Offer\",\"price\":\"8.99\",\"priceCurrency\":\"USD\",\"availability\":\"https://schema.org/InStock\"}},{\"@type\":\"Product\",\"name\":\"Related mug\",\"sku\":\"MUG-1\",\"offers\":{\"@type\":\"Offer\",\"price\":\"12.00\",\"priceCurrency\":\"USD\"}}]}</script>",
"pageUrl": "https://example.com/coffee"
})
});
const data = await response.json();
if (!response.ok) throw new Error(data.error?.message ?? 'Request failed');
console.log(data);
// On response loss, retry this SAME requestId, tool and body.
// Do not rerun the line that generates requestId for a retry.{
"type": "object",
"properties": {
"html": {
"type": "string",
"maxLength": 100000
},
"pageUrl": {
"type": "string",
"maxLength": 2048
}
},
"required": [
"html"
],
"additionalProperties": false
}{
"type": "object",
"properties": {
"status": {
"type": "string",
"enum": [
"selected",
"ambiguous",
"no_product"
]
},
"reason": {
"type": "string"
},
"selectedId": {
"type": [
"string",
"null"
]
},
"selected": {
"anyOf": [
{
"type": "object",
"properties": {
"id": {
"type": "string"
},
"kind": {
"type": "string",
"enum": [
"Product",
"ProductGroup"
]
},
"name": {
"type": [
"string",
"null"
]
},
"sku": {
"type": [
"string",
"null"
]
},
"gtin": {
"type": [
"string",
"null"
]
},
"brand": {
"type": [
"string",
"null"
]
},
"mpn": {
"type": [
"string",
"null"
]
},
"url": {
"type": [
"string",
"null"
]
},
"variantCount": {
"type": "number"
},
"sources": {
"type": "array",
"items": {
"type": "object",
"properties": {
"block": {
"type": "number"
},
"pointer": {
"type": "string"
}
},
"required": [
"block",
"pointer"
],
"additionalProperties": false
}
},
"offers": {
"type": "array",
"items": {
"type": "object",
"properties": {
"productName": {
"type": [
"string",
"null"
]
},
"sku": {
"type": [
"string",
"null"
]
},
"gtin": {
"type": [
"string",
"null"
]
},
"offerType": {
"type": "string"
},
"price": {
"type": [
"string",
"null"
]
},
"currency": {
"type": [
"string",
"null"
]
},
"lowPrice": {
"type": [
"string",
"null"
]
},
"highPrice": {
"type": [
"string",
"null"
]
},
"url": {
"type": [
"string",
"null"
]
},
"availability": {
"type": [
"string",
"null"
]
},
"itemCondition": {
"type": [
"string",
"null"
]
},
"priceValidUntil": {
"type": [
"string",
"null"
]
},
"source": {
"type": "object",
"properties": {
"productBlock": {
"type": "number"
},
"productPointer": {
"type": "string"
},
"offerBlock": {
"type": "number"
},
"offerPointer": {
"type": "string"
}
},
"required": [
"productBlock",
"productPointer",
"offerBlock",
"offerPointer"
],
"additionalProperties": false
},
"warnings": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"productName",
"sku",
"gtin",
"offerType",
"price",
"currency",
"lowPrice",
"highPrice",
"url",
"availability",
"itemCondition",
"priceValidUntil",
"source",
"warnings"
],
"additionalProperties": false
}
}
},
"required": [
"id",
"kind",
"name",
"sku",
"gtin",
"brand",
"mpn",
"url",
"variantCount",
"sources",
"offers"
],
"additionalProperties": false
},
{
"type": "null"
}
]
},
"candidates": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"kind": {
"type": "string",
"enum": [
"Product",
"ProductGroup"
]
},
"name": {
"type": [
"string",
"null"
]
},
"sku": {
"type": [
"string",
"null"
]
},
"gtin": {
"type": [
"string",
"null"
]
},
"brand": {
"type": [
"string",
"null"
]
},
"mpn": {
"type": [
"string",
"null"
]
},
"url": {
"type": [
"string",
"null"
]
},
"variantCount": {
"type": "number"
},
"sources": {
"type": "array",
"items": {
"type": "object",
"properties": {
"block": {
"type": "number"
},
"pointer": {
"type": "string"
}
},
"required": [
"block",
"pointer"
],
"additionalProperties": false
}
},
"offers": {
"type": "array",
"items": {
"type": "object",
"properties": {
"productName": {
"type": [
"string",
"null"
]
},
"sku": {
"type": [
"string",
"null"
]
},
"gtin": {
"type": [
"string",
"null"
]
},
"offerType": {
"type": "string"
},
"price": {
"type": [
"string",
"null"
]
},
"currency": {
"type": [
"string",
"null"
]
},
"lowPrice": {
"type": [
"string",
"null"
]
},
"highPrice": {
"type": [
"string",
"null"
]
},
"url": {
"type": [
"string",
"null"
]
},
"availability": {
"type": [
"string",
"null"
]
},
"itemCondition": {
"type": [
"string",
"null"
]
},
"priceValidUntil": {
"type": [
"string",
"null"
]
},
"source": {
"type": "object",
"properties": {
"productBlock": {
"type": "number"
},
"productPointer": {
"type": "string"
},
"offerBlock": {
"type": "number"
},
"offerPointer": {
"type": "string"
}
},
"required": [
"productBlock",
"productPointer",
"offerBlock",
"offerPointer"
],
"additionalProperties": false
},
"warnings": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"productName",
"sku",
"gtin",
"offerType",
"price",
"currency",
"lowPrice",
"highPrice",
"url",
"availability",
"itemCondition",
"priceValidUntil",
"source",
"warnings"
],
"additionalProperties": false
}
}
},
"required": [
"id",
"kind",
"name",
"sku",
"gtin",
"brand",
"mpn",
"url",
"variantCount",
"sources",
"offers"
],
"additionalProperties": false
}
},
"distinctProducts": {
"type": "number"
},
"canonicalUrl": {
"type": [
"string",
"null"
]
},
"pageTypes": {
"type": "array",
"items": {
"type": "string"
}
},
"warnings": {
"type": "array",
"items": {
"type": "string"
}
},
"scope": {
"type": "string"
}
},
"required": [
"status",
"reason",
"selectedId",
"selected",
"candidates",
"distinctProducts",
"canonicalUrl",
"pageTypes",
"warnings",
"scope"
],
"additionalProperties": false
}Prices are experimental. The service currently allows 1,000 new calls per day per payment rail across all accounts. Failed operations return reserved credits. Successful results are encrypted for ten-minute retry recovery. Review data handling and service limits.
commerce $0.0003 / call
Validate GTIN-8, UPC/GTIN-12, EAN/GTIN-13 and GTIN-14 check digits; no product lookup.
commerce.gtin-validatecommerce $0.0005 / call
Compare requested product attributes with an offered variant and list missing or mismatched fields.
commerce.variant-comparecommerce $0.0008 / call
Choose the lowest-cost whole-pack combination for a required count with exact prices and explicit pack limits; up to 20 interchangeable offers.
commerce.pack-plan