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
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- d2r_mcp/server.py:96-106 (handler)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) - d2r_mcp/lookups.py:352-384 (helper)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}) - d2r_mcp/server.py:10-13 (registration)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, ) - d2r_mcp/lookups.py:68-70 (helper)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)