Anvil migration path
anvil_migration_pathCompute the cheapest Minecraft anvil combine path to migrate an item's existing enchantments (and prior-work penalty count) to a target enchantment set. sourceItem and targetItem must be the same item id (e.g. both 'diamond_sword') — a mismatch is a tool error, not a silent conversion. Inventory usage is set by two optional inputs: with no availableSources the inventory is not used ("Don't use": every needed book/item is assumed obtainable); with availableSources the plan may use them when they help and assumes the rest is obtainable ("May use"); with inventoryOnly: true, which is never implied, only the listed items are considered, lower levels may be combined into higher ones (two same-level books into the next level) but no outside book is ever assumed ("Only use"; a plan the inventory cannot complete comes back as error 'blocked_plan'). Optional objective: 'min_xp' (default, fewest XP levels) or 'min_prior_work' (fewest anvil operations on the finished item so it stays cheap to upgrade later, then fewest XP levels); when set, the response also reports the objective used, the total XP and the result's prior-work count. Returns ordered combine steps, per-step and total cost, feasibility, and a plain-language summary. Fails clearly, as a tool error, if the target requires downgrading an enchantment level (not possible on a vanilla anvil).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| edition | No | Minecraft edition; defaults to 'java' | |
| version | No | Game version, e.g. '1.21.4'; defaults to the latest supported version for the chosen edition | |
| objective | No | What to optimise. 'min_xp' (default) finds the plan with the fewest total XP levels. 'min_prior_work' finds the plan whose FINISHED item has the lowest prior-work count (fewest anvil operations on it, so it stays cheap to upgrade again later — each extra operation doubles the prior-work penalty of any future combine), and among plans with that count picks the cheapest in XP. 'min_prior_work' may cost more XP; when this parameter is given the response also reports the objective used, the total XP and the result's prior-work count so the two modes can be compared. Omit for the original min_xp behaviour and response. | |
| sourceItem | Yes | ||
| targetItem | Yes | ||
| inventoryOnly | No | "Only use": only if you set this to true (it is never implied, not even when availableSources is non-empty). The plan then considers only the items in availableSources (respecting each one's quantity/unlimited) and never assumes an outside book is obtainable. It may still start by combining lower levels into higher ones, for example two same-level books into the next level. If the inventory cannot reach the target, the result is feasible: false with error 'blocked_plan' (the cheapest plan assuming each missing book, with blockers). Omit it or pass false for the default ("Don't use" with no sources, "May use" with sources). | |
| availableSources | No | The books/items the player already owns, i.e. the inventory. Omit it or pass [] for "Don't use": no inventory is provided, so the plan assumes every needed book/item is obtainable (a fresh single-enchantment book for each target enchantment). Pass one or more sources for "May use": the plan picks those that make it cheaper, ignores the ones that don't help, and still assumes anything the sources cannot provide is obtainable. Passing sources never implies "Only use"; that needs inventoryOnly: true. |