From 361683fc2b1570dc73c2a912d1574e012fd0db34 Mon Sep 17 00:00:00 2001 From: Hermes Date: Sat, 7 Nov 2026 01:13:18 +0100 Subject: [PATCH] romarr-mcp: import_path, adopt a file with an explicit platform --- packages/romarr-mcp/romarr_mcp.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/packages/romarr-mcp/romarr_mcp.py b/packages/romarr-mcp/romarr_mcp.py index 15d4da6..1eecbe6 100644 --- a/packages/romarr-mcp/romarr_mcp.py +++ b/packages/romarr-mcp/romarr_mcp.py @@ -226,6 +226,25 @@ def t_manual_scan(a): return get("/api/v1/manualimport", path=a["path"], platform=a.get("platform")) +def t_import_path(a): + """Adopt one file or directory with an explicit platform, bypassing the queue. + + `POST /api/v1/manualimport` is the action half of Manual Import: the + platform given here wins over the header guess, which is the whole point -- + an ISO9660 PS2 disc reports itself as psx, so a guess cannot be trusted. + """ + path = (a.get("path") or "").strip() + platform = (a.get("platform") or "").strip() + if not path: + raise ToolError("path is required (a file or directory on ROMarr's host)") + if not platform: + raise ToolError("platform is required (e.g. ps2) -- the header guess is unreliable") + body = {"path": path, "platform": platform} + if a.get("force"): + body["force"] = True + return post("/api/v1/manualimport", body) + + def _obj(props, required=None): return { "type": "object", @@ -403,6 +422,14 @@ TOOLS = [ "write": True, "fn": t_import_finished, }, + { + "name": "import_path", + "description": "Adopt a file or folder into the library with an explicit platform, bypassing queue matching. Use when a finished download never imported.", + "schema": _obj({"path": {"type": "string"}, "platform": P_PLATFORM, + "force": {"type": "boolean"}}, ["path", "platform"]), + "write": True, + "fn": t_import_path, + }, { "name": "manual_scan", "description": "Scan a directory on ROMarr's host for files it could adopt, without importing them.",