From 106bf1014e4ba851ac1e5375b2d817de1a29b132 Mon Sep 17 00:00:00 2001 From: hermes-agent Date: Mon, 2 Nov 2026 13:50:58 +0100 Subject: [PATCH] romm-mcp: restore library scans via POST /api/tasks/scan romm_system action=scan threw client-side: Scan endpoint removed in RomM 5.0. Use the RomM web UI to trigger library scans. That note is stale. The comment above the stub says RomM 5.0 removed POST /api/tasks/run -- true -- but 5.4 serves POST /api/tasks/scan with a ScanPayload (type, platforms, platform_fs_slugs, roms_ids, apis). Verified against the running instance: /api/tasks/scan is in the 5.4.1 OpenAPI (226 paths), and a call with a bad key answers 401 from that exact endpoint rather than 404. So the stub was blocking a working endpoint, and scans still needed a human in the UI. Patch restores runScan() defaulting to type=quick, which indexes new and changed files without re-hashing the whole library (a full scan hashes 229 GB). The patch targets dist/client.js: the npm tarball ships only dist/ plus a .d.ts, so there is no .ts to patch without dragging in typescript. Keep it small and delete it when upstream restores runScan(). --- packages/romm-mcp/package.nix | 6 ++++++ packages/romm-mcp/romm-mcp-scan.patch | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 packages/romm-mcp/romm-mcp-scan.patch diff --git a/packages/romm-mcp/package.nix b/packages/romm-mcp/package.nix index 76b5ca4..03f7cd8 100644 --- a/packages/romm-mcp/package.nix +++ b/packages/romm-mcp/package.nix @@ -22,6 +22,12 @@ buildNpmPackage rec { postPatch = '' cp ${./package-lock.json} package-lock.json + + # romm_system action=scan was stubbed out client-side ("Scan endpoint removed in + # RomM 5.0"), but RomM 5.4 restored POST /api/tasks/scan, so the stub only blocks a + # working endpoint. Upstream publishes no sources in the npm tarball, so this patches + # the compiled dist/ directly; drop it once upstream restores runScan(). + patch -p1 < ${./romm-mcp-scan.patch} ''; # dist/*.js (tsc output) ships inside the npm tarball, so there is nothing to diff --git a/packages/romm-mcp/romm-mcp-scan.patch b/packages/romm-mcp/romm-mcp-scan.patch new file mode 100644 index 0000000..bf97983 --- /dev/null +++ b/packages/romm-mcp/romm-mcp-scan.patch @@ -0,0 +1,19 @@ +--- a/dist/client.js ++++ b/dist/client.js +@@ -244,8 +244,14 @@ + // NOTE: RomM 5.0 removed the POST /api/tasks/run endpoint. + // Scans are now managed through RQ workers and require background job management. + // Use the RomM web UI for scans and metadata updates. +- async runScan() { +- throw new Error("Scan endpoint removed in RomM 5.0. Use the RomM web UI to trigger library scans."); ++ async runScan(scanType = "quick") { ++ // RomM 5.4 restored library scans behind POST /api/tasks/scan (ScanPayload: ++ // type, platforms, platform_fs_slugs, roms_ids, apis). The stub above predates ++ // that. "quick" indexes new/changed files; "full" re-hashes the whole library. ++ return this.request("/api/tasks/scan", { ++ method: "POST", ++ body: JSON.stringify({ type: scanType }), ++ }); + } + async runMetadataScan() { + throw new Error("Metadata scan endpoint removed in RomM 5.0. Use the RomM web UI to trigger metadata updates.");