Skip to main content
Glama
frap129

LoreKeeper MCP

search_spell

Find D&D 5e spells by level, school, class, damage type, ritual, or concentration. Use natural language or hybrid search to retrieve complete spell descriptions from cached data.

Instructions

Search and retrieve D&D 5e spells using the repository pattern.

This tool provides comprehensive spell lookup functionality with support for filtering by multiple criteria. Results include complete spell descriptions, components, damage, effects, and availability information. Automatically uses the database cache through the repository for improved performance.

The repository pattern handles caching transparently:

  • First call: Fetches from API and caches in database

  • Subsequent calls: Returns cached results if available

  • Supports test context-based repository injection via _repository_context

Examples: Search for spells: spells = await search_spell(search="fireball") spells = await search_spell(search="healing restoration")

Filtering by level:
    cantrips = await search_spell(level=0)
    high_level_spells = await search_spell(level=5)

Using level ranges:
    mid_level_spells = await search_spell(level_min=3, level_max=5)
    powerful_spells = await search_spell(level_min=5)
    beginner_spells = await search_spell(level_max=2)

Filtering by school and other properties:
    evocation_spells = await search_spell(school="evocation")
    wizard_spells = await search_spell(class_key="wizard")
    ritual_spells = await search_spell(ritual=True)
    concentration_spells = await search_spell(concentration=True)

Filtering by damage type:
    fire_spells = await search_spell(damage_type="fire")
    cold_spells = await search_spell(damage_type="cold")
    necrotic_spells = await search_spell(damage_type="necrotic")

Filtering by document:
    srd_only = await search_spell(documents=["srd-5e"])
    srd_and_tasha = await search_spell(documents=["srd-5e", "tce"])

Complex queries combining multiple filters:
    evocation_fire_spells = await search_spell(
        school="evocation", damage_type="fire"
    )
    cleric_rituals = await search_spell(
        class_key="cleric", ritual=True, level_min=1
    )
    mid_level_wizard_spells = await search_spell(
        class_key="wizard", level_min=3, level_max=5, limit=10
    )

Semantic search (natural language queries):
    fire_spells = await search_spell(search="fire damage explosion")
    healing_spells = await search_spell(search="restore health allies")
    protection = await search_spell(search="defensive barrier ward")

Hybrid search (search + filters):
    fire_evocation = await search_spell(
        search="fire explosion", school="evocation"
    )
    low_level_healing = await search_spell(
        search="heal wounds", level_max=3
    )

With test context injection (testing):
    from lorekeeper_mcp.tools.search_spell import _repository_context
    custom_repo = SpellRepository(cache=my_cache)
    _repository_context["repository"] = custom_repo
    spells = await search_spell(level=0)

Args: level: Exact spell level ranging from 0-9. 0 represents cantrips/0-level spells, 9 represents 9th level spells. Example: 3 for exactly 3rd level spells level_min: Minimum spell level (inclusive) for range-based searches. Use with level_max to find spells in a range. Returns spells at this level or higher. Examples: 1 for 1st level and above, 5 for 5th level and above level_max: Maximum spell level (inclusive) for range-based searches. Use with level_min to find spells in a range. Returns spells at this level or lower. Examples: 3 for up to 3rd level spells, 5 for up to 5th level spells school: Magic school filter for spell type. Valid values: abjuration, conjuration, divination, enchantment, evocation, illusion, necromancy, transmutation. Each school has distinct characteristics. Example: "evocation" for damage-dealing spells, "abjuration" for protective spells class_key: Filter spells available to a specific class. Valid values: wizard, cleric, druid, bard, paladin, ranger, sorcerer, warlock, artificer. Each class has access to different spell lists. Example: "wizard" for spells in wizard spell list concentration: Filter for spells requiring concentration. True returns only concentration spells, False returns only non-concentration spells. Concentration is a key resource in combat. Example: True ritual: Filter for ritual spells. Returns only spells that can be cast as rituals, allowing casting without expending spell slots. Example: True casting_time: Casting time filter to find spells with specific casting times. Examples: "1 action" (most common), "1 bonus action" (quick casts), "1 reaction" (reaction spells), "1 minute" (extended preparation) damage_type: Filter spells by damage type dealt. Examples: "fire" (fire damage), "cold" (cold damage), "necrotic" (necrotic damage), "poison" (poison damage), "psychic" (psychic damage). NEW in Phase 3. documents: Filter to specific source documents. Provide a list of document names/identifiers from list_documents() tool. Examples: ["srd-5e"] for SRD only, ["srd-5e", "tce"] for SRD and Tasha's. Use list_documents() to see available documents. search: Natural language search query for semantic/vector search. When provided, uses vector similarity to find spells matching the conceptual meaning rather than exact text matches. Can be combined with other filters for hybrid search. Examples: "fire damage explosion", "healing allies", "protection from evil creatures" limit: Maximum number of results to return. Default 20. Useful for pagination or limiting large result sets. Examples: 5 for small sets, 20 for standard, 100 for comprehensive results

Returns: List of spell dictionaries, each containing: - name: Spell name - level: Spell level (0-9) - school: Magic school - casting_time: How long the spell takes to cast - range: Spell range/area of effect - components: Required components (V/S/M) - material: Material component description (if applicable) - duration: How long the spell lasts - concentration: Whether spell requires concentration - ritual: Whether spell can be cast as a ritual - desc: Full spell description and effects - higher_level: Effect when cast at higher levels - classes: List of classes that can learn this spell - document__slug: Source document reference - damage_type: Damage types dealt by the spell (if applicable)

Raises: ApiError: If the API request fails due to network issues or server errors

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
levelNo
limitNo
ritualNo
schoolNo
searchNo
class_keyNo
documentsNo
level_maxNo
level_minNo
damage_typeNo
casting_timeNo
concentrationNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

With no annotations provided, the description carries full responsibility for behavioral disclosure. It goes beyond basics by explaining the caching mechanism ('First call: Fetches from API and caches in database; Subsequent calls: Returns cached results'), test context injection via _repository_context, and the potential ApiError on network failures. It also documents semantic search behavior and return fields.

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

Conciseness4/5

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

The description is well-structured with clear sections (summary, caching, examples, args, returns, raises) and is front-loaded with a summary. However, it is quite verbose, with multiple repetitive examples for similar filter types (e.g., five damage_type examples). While the detail is helpful for a complex tool, it could be trimmed slightly without losing value.

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

Completeness5/5

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

Given the tool's complexity (12 parameters, no annotations, and an output schema that is not detailed in the context), the description is fully complete. It covers all parameters with semantics and examples, explains the return structure field-by-field, documents error behavior, and discloses caching and test injection. Nothing critical is missing for an agent to correctly invoke this tool.

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

Parameters5/5

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

Schema description coverage is 0%, so the description must fully compensate. It does so with detailed explanations for all 12 parameters, including valid values (e.g., level 0-9, school list), inclusive bounds for level_min/level_max, examples for casting_time, and clarification that 'damage_type' is new in Phase 3. The documents parameter even points to list_documents(). This far exceeds what the bare schema provides.

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 tool's function: 'Search and retrieve D&D 5e spells using the repository pattern.' It uses a specific verb+resource combination and mentions comprehensive filtering, distinguishing it from sibling tools that search other D&D data types (creatures, equipment, rules, etc.). The scope is unambiguous.

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?

The description provides extensive usage guidance through examples and parameter explanations, covering searching by level, school, class, damage type, and combining filters. It also references list_documents() for the documents parameter. However, it does not explicitly state when NOT to use this tool or contrast it with alternatives like search_all, so it falls short of a 5.

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/frap129/lorekeeper-mcp'

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