romm_search
Search for ROMs by name across your game library, with optional filtering by platform and result limits.
Instructions
Search ROMs by name across the library.
query: Search term (required). platform_id: Filter to a single platform (0 = all). limit: Max results (default 20).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | ||
| platform_id | No | ||
| limit | No |
Implementation Reference
- server.py:566-607 (handler)The implementation of the `romm_search` tool, which searches for ROMs using a query, platform ID, and limit, and returns a formatted string of results.
async def romm_search(query: str, platform_id: int = 0, limit: int = 20) -> str: """Search ROMs by name across the library. query: Search term (required). platform_id: Filter to a single platform (0 = all). limit: Max results (default 20). """ params: dict = { "search_term": query, "limit": min(limit, 100), "offset": 0, "order_by": "name", "order_dir": "asc", } if platform_id: params["platform_ids"] = platform_id data = await _get("roms", params=params, long_timeout=True) items = [] if isinstance(data, dict): items = data.get("items", []) elif isinstance(data, list): items = data if not items: return f"No ROMs found matching \"{query}\"." lines = [f"Search results for \"{query}\" ({len(items)} found):\n"] for i, rom in enumerate(items, 1): name = rom.get("name", "Unknown") platform = rom.get("platform_display_name") or rom.get("platform_slug", "?") size = rom.get("fs_size_bytes", 0) rom_id = rom.get("id", "?") line = f" {i}. {name} [{platform}]" if size: line += f" — {_fmt_size(size)}" lines.append(line) lines.append(f" ID: {rom_id}") return "\n".join(lines) - server.py:565-565 (registration)Registration of the `romm_search` tool using the @mcp.tool() decorator.
@mcp.tool()