Get the next product to optimize
optimize_nextThe one-product-at-a-time optimization loop, for small catalogs and for the exceptions left after a field-wide fix. Returns the next product needing work in a section with everything required to propose a fix: why it's flagged, its current mapped feed output, its top search queries (null when Search Console isn't synced), and the section's rules. Propose a change, get the merchant's approval, apply with set_product_override (confirm: true), verify with preview_product, then call this again with the returned cursor. done: true means the section is finished. On a large catalog, prefer list_section_products plus one update_feed_settings change over hundreds of overrides.
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": {
"section": "<section>"
},
"name": "optimize_next"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cursor | No | cursor from the previous optimize_next result | |
| feedId | No | Defaults to the store's primary feed | |
| section | Yes | Which optimization section to walk |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| done | No | True when the section has nothing left to walk | |
| note | No | Plain-language result or next step, safe to read out to the merchant. | |
| guide | No | The section's rules, so a fix can be proposed in one call | |
| cursor | No | Pass back to advance, or unchanged to skip | |
| feedId | No | The feed the walk is computed against | |
| context | No | Why it is flagged: the reason, plus the query or issue behind it | |
| product | No | The next product: id, handle and title | |
| excluded | No | When the feed drops the product, the reasons counted by variant | |
| remaining | No | Products still flagged in this section | |
| sourceFields | No | The Shopify fields a rule could read: tags and the first variants' SKU, barcode, price and weight | |
| alreadyInFeed | No | True when the feed's mapped output already carries the attribute behind the flag, so there is nothing to change | |
| searchQueries | No | Its top search queries, null when none are synced | |
| suggestedAction | No | How this product can be fixed: the action, the tool that carries it, and what to tell the merchant | |
| outsideFeedGroup | No | True when this product is outside the feed's product group, so this feed never sends it and an override here would do nothing | |
| currentAttributes | No | That product's current mapped feed output for the section's attributes, null when the feed drops it |