"""Pirate tools — read-only functions the LLM can call. Each tool module exports a TOOLS list of dicts shaped for Anthropic tool use: {"name": str, "description": str, "input_schema": {...}, "read_only": True, "fn": callable} The runtime loads all modules here and builds a combined catalog. The LLM picks which tool to call; the runtime executes it and returns the result as a tool message. """ from . import sonarr, radarr, qbittorrent, storage def build_catalog(): """Return a list of all available tools across all modules.""" catalog = [] for mod in (sonarr, radarr, qbittorrent, storage): catalog.extend(getattr(mod, "TOOLS", [])) return catalog def find_tool(name): for t in build_catalog(): if t["name"] == name: return t return None