Skip to main content
Glama

search_stratagems

Search Warhammer 40,000 stratagems by name, faction, phase, or detachment to find relevant rules quickly.

Instructions

Search Warhammer 40,000 stratagems by name, faction, phase, or detachment. Returns a compact list (max 10). For Kill Team ploys, use lookup_ploy instead.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query — matches against name, faction, phase, and effect
factionNoOptional faction filter (e.g. 'Core', 'Adeptus Astartes')
phaseNoOptional phase filter (e.g. 'Fight phase', 'Shooting')
detachmentNoOptional detachment filter (e.g. 'Gladius Task Force')

Implementation Reference

  • The async handler function that executes the search_stratagems tool logic: filters stratagems by optional faction/phase/detachment, fuzzy-searches by query on name/effect/phase fields, returns up to 10 results as compact Markdown.
      async ({ query, faction, phase, detachment }) => {
        let candidates: Stratagem[] = [...STRATAGEMS];
    
        if (faction) {
          candidates = fuzzySearch(candidates, faction, ["faction"]);
        }
        if (phase) {
          candidates = fuzzySearch(candidates, phase, ["phase"]);
        }
        if (detachment) {
          candidates = candidates.filter(
            (s) => s.detachment && s.detachment.toLowerCase().includes(detachment.toLowerCase()),
          );
        }
    
        const matches = fuzzySearch(candidates, query, ["name", "effect", "phase"]);
        const limited = matches.slice(0, 10);
    
        if (limited.length === 0) {
          return {
            content: [
              {
                type: "text" as const,
                text: `No Warhammer 40,000 stratagems found matching "${query}".${faction ? ` (faction: "${faction}")` : ""}\n\nNote: For Kill Team ploys, use the lookup_ploy tool instead.`,
              },
            ],
          };
        }
    
        const header = "**Game:** Warhammer 40,000\n\n";
        const lines = limited.map(formatCompact);
        const footer =
          matches.length > 10
            ? `\n\n_Showing 10 of ${matches.length} results. Narrow your search for more specific results._`
            : "";
    
        return {
          content: [
            {
              type: "text" as const,
              text: header + lines.join("\n") + footer,
            },
          ],
        };
      },
    );
  • Zod schema defining the input parameters for search_stratagems: query (required string), faction, phase, detachment (all optional strings).
    {
      query: z.string().describe("Search query — matches against name, faction, phase, and effect"),
      faction: z
        .string()
        .optional()
        .describe("Optional faction filter (e.g. 'Core', 'Adeptus Astartes')"),
      phase: z
        .string()
        .optional()
        .describe("Optional phase filter (e.g. 'Fight phase', 'Shooting')"),
      detachment: z
        .string()
        .optional()
        .describe("Optional detachment filter (e.g. 'Gladius Task Force')"),
    },
  • The registerSearchStratagems function that calls server.tool() to register the 'search_stratagems' tool with description and schema.
    export function registerSearchStratagems(server: McpServer): void {
      server.tool(
        "search_stratagems",
        "Search Warhammer 40,000 stratagems by name, faction, phase, or detachment. Returns a compact list (max 10). For Kill Team ploys, use lookup_ploy instead.",
        {
          query: z.string().describe("Search query — matches against name, faction, phase, and effect"),
          faction: z
            .string()
            .optional()
            .describe("Optional faction filter (e.g. 'Core', 'Adeptus Astartes')"),
          phase: z
            .string()
            .optional()
            .describe("Optional phase filter (e.g. 'Fight phase', 'Shooting')"),
          detachment: z
            .string()
            .optional()
            .describe("Optional detachment filter (e.g. 'Gladius Task Force')"),
        },
        async ({ query, faction, phase, detachment }) => {
          let candidates: Stratagem[] = [...STRATAGEMS];
    
          if (faction) {
            candidates = fuzzySearch(candidates, faction, ["faction"]);
          }
          if (phase) {
            candidates = fuzzySearch(candidates, phase, ["phase"]);
          }
          if (detachment) {
            candidates = candidates.filter(
              (s) => s.detachment && s.detachment.toLowerCase().includes(detachment.toLowerCase()),
            );
          }
    
          const matches = fuzzySearch(candidates, query, ["name", "effect", "phase"]);
          const limited = matches.slice(0, 10);
    
          if (limited.length === 0) {
            return {
              content: [
                {
                  type: "text" as const,
                  text: `No Warhammer 40,000 stratagems found matching "${query}".${faction ? ` (faction: "${faction}")` : ""}\n\nNote: For Kill Team ploys, use the lookup_ploy tool instead.`,
                },
              ],
            };
          }
    
          const header = "**Game:** Warhammer 40,000\n\n";
          const lines = limited.map(formatCompact);
          const footer =
            matches.length > 10
              ? `\n\n_Showing 10 of ${matches.length} results. Narrow your search for more specific results._`
              : "";
    
          return {
            content: [
              {
                type: "text" as const,
                text: header + lines.join("\n") + footer,
              },
            ],
          };
        },
      );
    }
  • Registration call to registerSearchStratagems(server) within the central registerTools function.
    registerSearchStratagems(server);
    registerLookupDetachment(server);
    registerLookupEnhancement(server);
    registerLookupPloy(server);
  • The formatCompact helper function that renders a Stratagem object into a compact Markdown string for display.
    function formatCompact(strat: Stratagem): string {
      const detStr = strat.detachment ? ` [${strat.detachment}]` : "";
      return `**${strat.name}** (${strat.faction}${detStr}) — ${strat.cpCost} CP | ${strat.phase} | ${strat.type.replace("_", " ")}`;
    }
Behavior3/5

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

No annotations, so description carries burden. It discloses the max 10 result limit but lacks details on matching behavior (e.g., fuzzy vs exact), pagination, or error handling.

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, front-loaded with core purpose and limit, then alternative. No unnecessary words.

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

Completeness4/5

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

Adequately covers purpose, criteria, and result limit, and suggests alternative. Lacks output structure details (what fields are in the compact list) and default behavior, but sufficient for a search tool.

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 has 100% description coverage, so baseline is 3. Description adds no extra semantic meaning beyond the schema's parameter descriptions.

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?

Description clearly states it searches Warhammer 40,000 stratagems by multiple criteria and returns a compact list, explicitly distinguishing from lookup_ploy for Kill Team ploys.

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?

Provides explicit when-to-use (stratagems) and when-not-to (Kill Team ploys → lookup_ploy). However, it does not differentiate from the sibling tool lookup_stratagem for more precise lookups.

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/warhammer-oracle'

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