get_trait
Retrieve detailed TFT trait information including breakpoint thresholds, scaling values, and associated champions to understand synergy requirements and team composition planning.
Instructions
Get full details for a TFT trait including breakpoint thresholds, scaling values, and all champions with this trait. Use this to understand synergy requirements.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Trait name to look up (exact or partial match) |
Implementation Reference
- src/tools/get-trait.ts:70-125 (handler)The handler function 'getTrait' that implements the logic for searching traits in the database.
export function getTrait( db: Database.Database, input: GetTraitInputType, ): GetTraitResult { // 1. Exact match (case-insensitive) const exact = db .prepare('SELECT * FROM traits WHERE LOWER(name) = LOWER(?)') .get(input.name) as TraitRow | undefined; if (exact) { return { found: true, trait: toTraitDetail(db, exact) }; } // 2. LIKE partial match (case-insensitive) const likeRow = db .prepare('SELECT * FROM traits WHERE LOWER(name) LIKE LOWER(?)') .get(`%${input.name}%`) as TraitRow | undefined; if (likeRow) { return { found: true, trait: toTraitDetail(db, likeRow) }; } // 3. FTS5 match try { const ftsRow = db .prepare( `SELECT t.* FROM traits_fts fts JOIN traits t ON t.rowid = fts.rowid WHERE traits_fts MATCH ? ORDER BY fts.rank LIMIT 1`, ) .get(input.name) as TraitRow | undefined; if (ftsRow) { return { found: true, trait: toTraitDetail(db, ftsRow) }; } } catch { // FTS5 can throw on invalid query syntax — fall through to not found } // 4. Not found — provide suggestions const firstWord = input.name.split(/\s+/)[0]; const suggestions = db .prepare('SELECT name FROM traits WHERE LOWER(name) LIKE LOWER(?) LIMIT 5') .all(`%${firstWord}%`) as Array<{ name: string }>; const suggestionNames = suggestions.map((s) => s.name); return { found: false, message: `No trait found matching "${input.name}".`, suggestions: suggestionNames.length > 0 ? suggestionNames : undefined, }; } - src/tools/get-trait.ts:7-9 (schema)Zod schema for validating the input to the get_trait tool.
export const GetTraitInput = z.object({ name: z.string().describe('Trait name to look up (exact or partial match)'), }); - src/server.ts:107-116 (registration)Registration and execution point for the 'get_trait' tool in the main server file.
// 4. get_trait server.tool( 'get_trait', 'Get full details for a TFT trait including breakpoint thresholds, scaling values, and all champions with this trait. Use this to understand synergy requirements.', GetTraitInput.shape, async (params) => { try { const result = getTrait(db, params); return { content: [{ type: 'text' as const, text: formatGetTrait(result) }],