create_commerce_variant
Add one variant to a product.
option_values must name every one of the product's options with a value that option allows — call set_commerce_product_options first. Fails with 409 if the combination already exists.
Args: project_id: The project ID. product_id: The product ID. option_values: JSON object mapping option name to value, e.g. {"Size":"M","Colour":"Black"}. sku: Variant SKU, unique within the product. price_amount: Variant price in the smallest currency unit. Leave -1 to inherit the product price. compare_at_amount: Struck-through price for this variant. Leave -1 to skip. currency: ISO currency code. Defaults to the product currency. image_url: Image shown when this variant is selected. weight_grams: Shipping weight in grams. Leave -1 to skip. requires_shipping: Whether this variant needs a shipping address. inventory_policy: deny blocks checkout at zero stock, continue allows overselling. Default deny. inventory_quantity: Starting stock for this variant. Leave -1 to skip.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"project_id": "<project_id>",
"product_id": "<product_id>",
"option_values": "<option_values>"
},
"name": "create_commerce_variant"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sku | No | ||
| currency | No | ||
| image_url | No | ||
| product_id | Yes | ||
| project_id | Yes | ||
| price_amount | No | ||
| weight_grams | No | ||
| option_values | Yes | ||
| inventory_policy | No | ||
| compare_at_amount | No | ||
| requires_shipping | No | ||
| inventory_quantity | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |