deep-roon-mcp 0.5.7 → 0.5.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -22,7 +22,7 @@ server of its own and sends nothing anywhere else. What you ask goes to your MCP
22
22
 
23
23
  ## Status
24
24
 
25
- Version 0.5: sixty-one tools (fifty-five with a read-only library; sixty-five with playlist editing on). Qobuz, TIDAL or both — whatever is signed in on your Core.
25
+ Version 0.5: sixty-four tools (fifty-eight with a read-only library; sixty-eight with playlist editing on). Qobuz, TIDAL or both — whatever is signed in on your Core.
26
26
 
27
27
  **Reading** — changes nothing in Roon:
28
28
 
@@ -44,6 +44,7 @@ Version 0.5: sixty-one tools (fifty-five with a read-only library; sixty-five wi
44
44
  | `roon_cover` | The cover of what plays, as an image |
45
45
  | `roon_history` | Roon's play history, newest first |
46
46
  | `roon_top` | Most played albums, artists or tracks over your whole history |
47
+ | `roon_profiles` | The Roon profiles, and the one Deep Roon uses |
47
48
  | `roon_library` | Your library with Roon's Focus: stars, genre, label, artist, composer, producer, years, hi-res, live … sorted any way |
48
49
  | `roon_focus` | The Focus panel: what your library (or part of it) is made of, with counts |
49
50
  | `roon_tracks`, `roon_artists` | Focus on tracks and artists (and composers) |
@@ -60,6 +61,7 @@ Version 0.5: sixty-one tools (fifty-five with a read-only library; sixty-five wi
60
61
  | `roon_similar` | More like this, for an album or an artist |
61
62
  | `roon_signal_path` | Roon's signal path for what plays: is it bit-perfect, what happens on the way |
62
63
  | `roon_dsp` | MUSE: the DSP set up for a zone |
64
+ | `roon_devices` | The RAAT audio devices of Settings › Audio: enabled, and whether they have a zone |
63
65
  | `roon_radio` | Live Radio: your own stations, the directory by category and genre |
64
66
 
65
67
  **Playing** — only on your request:
@@ -78,6 +80,7 @@ Version 0.5: sixty-one tools (fifty-five with a read-only library; sixty-five wi
78
80
  | `roon_group`, `roon_ungroup` | Group zones, and undo it |
79
81
  | `roon_sleep` | A sleep timer |
80
82
  | `roon_standby` | Put a device in standby, or wake it |
83
+ | `roon_device_reset` | Disable and enable a device stuck on "Enabling…" (enabled, no zone) — only those |
81
84
  | `roon_play_playlist` | A playlist on a zone (also a TIDAL one), optionally shuffled |
82
85
  | `roon_play_mix` | One of today's Daily Mixes |
83
86
  | `roon_play_radio` | A Live Radio station on a zone |
@@ -160,7 +163,7 @@ or by hand in `~/.codex/config.toml`:
160
163
  [mcp_servers.deep-roon]
161
164
  command = "npx"
162
165
  args = ["-y", "deep-roon-mcp"]
163
- # env = { ROON_HOST = "", DEEP_ROON_TOOLS = "", DEEP_ROON_INTERNAL = "", DEEP_ROON_READ_ONLY = "" }
166
+ # env = { ROON_HOST = "", ROON_PROFILE = "", DEEP_ROON_TOOLS = "", DEEP_ROON_INTERNAL = "", DEEP_ROON_READ_ONLY = "" }
164
167
  ```
165
168
 
166
169
  ChatGPT on the web can't run a server on your computer — use the desktop app.
@@ -173,18 +176,24 @@ ChatGPT on the web can't run a server on your computer — use the desktop app.
173
176
  "deep-roon": {
174
177
  "command": "npx",
175
178
  "args": ["-y", "deep-roon-mcp"],
176
- "env": { "ROON_HOST": "", "DEEP_ROON_TOOLS": "", "DEEP_ROON_INTERNAL": "", "DEEP_ROON_READ_ONLY": "" }
179
+ "env": { "ROON_HOST": "", "ROON_PROFILE": "", "DEEP_ROON_TOOLS": "", "DEEP_ROON_INTERNAL": "", "DEEP_ROON_READ_ONLY": "" }
177
180
  }
178
181
  }
179
182
  }
180
183
  ```
181
184
 
182
- The same settings as environment variables: `ROON_HOST` (the Core's address, empty = find it), `DEEP_ROON_TOOLS=essentials`,
185
+ The same settings as environment variables: `ROON_HOST` (the Core's address, empty = find it), `ROON_PROFILE` (a Roon profile
186
+ by name, empty = the first; see below), `DEEP_ROON_TOOLS=essentials`,
183
187
  `DEEP_ROON_INTERNAL=off`, `DEEP_ROON_READ_ONLY=library` (nothing changes the library; playing works) or `DEEP_ROON_READ_ONLY=all`
184
188
  (Deep Roon only looks: no playing, queueing or zone changes either), `DEEP_ROON_PLAYLIST_EDIT=1` (the playlist edits). Leave out what you don't need. VS Code calls the block `"servers"` instead of `"mcpServers"`.
185
189
 
186
190
  Then, once, in Roon: Settings › Extensions › **Enable** next to "Deep Roon MCP". Until then the tools say so.
187
191
 
192
+ **Roon profiles.** The play history, most played, Daily Picks, Daily Mixes, New for you, favourites and Listen Later belong to
193
+ a Roon profile. Deep Roon is a Roon remote of its own, like each Roon app, so switching profiles in a Roon app doesn't change
194
+ it: it uses `ROON_PROFILE` (or **Roon profile** in Claude Desktop's settings), else the first profile. Those tools also take
195
+ `profile` for one question ("what did Anna play this week?"); `roon_profiles` lists the names.
196
+
188
197
  ### Over HTTP
189
198
 
190
199
  For a client that can't start a program on your computer, Deep Roon MCP can serve MCP over HTTP instead (Streamable
@@ -9269,6 +9269,9 @@ var init_client = __esm({
9269
9269
  graph = new ObjectGraph();
9270
9270
  explicitProfile;
9271
9271
  cachedProfile;
9272
+ /** The profile chosen by name (7 Nov 2026, forum: "after switching profiles, roon_history still returns my first
9273
+ * profile") — see core/session.ts; unset = the explicit option, else the first Profile in the graph. */
9274
+ chosenProfile;
9272
9275
  settleMs;
9273
9276
  /** Added 8 Oct 2026: a PING every 10 s while connected (see RemotingClient.ping); stops at the first failed one —
9274
9277
  * a caller may replace conn.onclosed, so the close hook alone is not enough. */
@@ -9291,7 +9294,11 @@ var init_client = __esm({
9291
9294
  * on every other Core the server matched nothing against it, which is a big
9292
9295
  * part of why search returned no results.
9293
9296
  */
9297
+ useProfile(id) {
9298
+ this.chosenProfile = id;
9299
+ }
9294
9300
  profile() {
9301
+ if (this.chosenProfile) return this.chosenProfile;
9295
9302
  if (this.explicitProfile) return this.explicitProfile;
9296
9303
  if (this.cachedProfile) return this.cachedProfile;
9297
9304
  for (const o of this.graph.objects.values()) {
@@ -9865,9 +9872,14 @@ async function exportPlayHistory(client2, options) {
9865
9872
  if (!result.success) throw new Error(`VirtualHistoryQuery failed: ${result.status}`);
9866
9873
  const [queryOid] = readFlexLong(Uint8Array.from(result.payload), 0);
9867
9874
  try {
9875
+ let seen2 = 0;
9868
9876
  const total = await pollFor("history Count", timeoutMs, pollIntervalMs, () => {
9869
- const count = field(client2.graph.getObject(queryOid), "::Count");
9870
- if (count === void 0) return void 0;
9877
+ const q = client2.graph.getObject(queryOid);
9878
+ const count = field(q, "::Count");
9879
+ if (count === void 0) {
9880
+ if (q && !seen2) seen2 = Date.now();
9881
+ return q && Date.now() - seen2 >= 1500 ? 0 : void 0;
9882
+ }
9871
9883
  if (!Number.isSafeInteger(count) || count < 0) {
9872
9884
  throw new Error(`invalid history Count: ${String(count)}`);
9873
9885
  }
@@ -15457,7 +15469,7 @@ var require_lib2 = __commonJS({
15457
15469
  var version2;
15458
15470
  var init_package = __esm({
15459
15471
  "package.json"() {
15460
- version2 = "0.5.7";
15472
+ version2 = "0.5.9";
15461
15473
  }
15462
15474
  });
15463
15475
 
@@ -15685,6 +15697,29 @@ var init_official = __esm({
15685
15697
  function afterFirstConnect(f) {
15686
15698
  onFirstConnect = f;
15687
15699
  }
15700
+ function asProfile(name, work2) {
15701
+ return name?.trim() ? asked.run(name.trim(), work2) : work2();
15702
+ }
15703
+ function profilesOf(c) {
15704
+ const list = [...c.graph.objects.values()].find((o) => /\.DataList<[\w.]*\.Profile>$/.test(o.typeName));
15705
+ const objs = list ? (list.fields.$items ?? []).map((r) => c.graph.getObject(r.$ref)) : [...c.graph.objects.values()].filter((o) => o.typeName.endsWith(".Profile"));
15706
+ const field3 = /* @__PURE__ */ __name((o, n) => Object.entries(o.fields).find(([k]) => k.endsWith(`::${n}`) || k === n)?.[1], "field");
15707
+ return objs.filter(Boolean).map((o) => ({ name: String(field3(o, "Name") ?? ""), id: field3(o, "ProfileId") })).filter((p) => p.name && Buffer.isBuffer(p.id));
15708
+ }
15709
+ function chooseProfile(c) {
15710
+ const name = wanted ?? (process.env.ROON_PROFILE?.trim() || void 0);
15711
+ if (!name) {
15712
+ c.useProfile(void 0);
15713
+ return;
15714
+ }
15715
+ const all = profilesOf(c), p = all.find((x) => x.name.toLowerCase() === name.toLowerCase());
15716
+ if (!p) throw new RoonError(`No Roon profile called "${name}" \u2014 the profiles: ${all.map((x) => x.name).join(", ") || "none found"}`, "invalid");
15717
+ c.useProfile(p.id);
15718
+ }
15719
+ function profileInUse(c) {
15720
+ const id = c.profile();
15721
+ return profilesOf(c).find((p) => p.id.equals(id))?.name;
15722
+ }
15688
15723
  function findTarget() {
15689
15724
  if (target) return Promise.resolve(target);
15690
15725
  finding ??= locate().finally(() => {
@@ -15765,13 +15800,17 @@ async function open3() {
15765
15800
  return c;
15766
15801
  }
15767
15802
  function withCore(work2) {
15803
+ const mine = asked.getStore();
15768
15804
  const task = queue.then(async () => {
15769
15805
  if (idleTimer) {
15770
15806
  clearTimeout(idleTimer);
15771
15807
  idleTimer = null;
15772
15808
  }
15809
+ wanted = mine;
15773
15810
  try {
15774
- return await work2(await open3());
15811
+ const c = await open3();
15812
+ chooseProfile(c);
15813
+ return await work2(c);
15775
15814
  } catch (e) {
15776
15815
  if (!(e instanceof RoonError && (e.kind === "not_found" || e.kind === "invalid"))) close("after an error");
15777
15816
  throw e;
@@ -15785,7 +15824,9 @@ function withCore(work2) {
15785
15824
  }
15786
15825
  async function fresh() {
15787
15826
  close("a fresh graph");
15788
- return open3();
15827
+ const c = await open3();
15828
+ chooseProfile(c);
15829
+ return c;
15789
15830
  }
15790
15831
  function closeSoon(reason) {
15791
15832
  close(reason);
@@ -15793,10 +15834,11 @@ function closeSoon(reason) {
15793
15834
  function shutdown() {
15794
15835
  close("shutting down");
15795
15836
  }
15796
- var IDLE_MS, INTERNAL_PORT, target, client, idleTimer, queue, onFirstConnect, finding;
15837
+ var import_node_async_hooks, IDLE_MS, INTERNAL_PORT, target, client, idleTimer, queue, onFirstConnect, asked, wanted, finding;
15797
15838
  var init_session = __esm({
15798
15839
  "src/core/session.ts"() {
15799
15840
  "use strict";
15841
+ import_node_async_hooks = require("node:async_hooks");
15800
15842
  init_intern();
15801
15843
  init_discover();
15802
15844
  init_errors();
@@ -15811,6 +15853,11 @@ var init_session = __esm({
15811
15853
  queue = Promise.resolve();
15812
15854
  onFirstConnect = null;
15813
15855
  __name(afterFirstConnect, "afterFirstConnect");
15856
+ asked = new import_node_async_hooks.AsyncLocalStorage();
15857
+ __name(asProfile, "asProfile");
15858
+ __name(profilesOf, "profilesOf");
15859
+ __name(chooseProfile, "chooseProfile");
15860
+ __name(profileInUse, "profileInUse");
15814
15861
  finding = null;
15815
15862
  __name(findTarget, "findTarget");
15816
15863
  __name(locate, "locate");
@@ -16040,11 +16087,11 @@ function signedIn(c, s) {
16040
16087
  const st = field2(o, "LoginStatus");
16041
16088
  return st === void 0 || st === 4 ? o : null;
16042
16089
  }
16043
- function streaming(c, wanted) {
16044
- if (wanted) {
16045
- const o = signedIn(c, wanted);
16046
- if (!o) throw new RoonError(`${SERVICE_NAME[wanted]} isn't signed in on this Roon Core`, "unavailable");
16047
- return { service: wanted, o };
16090
+ function streaming(c, wanted2) {
16091
+ if (wanted2) {
16092
+ const o = signedIn(c, wanted2);
16093
+ if (!o) throw new RoonError(`${SERVICE_NAME[wanted2]} isn't signed in on this Roon Core`, "unavailable");
16094
+ return { service: wanted2, o };
16048
16095
  }
16049
16096
  for (const s of ["qobuz", "tidal"]) {
16050
16097
  const o = signedIn(c, s);
@@ -16074,9 +16121,9 @@ async function search(query, limit3, kind) {
16074
16121
  return { query, rows };
16075
16122
  });
16076
16123
  }
16077
- async function section(name, limit3, offset2, genres2 = [], wanted, what = "albums") {
16124
+ async function section(name, limit3, offset2, genres2 = [], wanted2, what = "albums") {
16078
16125
  return withCore(async (c) => {
16079
- const { service: service2, o } = streaming(c, wanted);
16126
+ const { service: service2, o } = streaming(c, wanted2);
16080
16127
  const methods = SECTIONS[service2];
16081
16128
  if (!methods[name] && !(service2 === "tidal" && genres2.length)) throw new RoonError(`${SERVICE_NAME[service2]} has no shelf "${name}"; choose from ${Object.keys(methods).join(", ")}`, "invalid");
16082
16129
  if (what === "tracks" && service2 !== "tidal") throw new RoonError("Shelves of tracks are TIDAL's; Qobuz's shelves are albums", "invalid");
@@ -16161,9 +16208,9 @@ function tidalStruct(c, type, g) {
16161
16208
  { name: `string ${T}::Path`, propType: 20, value: new BinaryWriter().string(g.path).toBuffer() }
16162
16209
  ]);
16163
16210
  }
16164
- async function genres(parent, wanted) {
16211
+ async function genres(parent, wanted2) {
16165
16212
  return withCore(async (c) => {
16166
- const { service: service2, o } = streaming(c, wanted);
16213
+ const { service: service2, o } = streaming(c, wanted2);
16167
16214
  if (service2 === "tidal") {
16168
16215
  if (parent) throw new RoonError("TIDAL's genres have no sub-genres", "invalid");
16169
16216
  const [g, m] = [await tidalList(c, o, "GetGenres"), await tidalList(c, o, "GetMoods")];
@@ -16398,9 +16445,9 @@ async function bio(key, max, wiki) {
16398
16445
  };
16399
16446
  });
16400
16447
  }
16401
- async function discography(key, wanted) {
16448
+ async function discography(key, wanted2) {
16402
16449
  return withCore(async (c) => {
16403
- const { service: service2, o: q } = streaming(c, wanted);
16450
+ const { service: service2, o: q } = streaming(c, wanted2);
16404
16451
  const pv = await performer(c, key);
16405
16452
  const end = Date.now() + 1500;
16406
16453
  while (Date.now() < end && field2(c.graph.getObject(pv.$ref), "Name") === void 0) await wait(40);
@@ -16696,10 +16743,10 @@ async function focusMembers(c, f, people = ["artist", "composer", "producer"]) {
16696
16743
  }
16697
16744
  if (f.year_from && f.year_from > 1e3) m.push({ name: "MinDate", propType: 23, value: dateValue(f.year_from, 0, 0) });
16698
16745
  if (f.year_to && f.year_to > 1e3) m.push({ name: "MaxDate", propType: 23, value: dateValue(f.year_to, 12, 31) });
16699
- const wanted = [["artist", "artists", "RequirePerformers"], ["composer", "composers", "RequireComposers"], ["producer", "producers", "RequireProduction"]].filter(([p]) => people.includes(p) && f[p]);
16700
- if (wanted.length) {
16746
+ const wanted2 = [["artist", "artists", "RequirePerformers"], ["composer", "composers", "RequireComposers"], ["producer", "producers", "RequireProduction"]].filter(([p]) => people.includes(p) && f[p]);
16747
+ if (wanted2.length) {
16701
16748
  const whole = await albumInfo(c, []);
16702
- for (const [p, list, member2] of wanted) {
16749
+ for (const [p, list, member2] of wanted2) {
16703
16750
  const want = String(f[p]);
16704
16751
  const l = await panelList(c, whole, list, want);
16705
16752
  const hit = l.find((x) => String(x.name).toLowerCase() === want.toLowerCase()) ?? l[0];
@@ -50536,8 +50583,10 @@ async function runImage(work2) {
50536
50583
  __name(runImage, "runImage");
50537
50584
 
50538
50585
  // src/tools/read.ts
50586
+ init_session();
50539
50587
  var READ = { readOnlyHint: true, openWorldHint: false };
50540
50588
  var service = external_exports.enum(["qobuz", "tidal"]).optional().describe("qobuz or tidal \u2014 default: Qobuz when it is signed in in Roon, else TIDAL.");
50589
+ var profile = external_exports.string().optional().describe("A Roon profile by name (roon_profiles lists them) \u2014 default: ROON_PROFILE, else the first profile.");
50541
50590
  var limit = /* @__PURE__ */ __name((max, dflt) => external_exports.number().int().min(1).max(max).optional().describe(`How many (default ${dflt}, at most ${max}).`), "limit");
50542
50591
  function registerReadTools(server, internal = true) {
50543
50592
  const R = /* @__PURE__ */ __name((name) => internal || name === "roon_zones" || name === "roon_now_playing", "R");
@@ -50636,10 +50685,11 @@ function registerReadTools(server, internal = true) {
50636
50685
  limit: limit(500, 30),
50637
50686
  offset: external_exports.number().int().min(0).optional(),
50638
50687
  since: external_exports.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional().describe("Only plays from this date on (YYYY-MM-DD)."),
50639
- before: external_exports.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional().describe("Only plays before this date (YYYY-MM-DD).")
50688
+ before: external_exports.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional().describe("Only plays before this date (YYYY-MM-DD)."),
50689
+ profile
50640
50690
  },
50641
50691
  annotations: READ
50642
- }, ({ limit: n, offset: offset2, since, before }) => run(() => history(n ?? 30, offset2 ?? 0, before, since)));
50692
+ }, ({ limit: n, offset: offset2, since, before, profile: p }) => run(() => asProfile(p, () => history(n ?? 30, offset2 ?? 0, before, since))));
50643
50693
  reg("roon_top", {
50644
50694
  title: "Most played",
50645
50695
  description: 'The most played albums, artists or tracks in Roon, counted over the WHOLE play history (a play counts when at least half the track was heard). Use this for "most listened" questions \u2014 don\'t tally roon_history yourself. `since` and `until` (YYYY-MM-DD) limit the period \u2014 Roon filters by date itself, however far back: "what did I play most in March 2019" is since 2019-03-01, until 2019-04-01.',
@@ -50647,10 +50697,17 @@ function registerReadTools(server, internal = true) {
50647
50697
  what: external_exports.enum(["albums", "artists", "tracks"]).optional(),
50648
50698
  limit: limit(100, 20),
50649
50699
  since: external_exports.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional().describe("Only plays from this date on (YYYY-MM-DD)."),
50650
- until: external_exports.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional().describe("Only plays before this date (YYYY-MM-DD).")
50700
+ until: external_exports.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional().describe("Only plays before this date (YYYY-MM-DD)."),
50701
+ profile
50651
50702
  },
50652
50703
  annotations: READ
50653
- }, ({ what, limit: n, since, until }) => run(() => top(what ?? "albums", n ?? 20, since, until)));
50704
+ }, ({ what, limit: n, since, until, profile: p }) => run(() => asProfile(p, () => top(what ?? "albums", n ?? 20, since, until))));
50705
+ reg("roon_profiles", {
50706
+ title: "Roon profiles",
50707
+ description: "The profiles on this Roon Core, and the one Deep Roon uses (`in_use`). Deep Roon is a Roon remote of its own: switching profiles in a Roon app doesn't change it. The play history, most played, Daily Picks, Daily Mixes, New for you, favourites and Listen Later are per profile \u2014 those tools take `profile` (a name from here) for one question; ROON_PROFILE sets the default.",
50708
+ inputSchema: {},
50709
+ annotations: READ
50710
+ }, () => run(() => withCore(async (c) => ({ profiles: profilesOf(c).map((p) => p.name), in_use: profileInUse(c), default: process.env.ROON_PROFILE?.trim() || null }))));
50654
50711
  }
50655
50712
  __name(registerReadTools, "registerReadTools");
50656
50713
 
@@ -51044,7 +51101,12 @@ __name(findPlaylist, "findPlaylist");
51044
51101
 
51045
51102
  // src/roon/more.ts
51046
51103
  var profileObject = /* @__PURE__ */ __name((c) => {
51047
- const p = [...c.graph.objects.values()].find((o) => o.typeName.endsWith(".Profile"));
51104
+ const id = c.profile();
51105
+ const all = [...c.graph.objects.values()].filter((o) => o.typeName.endsWith(".Profile"));
51106
+ const p = all.find((o) => {
51107
+ const v = field2(o, "ProfileId");
51108
+ return Buffer.isBuffer(v) && v.equals(id);
51109
+ }) ?? all[0];
51048
51110
  if (!p) throw new RoonError("Roon gave no profile");
51049
51111
  return p;
51050
51112
  }, "profileObject");
@@ -51602,6 +51664,66 @@ async function dspSet(zoneName, s) {
51602
51664
  }
51603
51665
  __name(dspSet, "dspSet");
51604
51666
 
51667
+ // src/roon/devices.ts
51668
+ init_session();
51669
+ init_graph();
51670
+ async function raatDevices(c) {
51671
+ const list = await untilField(c, c.serviceOid("Transport"), "RaatServers", 4e3);
51672
+ const servers = items(c, list);
51673
+ const out = [];
51674
+ for (const s of servers) {
51675
+ const devs = field2(s, "Devices") ?? await untilField(c, s.oid, "Devices", 2e3);
51676
+ const refs = obj(c, devs)?.fields?.$items ?? [];
51677
+ await untilLoaded(c, refs, 2e3);
51678
+ for (const d of items(c, devs)) {
51679
+ const name = field2(d, "Name");
51680
+ if (typeof name !== "string") continue;
51681
+ const ep = obj(c, field2(d, "Endpoint"));
51682
+ const zone3 = !!ep && obj(c, field2(ep, "Zone")) != null;
51683
+ out.push({
51684
+ name,
51685
+ server: String(field2(s, "MachineName") ?? ""),
51686
+ ip: String(field2(s, "IPAddress") ?? ""),
51687
+ enabled: flag(field2(d, "IsEnabled")),
51688
+ zone: zone3,
51689
+ status: String(field2(d, "Status") ?? ""),
51690
+ oid: BigInt(d.oid)
51691
+ });
51692
+ }
51693
+ }
51694
+ return out;
51695
+ }
51696
+ __name(raatDevices, "raatDevices");
51697
+ var show = /* @__PURE__ */ __name((d) => ({ name: d.name, machine: d.server, ip: d.ip, enabled: d.enabled, zone: d.zone, ...d.status ? { status: d.status } : {} }), "show");
51698
+ async function devices() {
51699
+ return withCore(async (c) => ({ devices: (await raatDevices(c)).map(show) }));
51700
+ }
51701
+ __name(devices, "devices");
51702
+ async function deviceReset(opts) {
51703
+ if (!opts.name && !opts.ip) throw new RoonError("Give a device name or the address of its RAAT server", "invalid");
51704
+ return withCore(async (c) => {
51705
+ const want = opts.name?.toLowerCase();
51706
+ const all = await raatDevices(c);
51707
+ const match = all.filter((d) => (!want || d.name.toLowerCase() === want) && (!opts.ip || d.ip === opts.ip));
51708
+ if (!match.length) throw new RoonError(`No RAAT device ${opts.name ?? ""}${opts.ip ? " at " + opts.ip : ""}; Roon has: ${all.map((d) => d.name).join(", ")}`, "not_found");
51709
+ const stuck = match.filter((d) => d.enabled && !d.zone);
51710
+ const done = [];
51711
+ for (const d of stuck) {
51712
+ await short(c.call("RaatServerAudioDevice", "Disable", [{ type: "ResultCallback", name: "cb_result" }], Buffer.alloc(0), d.oid), 6e3);
51713
+ await wait(800);
51714
+ await short(c.call("RaatServerAudioDevice", "Enable", [{ type: "ResultCallback<Endpoint>", name: "cb_result" }], Buffer.alloc(0), d.oid), 8e3);
51715
+ done.push(d.name);
51716
+ }
51717
+ if (done.length) await wait(3e3);
51718
+ const after = (await raatDevices(c)).filter((d) => match.some((m) => m.oid === d.oid)).map(show);
51719
+ return { reset: done, left_alone: match.filter((d) => !stuck.includes(d)).map((d) => `${d.name} (${d.enabled ? "has a zone" : "disabled"})`), now: after };
51720
+ });
51721
+ }
51722
+ __name(deviceReset, "deviceReset");
51723
+
51724
+ // src/tools/library.ts
51725
+ init_session();
51726
+
51605
51727
  // src/roon/playlist-edit.ts
51606
51728
  var import_node_crypto = require("node:crypto");
51607
51729
  init_intern();
@@ -51848,6 +51970,7 @@ var PLAYS2 = { readOnlyHint: false, destructiveHint: false, openWorldHint: false
51848
51970
  var CHANGES = { readOnlyHint: false, destructiveHint: true, openWorldHint: false };
51849
51971
  var zone2 = external_exports.string().describe("A Roon zone name (see roon_zones).");
51850
51972
  var mode2 = external_exports.enum(["now", "next", "queue"]).optional().describe("now (default), next, or queue (at the end).");
51973
+ var profile2 = external_exports.string().optional().describe("A Roon profile by name (roon_profiles lists them) \u2014 default: ROON_PROFILE, else the first profile.");
51851
51974
  var limit2 = /* @__PURE__ */ __name((max, dflt) => external_exports.number().int().min(1).max(max).optional().describe(`How many (default ${dflt}, at most ${max}).`), "limit");
51852
51975
  var offset = external_exports.number().int().min(0).optional().describe("Paging: where to start (in steps of `limit`).");
51853
51976
  var days = external_exports.number().int().min(1).optional();
@@ -51958,27 +52081,27 @@ function registerLibraryTools(server) {
51958
52081
  server.registerTool("roon_daily_picks", {
51959
52082
  title: "Daily Picks",
51960
52083
  description: 'Roon\'s Daily Picks from the Home screen \u2014 today\'s personal recommendations, in boxes. Each box has its `kind`, its `reason` (new_release; recent = from what was played lately; all_time = from long-term listening) and `because_you_played` \u2014 the album the box is built on \u2014 plus the recommended albums with a `key`. `limit` is per box (default 8). THE tool for "what does Roon recommend today", "my daily picks".',
51961
- inputSchema: { limit: limit2(30, 8) },
52084
+ inputSchema: { limit: limit2(30, 8), profile: profile2 },
51962
52085
  annotations: READ2
51963
- }, ({ limit: n }) => run(() => dailyPicks(n ?? 8)));
52086
+ }, ({ limit: n, profile: p }) => run(() => asProfile(p, () => dailyPicks(n ?? 8))));
51964
52087
  server.registerTool("roon_mix", {
51965
52088
  title: "A Daily Mix's tracks",
51966
52089
  description: "The tracks inside one of Roon's Daily Mixes (by `key` or name from roon_mixes), as Roon's mix page shows them before playing \u2014 each with a `key` for roon_play_tracks. To play the whole mix, roon_play_mix.",
51967
- inputSchema: { key: external_exports.string().describe("A mix key or its name, from roon_mixes."), limit: limit2(300, 100) },
52090
+ inputSchema: { key: external_exports.string().describe("A mix key or its name, from roon_mixes."), limit: limit2(300, 100), profile: profile2 },
51968
52091
  annotations: READ2
51969
- }, ({ key, limit: n }) => run(() => mix(key, n ?? 100)));
52092
+ }, ({ key, limit: n, profile: p }) => run(() => asProfile(p, () => mix(key, n ?? 100))));
51970
52093
  server.registerTool("roon_new_for_you", {
51971
52094
  title: "New releases for you",
51972
52095
  description: '"New releases for you" from Roon\'s Home: new albums Roon picked for this user, from the artists and music they listen to \u2014 personal, unlike roon_new (the streaming services\' editorial shelf, the same for everyone). Use it for "my new releases", "what\'s new for me". Albums carry year, format, `genres`, sometimes a `review`, and a `key`; `genres` at the top counts the shelf\'s top-level genres (the choices for `genre`).',
51973
- inputSchema: { limit: limit2(100, 30), offset, genre: external_exports.string().optional().describe("Only albums of this genre (a Roon genre name, e.g. Jazz; sub-genres match too).") },
52096
+ inputSchema: { limit: limit2(100, 30), offset, genre: external_exports.string().optional().describe("Only albums of this genre (a Roon genre name, e.g. Jazz; sub-genres match too)."), profile: profile2 },
51974
52097
  annotations: READ2
51975
- }, ({ limit: n, offset: o, genre }) => run(() => newForYou(n ?? 30, o ?? 0, genre)));
52098
+ }, ({ limit: n, offset: o, genre, profile: p }) => run(() => asProfile(p, () => newForYou(n ?? 30, o ?? 0, genre))));
51976
52099
  server.registerTool("roon_mixes", {
51977
52100
  title: "Daily Mixes",
51978
52101
  description: 'Roon\'s own Daily Mixes, from Roon\'s Home \u2014 NOT TIDAL\'s mixes: for "TIDAL mixes", "My Mix", "My Daily Discovery" or TIDAL\'s daily mixes use roon_tidal_playlists with `shelf: "my_mixes"`. These are today\'s personal Roon mixes, each built around an artist (or genre) the user listens to, with a few `touchstones` and a `key` for roon_play_mix. They change every day.',
51979
- inputSchema: {},
52102
+ inputSchema: { profile: profile2 },
51980
52103
  annotations: READ2
51981
- }, () => run(() => mixes()));
52104
+ }, ({ profile: p }) => run(() => asProfile(p, () => mixes())));
51982
52105
  server.registerTool("roon_play_mix", {
51983
52106
  title: "Play a Daily Mix",
51984
52107
  description: "Play one of today's Daily Mixes on a Roon zone (`key` from roon_mixes, or the mix's name). `mode`: now (default), next or queue. Only on an explicit request, never as a probe.",
@@ -52025,9 +52148,9 @@ function registerLibraryTools(server) {
52025
52148
  server.registerTool("roon_favorites", {
52026
52149
  title: "Favourite albums",
52027
52150
  description: 'The user\'s favourite albums: `source: "roon"` (default) are the albums with a heart in Roon, newest first; `source: "qobuz"` or `"tidal"` the favourites at that service. Albums carry a `key`.',
52028
- inputSchema: { source: external_exports.enum(["roon", "qobuz", "tidal"]).optional(), limit: limit2(100, 50) },
52151
+ inputSchema: { source: external_exports.enum(["roon", "qobuz", "tidal"]).optional(), limit: limit2(100, 50), profile: profile2 },
52029
52152
  annotations: READ2
52030
- }, ({ source, limit: n }) => run(() => favorites(source ?? "roon", n ?? 50)));
52153
+ }, ({ source, limit: n, profile: p }) => run(() => asProfile(p, () => favorites(source ?? "roon", n ?? 50))));
52031
52154
  server.registerTool("roon_radio_favorite", {
52032
52155
  title: "A station in My Live Radio",
52033
52156
  description: "Put a Live Radio station in the user's own list (My Live Radio), or take it out (`on: false`). The `key` comes from roon_radio. Changes the user's library: only on an explicit request. Reads the result back.",
@@ -52043,9 +52166,9 @@ function registerLibraryTools(server) {
52043
52166
  server.registerTool("roon_listen_later", {
52044
52167
  title: "Listen Later",
52045
52168
  description: "The user's Listen Later list in Roon: the albums (and tracks) marked to hear later, newest first, each with a `key`. By default only what still waits; `include_played: true` adds what has been heard since.",
52046
- inputSchema: { include_played: external_exports.boolean().optional() },
52169
+ inputSchema: { include_played: external_exports.boolean().optional(), profile: profile2 },
52047
52170
  annotations: READ2
52048
- }, ({ include_played }) => run(() => listenLater(include_played === true)));
52171
+ }, ({ include_played, profile: p }) => run(() => asProfile(p, () => listenLater(include_played === true))));
52049
52172
  server.registerTool("roon_listen_later_set", {
52050
52173
  title: "Listen Later: add or remove",
52051
52174
  description: "Put an album or a track on the Listen Later list in Roon, or take it off (`on: false`) \u2014 the natural thing to offer after recommending something the user can't hear right now. Changes the library: only on an explicit request. Reads it back.",
@@ -52088,6 +52211,18 @@ function registerLibraryTools(server) {
52088
52211
  inputSchema: { zone: zone2, enabled: external_exports.boolean().optional(), part: external_exports.string().optional(), preset: external_exports.string().optional() },
52089
52212
  annotations: CHANGES
52090
52213
  }, ({ zone: zn, enabled: enabled2, part, preset }) => run(() => dspSet(zn, { enabled: enabled2, part, preset })));
52214
+ server.registerTool("roon_devices", {
52215
+ title: "Audio devices",
52216
+ description: `Roon's RAAT audio devices as Settings \u2192 Audio shows them: per device its name, the machine and address of its RAAT server, whether it is enabled, and whether it has a zone now. An enabled device without a zone is usually stuck on "Enabling\u2026" (see roon_device_reset).`,
52217
+ inputSchema: {},
52218
+ annotations: READ2
52219
+ }, () => run(() => devices()));
52220
+ server.registerTool("roon_device_reset", {
52221
+ title: "Reset a stuck device",
52222
+ description: 'Disable and enable a RAAT device that is enabled but has no zone \u2014 what you do by hand in Settings \u2192 Audio when a device hangs on "Enabling\u2026" (Roon backs off after failed connections, e.g. a phone that changed networks). Only devices in that state are touched; others are left alone. By `name` or by `ip`, the address of the device\'s RAAT server (from roon_devices). Reads back.',
52223
+ inputSchema: { name: external_exports.string().optional().describe("The device name, as in roon_devices."), ip: external_exports.string().optional().describe("The address of its RAAT server, as in roon_devices.") },
52224
+ annotations: CHANGES
52225
+ }, ({ name, ip }) => run(() => deviceReset({ name, ip })));
52091
52226
  }
52092
52227
  __name(registerLibraryTools, "registerLibraryTools");
52093
52228
 
@@ -52207,6 +52342,7 @@ var INSTRUCTIONS = `Deep Roon MCP connects to the user's own Roon Core (music pl
52207
52342
  - Unofficial: this uses Roon's internal protocol, which a Roon update can change; if a tool says so, tell the user to check for an update.`;
52208
52343
  var LIBRARY_WRITES = /* @__PURE__ */ new Set([...PLAYLIST_WRITES, "roon_playlist_create", "roon_favorite", "roon_radio_favorite", "roon_listen_later_set", "roon_library_add", "roon_dsp_set"]);
52209
52344
  var PLAYBACK = /* @__PURE__ */ new Set([
52345
+ "roon_device_reset",
52210
52346
  "roon_play",
52211
52347
  "roon_play_tracks",
52212
52348
  "roon_play_radio",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deep-roon-mcp",
3
- "version": "0.5.7",
3
+ "version": "0.5.9",
4
4
  "description": "An MCP server for Roon that reaches the parts the official API doesn't: reviews, biographies, Qobuz's and TIDAL's shelves, TIDAL's playlists, your history, search across your library and the streaming services",
5
5
  "license": "Apache-2.0",
6
6
  "author": "René Bouwmeester <21277119+renebouwmeester@users.noreply.github.com>",