get_item_recipe
Find TFT item recipes to see which components build an item or what a component creates. Use for item planning and carousel decisions.
Instructions
Get the recipe for a TFT item (which components build it) or see what a component builds into. Use this for item planning and carousel decisions.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Item name to look up (e.g. "Infinity Edge", "B.F. Sword") |
Implementation Reference
- src/tools/get-item-recipe.ts:108-198 (handler)The main handler function that queries the SQLite database for item information, processes recipes, and returns either the component details or build information.
export function getItemRecipe( db: Database.Database, input: GetItemRecipeInputType, ): GetItemRecipeResult | GetItemRecipeError { const item = findItemByName(db, input.name); if (!item) { const suggestions = getSuggestions(db, input.name); return { error: `Item "${input.name}" not found.`, suggestions, }; } const detail = rowToDetail(item); // Completed item (has composition) — show its component recipe if (item.composition && item.isComponent === 0) { let componentApiNames: string[] = []; try { componentApiNames = JSON.parse(item.composition) as string[]; } catch { // empty } const components: ItemDetail[] = []; for (const apiName of componentApiNames) { const compRow = db .prepare('SELECT * FROM items WHERE apiName = ?') .get(apiName) as ItemRow | undefined; if (compRow) { components.push(rowToDetail(compRow)); } } return { result: { item: detail, components, }, }; } // Component item — show all completed items that use this component (reverse lookup) const completedRows = db .prepare( "SELECT * FROM items WHERE isComponent = 0 AND composition LIKE '%' || ? || '%'", ) .all(item.apiName) as ItemRow[]; const buildsInto: Array<{ item: ItemDetail; otherComponent: ItemDetail }> = []; for (const completedRow of completedRows) { let compApiNames: string[] = []; try { compApiNames = JSON.parse(completedRow.composition ?? '[]') as string[]; } catch { // empty } // Find the other component (the one that isn't this item) const otherApiName = compApiNames.find((a) => a !== item.apiName) ?? compApiNames[0]; let otherComponent: ItemDetail | null = null; if (otherApiName) { const otherRow = db .prepare('SELECT * FROM items WHERE apiName = ?') .get(otherApiName) as ItemRow | undefined; if (otherRow) { otherComponent = rowToDetail(otherRow); } } if (otherComponent) { buildsInto.push({ item: rowToDetail(completedRow), otherComponent, }); } else { buildsInto.push({ item: rowToDetail(completedRow), otherComponent: detail, // self-combine (e.g. two of same component) }); } } return { result: { item: detail, buildsInto, }, }; } - src/tools/get-item-recipe.ts:6-8 (schema)Zod schema for the 'get_item_recipe' tool input, requiring a name string.
export const GetItemRecipeInput = z.object({ name: z.string().describe('Item name to look up (e.g. "Infinity Edge", "B.F. Sword")'), }); - src/server.ts:147-156 (registration)The tool 'get_item_recipe' is registered and invoked here, connecting the input validation to the handler and formatting the output.
// 6. get_item_recipe server.tool( 'get_item_recipe', 'Get the recipe for a TFT item (which components build it) or see what a component builds into. Use this for item planning and carousel decisions.', GetItemRecipeInput.shape, async (params) => { try { const result = getItemRecipe(db, params); return { content: [{ type: 'text' as const, text: formatGetItemRecipe(result) }],