Upsert Item Sourcing Profile
upsert_item_sourcing_profileCreate or update an item's sourcing profile (its default price book + production spec). Matching: with name, the item's profile of that name is updated (or created); without name, the item's single existing profile is updated — ambiguous or first-time cases require name. The item's owner is derived server-side; a book attributed to a different client is refused; the spec is validated against the book's schema (invalid specs are refused, never priced). Set preview=true for the governed two-step protocol (a validated would-be profile plus a single-use previewReceipt); repeat with that receipt and a fresh idempotencyKey to commit.
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": {
"itemSku": "<itemSku>",
"bookId": "<bookId>",
"spec": "<spec>"
},
"name": "upsert_item_sourcing_profile"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | Edition label (e.g. "Hardback"). Optional when updating an item's only profile; required to create. | |
| spec | Yes | Cost-driver attribute values keyed by the book's schema, e.g. {"trim": "6x9"}. | |
| bookId | Yes | The default price book id (GUID) for this edition. | |
| itemSku | Yes | The item SKU this profile belongs to. | |
| preview | No | Step 1 of the required two-step write: set true to validate and receive the would-be profile plus a single-use previewReceipt. Nothing is written until the commit call. | |
| isDefault | No | Make this the item's default profile. Omitted = preserve current state. | |
| idempotencyKey | No | Caller-generated idempotency key; required with previewReceipt to commit. | |
| previewReceipt | No | Step 2 of the required two-step write: the receipt returned by the preview call. Supply together with a fresh idempotencyKey to commit; calls without it are refused. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | No | ||
| created | No | ||
| preview | No | ||
| profile | No | ||
| expiresAt | No | ||
| actionItemId | No | ||
| confirmation | No | ||
| correlationId | No | ||
| approvalResult | No | ||
| idempotencyKey | No | ||
| previewReceipt | No | ||
| idempotentReplay | No |