Skip to main content
Glama

search_traits

Find TFT traits by name or description to access accurate game data. Search or list all traits to prevent AI hallucinations about Teamfight Tactics.

Instructions

Search TFT traits by name or description. Omit the query to list all traits in the current set.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryNoFree-text search across trait name and description (uses FTS5)
limitNoMax results to return, 1-100 (default: 50)

Implementation Reference

  • The main logic for searching traits using FTS5 or simple listing.
    export function searchTraits(
      db: Database.Database,
      input: SearchTraitsInputType,
    ): SearchTraitsResult {
      const limit = input.limit ?? 50;
    
      let rows: Array<{ name: string; description: string | null; breakpoints: string | null }>;
    
      if (input.query) {
        rows = db
          .prepare(
            `SELECT t.name, t.description, t.breakpoints
             FROM traits_fts fts
             JOIN traits t ON t.rowid = fts.rowid
             WHERE traits_fts MATCH ?
             ORDER BY fts.rank
             LIMIT ?`,
          )
          .all(input.query, limit) as typeof rows;
      } else {
        rows = db
          .prepare(
            `SELECT name, description, breakpoints
             FROM traits
             ORDER BY name
             LIMIT ?`,
          )
          .all(limit) as typeof rows;
      }
    
      const traits: TraitSummary[] = rows.map((row) => ({
        name: row.name,
        description: truncate(row.description, 100),
        breakpointCount: parseBreakpoints(row.breakpoints).length,
      }));
    
      return { traits, total: traits.length };
    }
  • Zod schema defining the input for the search_traits tool.
    export const SearchTraitsInput = z.object({
      query: z
        .string()
        .optional()
        .describe('Free-text search across trait name and description (uses FTS5)'),
      limit: z
        .number()
        .min(1)
        .max(100)
        .optional()
        .default(50)
        .describe('Max results to return, 1-100 (default: 50)'),
    });
  • src/server.ts:87-97 (registration)
    Registration of the search_traits tool in the MCP server.
    // 3. search_traits
    server.tool(
      'search_traits',
      'Search TFT traits by name or description. Omit the query to list all traits in the current set.',
      SearchTraitsInput.shape,
      async (params) => {
        try {
          const result = searchTraits(db, params);
          return {
            content: [{ type: 'text' as const, text: formatSearchTraits(result) }],
          };
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It discloses the search behavior ('by name or description', 'uses FTS5') and the listing behavior when query is omitted, but lacks details on permissions, rate limits, error handling, or response format (e.g., pagination, structure).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two concise sentences with zero waste: the first states the purpose and search scope, the second provides usage guidance. It's front-loaded and efficiently structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, no output schema, and a simple search tool with 2 parameters, the description covers basic purpose and usage but lacks behavioral details like response format or error conditions. It's adequate but has clear gaps for a tool with no structured support.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents both parameters. The description adds minimal value beyond the schema by implying 'query' is optional for listing all traits, but doesn't provide additional syntax or format details. Baseline 3 is appropriate when schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Search TFT traits by name or description') and resource ('TFT traits'), distinguishing it from siblings like 'get_trait' (likely fetches a specific trait) and 'search_champions' (different resource). It also specifies the scope ('in the current set').

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It provides clear context on when to use it ('Omit the query to list all traits in the current set'), which helps differentiate from 'get_trait' for single trait retrieval. However, it doesn't explicitly state when not to use it or compare with all alternatives like 'search_augments' for different data types.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/gregario/tft-oracle'

If you have feedback or need assistance with the MCP directory API, please join our Discord server