Skip to main content
Glama
crabsmadethis

crabsmadethis/d2r-horadric-tools

d2r_search

Search all Diablo II Resurrected item types (uniques, sets, runewords, bases) by name substring. Returns up to 20 results tagged by type.

Instructions

Search across ALL D2R item types: uniques, sets, runewords, bases.

Use this when you don't know what type of item you're looking for. Returns up to 20 results tagged by type.

Args: query: Search term (substring match across all item names)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP tool decorator that registers 'd2r_search' with FastMCP and delegates to search_all()
    @mcp.tool()
    async def d2r_search(query: str) -> str:
        """Search across ALL D2R item types: uniques, sets, runewords, bases.
    
        Use this when you don't know what type of item you're looking for.
        Returns up to 20 results tagged by type.
    
        Args:
            query: Search term (substring match across all item names)
        """
        return search_all(query)
  • Core logic: searches uniques, set items, runewords, and bases by substring match, returning up to limit results tagged by type
    def search_all(query, limit=20):
        """Search across all item types: uniques, sets, runewords, bases.
    
        Returns JSON with results tagged by type, capped at limit.
        """
        if not _HAS_DATA:
            return _NO_DATA_MSG
        q = query.lower()
        results = []
    
        for name, uid in _UNIQUE_NAME_TO_ID.items():
            if q in name:
                results.append({"type": "unique", "id": uid,
                                "name": UNIQUE_ITEMS[uid]["name"]})
    
        for name, sid in _SET_NAME_TO_ID.items():
            if q in name:
                results.append({"type": "set_item", "id": sid,
                                "name": SET_ITEMS[sid]["name"],
                                "set": SET_ITEMS[sid]["set"]})
    
        for name, rwid in _RW_NAME_TO_ID.items():
            if q in name:
                results.append({"type": "runeword", "id": rwid,
                                "name": RUNEWORDS[rwid]["name"]})
    
        for name, code in _BASE_NAME_TO_CODE.items():
            if q in name:
                results.append({"type": "base", "code": code,
                                "name": ITEM_BASES[code]["name"]})
    
        results = results[:limit]
        return _fmt({"results": results, "count": len(results), "query": query})
  • Import of search_all from d2r_mcp.lookups, connecting the tool registration to the implementation
    from d2r_mcp.lookups import (
        lookup_unique, lookup_set_item, lookup_item_base,
        lookup_runeword, lookup_stat, lookup_skill, search_all,
    )
  • JSON formatting helper used by search_all to format its results
    def _fmt(obj):
        """Format a result dict as readable JSON."""
        return json.dumps(obj, indent=2, default=str)
Behavior4/5

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

With no annotations, the description carries the full burden. It states the search uses substring match across all item names, returns up to 20 results tagged by type, which are key behavioral traits. However, it omits details like case sensitivity, empty result behavior, or ordering. Still, it provides a reasonable overview for a search tool.

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?

The description is concise (two sentences plus an Args section). It is front-loaded with the main purpose, then usage guidance, then parameter details. Every sentence adds value without redundancy.

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 simplicity (one string input, output described by schema), the description covers the essentials: scope, matching, result limit, and tagging. The existence of an output schema offloads return-value details, and the description aligns well with expected behavior.

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?

The single parameter 'query' is described as 'search term (substring match across all item names)', adding critical meaning beyond the schema's generic 'string' type. The schema coverage is 0%, so the description fully compensates, clarifying how the parameter is used.

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 identifies the tool's purpose: 'Search across ALL D2R item types: uniques, sets, runewords, bases.' It explicitly enumerates the types, and the name 'd2r_search' contrast with specific lookup siblings like 'd2r_lookup_unique' and 'd2r_lookup_runeword', making the scope obvious.

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

Usage Guidelines5/5

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

The description contains explicit guidance: 'Use this when you don't know what type of item you're looking for.' This directly tells the agent when to prefer this tool over the type-specific lookups. It also mentions the result limit (20) and tagging, providing clear context.

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/crabsmadethis/d2r-horadric-tools'

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