deep-roon-mcp 0.5.2 → 0.5.4

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
@@ -39,6 +39,7 @@ Version 0.5: fifty-nine tools (fifty-three with a read-only library). Qobuz, TID
39
39
  | `roon_status` | How Deep Roon MCP stands: Core, pairing, internal protocol, self-test, newer version |
40
40
  | `roon_zones` | Roon's zones and groups |
41
41
  | `roon_now_playing` | What plays in each zone, with the volume |
42
+ | `roon_waveform` | The waveform of what plays in a zone, as Roon draws it in its seek bar (local files, and streams once played) |
42
43
  | `roon_queue` | A zone's queue, numbered (1 is what plays) |
43
44
  | `roon_cover` | The cover of what plays, as an image |
44
45
  | `roon_history` | Roon's play history, newest first |
@@ -15538,7 +15538,7 @@ var require_lib2 = __commonJS({
15538
15538
  var version2;
15539
15539
  var init_package = __esm({
15540
15540
  "package.json"() {
15541
- version2 = "0.5.2";
15541
+ version2 = "0.5.4";
15542
15542
  }
15543
15543
  });
15544
15544
 
@@ -16030,6 +16030,8 @@ function albumRow(c, o) {
16030
16030
  if (typeof p === "number") r.popularity = Math.round(p * 100) / 100;
16031
16031
  const img = imageKey(c, o);
16032
16032
  if (img) r.image = img;
16033
+ const at2 = field2(o, "Type");
16034
+ r.album_type = ALBUM_TYPES[typeof at2 === "number" ? at2 : 0] ?? "unknown";
16033
16035
  return r;
16034
16036
  }
16035
16037
  function resultRow(c, o) {
@@ -16073,7 +16075,7 @@ function trackArtist(c, r, tr, al) {
16073
16075
  if (!namen.length || namen.includes(albumArtiest) || namen.every((n) => albumArtiest.includes(n))) return;
16074
16076
  r.track_artist = namen.join(", ");
16075
16077
  }
16076
- var obj, clean, typeOf, items, strings, flag, yearOf, wait;
16078
+ var obj, clean, typeOf, items, strings, flag, yearOf, wait, ALBUM_TYPES;
16077
16079
  var init_graph = __esm({
16078
16080
  "src/roon/graph.ts"() {
16079
16081
  "use strict";
@@ -16105,6 +16107,7 @@ var init_graph = __esm({
16105
16107
  __name(duration3, "duration");
16106
16108
  __name(localTime, "localTime");
16107
16109
  __name(sourceOf, "sourceOf");
16110
+ ALBUM_TYPES = ["main", "single", "compilation", "other", "unknown", "ep", "soundtrack", "show"];
16108
16111
  __name(albumRow, "albumRow");
16109
16112
  __name(resultRow, "resultRow");
16110
16113
  __name(trackArtist, "trackArtist");
@@ -16635,6 +16638,11 @@ __export(focus_exports, {
16635
16638
  work: () => work,
16636
16639
  works: () => works
16637
16640
  });
16641
+ function albumTypeOf(x) {
16642
+ const k = x.toLowerCase().replace(/releases?|s$/g, "").replace(/[^a-z]/g, "");
16643
+ const alias = { mainrelease: "main", album: "main", extendedplay: "ep", ost: "soundtrack" };
16644
+ return ALBUM_TYPES.indexOf(alias[k] ?? k);
16645
+ }
16638
16646
  async function virtualQuery(c, kind, members2, limit3, offset2, row) {
16639
16647
  const schema = structSchema(`Sooloos.Broker.Api.${kind}QueryCriteria`) ?? [];
16640
16648
  const missing = members2.find((f) => !schema.some((m) => m.shortName === f.name));
@@ -16756,6 +16764,15 @@ async function focusMembers(c, f, people = ["artist", "composer", "producer"]) {
16756
16764
  if (f.compilation === true) m.push(yes("RequireIsCompilation"));
16757
16765
  else if (f.compilation === false) m.push(yes("ExcludeIsCompilation"));
16758
16766
  if (f.picks) m.push(yes("RequireIsPick"));
16767
+ if (f.bootleg === true) m.push(yes("RequireIsBootleg"));
16768
+ else if (f.bootleg === false) m.push(yes("ExcludeIsBootleg"));
16769
+ for (const [arg, member2] of [[f.album_type, "RequireTypes"], [f.exclude_album_type, "ExcludeTypes"]]) {
16770
+ if (!arg) continue;
16771
+ const want = names(arg).map((x) => albumTypeOf(x));
16772
+ const bad = want.findIndex((x) => x < 0);
16773
+ if (bad >= 0) throw new RoonError(`album type "${names(arg)[bad]}": choose from ${ALBUM_TYPES.join(", ")}`, "invalid");
16774
+ m.push({ name: member2, propType: 23, value: intList(want) });
16775
+ }
16759
16776
  if (f.year_from && f.year_from > 1e3) m.push({ name: "MinDate", propType: 23, value: dateValue(f.year_from, 0, 0) });
16760
16777
  if (f.year_to && f.year_to > 1e3) m.push({ name: "MaxDate", propType: 23, value: dateValue(f.year_to, 12, 31) });
16761
16778
  const wanted = [["artist", "artists", "RequirePerformers"], ["composer", "composers", "RequireComposers"], ["producer", "producers", "RequireProduction"]].filter(([p]) => people.includes(p) && f[p]);
@@ -16839,6 +16856,8 @@ async function focus(f, more, search2, limit3) {
16839
16856
  compilations: field2(info, "IsCompilationCount") ?? 0,
16840
16857
  roon_picks: field2(info, "IsPickCount") ?? 0,
16841
16858
  mqa: field2(info, "IsMQACount") ?? 0,
16859
+ // Roon's album types (main release, single, EP, soundtrack …); the default, main, comes without a value.
16860
+ album_types: hist("Types").map((x) => ({ type: ALBUM_TYPES[typeof x.w === "number" ? x.w : 0] ?? "unknown", albums: x.n })).sort((a, b) => b.albums - a.albums),
16842
16861
  // Raw histograms, to be named once measured (13 Oct 2026): where the albums live, and their file formats.
16843
16862
  storage: hist("Locations").map((x) => {
16844
16863
  const n = isRef2(x.w) ? String(field2(obj(c, x.w), "Name") ?? "") : String(x.w);
@@ -16983,6 +17002,7 @@ var init_focus = __esm({
16983
17002
  init_session();
16984
17003
  init_graph();
16985
17004
  init_library();
17005
+ __name(albumTypeOf, "albumTypeOf");
16986
17006
  intList = /* @__PURE__ */ __name((xs) => {
16987
17007
  const w = new BinaryWriter().flexInt(xs.length);
16988
17008
  for (const x of xs) w.integer(x);
@@ -49703,6 +49723,66 @@ async function nowPlaying() {
49703
49723
  });
49704
49724
  }
49705
49725
  __name(nowPlaying, "nowPlaying");
49726
+ function ints(c, v) {
49727
+ const o = obj(c, v);
49728
+ const list = o?.fields?.$items ?? o?.$items ?? (Array.isArray(o) ? o : null);
49729
+ if (Array.isArray(list)) return list.map(Number).filter((n) => Number.isFinite(n));
49730
+ return null;
49731
+ }
49732
+ __name(ints, "ints");
49733
+ var lastWave = /* @__PURE__ */ new Map();
49734
+ async function waveform(zone3, points = 100, raw = false) {
49735
+ return withCore(async (c) => {
49736
+ const zn = findZone(c, zone3);
49737
+ const z2 = c.graph.getObject(zn.oid);
49738
+ const v = field2(z2, "WaveformData");
49739
+ const vals = ints(c, v);
49740
+ const np = obj(c, field2(z2, "NowPlaying"));
49741
+ const tr = obj(c, field2(items(c, field2(np, "Tracks"))[0], "Track"));
49742
+ const r = { zone: zn.name };
49743
+ if (field2(tr, "Title")) r.title = field2(tr, "Title");
49744
+ if (raw) {
49745
+ r.shape = v === void 0 ? "absent" : isRef2(v) ? "ref" : Buffer.isBuffer(v) ? `buffer ${v.length}` : typeof v;
49746
+ if (Buffer.isBuffer(v)) r.bytes = [...v.subarray(0, 64)];
49747
+ if (isRef2(v)) r.object = Object.keys(obj(c, v)?.fields ?? {});
49748
+ if (vals) {
49749
+ r.count = vals.length;
49750
+ r.values = vals;
49751
+ }
49752
+ return r;
49753
+ }
49754
+ const none = "No waveform for this track yet: Roon makes one for a stream the first time it plays (within half a minute or so), and for a local file when it has analysed it.";
49755
+ if (!vals?.length) {
49756
+ r.waveform = null;
49757
+ r.note = none;
49758
+ return r;
49759
+ }
49760
+ const track = String(field2(tr, "TrackId") ?? field2(tr, "Title") ?? ""), sig = vals.join(","), was = lastWave.get(String(zn.oid));
49761
+ if (was && was.track !== track && was.sig === sig) {
49762
+ r.waveform = null;
49763
+ r.note = none;
49764
+ return r;
49765
+ }
49766
+ lastWave.set(String(zn.oid), { track, sig });
49767
+ const steps = Array.from({ length: Math.floor(vals.length / 2) }, (_, i) => Math.max(vals[2 * i], vals[2 * i + 1]));
49768
+ const n = Math.max(1, Math.min(points, steps.length)), per = steps.length / n;
49769
+ r.points = n;
49770
+ r.waveform = Array.from({ length: n }, (_, i) => {
49771
+ let som = 0, k = 0;
49772
+ for (let j = Math.floor(i * per); j < Math.max(Math.floor((i + 1) * per), Math.floor(i * per) + 1); j++) {
49773
+ som += steps[j];
49774
+ k++;
49775
+ }
49776
+ return Math.round(som / k / 255 * 100) / 100;
49777
+ });
49778
+ const pos = field2(z2, "SeekPosition");
49779
+ if (typeof pos === "number") r.position = duration3(pos);
49780
+ const l = field2(tr, "LengthSeconds");
49781
+ if (typeof l === "number") r.length = duration3(l);
49782
+ return r;
49783
+ });
49784
+ }
49785
+ __name(waveform, "waveform");
49706
49786
 
49707
49787
  // src/roon/radio.ts
49708
49788
  init_intern();
@@ -50598,6 +50678,16 @@ function registerReadTools(server, internal = true) {
50598
50678
  inputSchema: {},
50599
50679
  annotations: READ
50600
50680
  }, () => run(() => internal ? zones2() : zones3()));
50681
+ reg("roon_waveform", {
50682
+ title: "Waveform",
50683
+ description: "The waveform of the track that plays in a zone, as Roon draws it in its seek bar: `waveform` is a list of heights from 0 to 1 (`points` of them, default 100), left to right over the track, with the `position` and `length`. Draw it as Roon does: each height a thin bar mirrored around a centre line (as far above as below), the part before `position` in a colour and the rest grey. Roon makes one for a local file when it has analysed it, and for a stream (Qobuz, TIDAL) the first time it plays; until then `waveform` is null. Only for what plays now, not for any track.",
50684
+ inputSchema: {
50685
+ zone: external_exports.string().min(1).describe("The zone, by (part of) its name."),
50686
+ points: external_exports.number().int().min(10).max(2e3).optional().describe("How many heights (default 100)."),
50687
+ raw: external_exports.boolean().optional().describe("The values as the Core sends them, for debugging.")
50688
+ },
50689
+ annotations: READ
50690
+ }, ({ zone: zone3, points, raw }) => run(() => waveform(zone3, points ?? 100, raw === true)));
50601
50691
  reg("roon_now_playing", {
50602
50692
  title: "Now playing in Roon",
50603
50693
  description: "What plays in Roon, per zone: state (playing, loading, paused, stopped), the track with album, artist and format, the position, how many tracks are left in the queue, shuffle, repeat, Roon Radio and a sleep timer. Read this before saying anything about what Roon plays \u2014 it changes all the time.",
@@ -51611,6 +51701,9 @@ var FOCUS = {
51611
51701
  bits: external_exports.string().optional().describe('Bit depths, comma-separated: "16, 24".'),
51612
51702
  mqa: external_exports.boolean().optional(),
51613
51703
  storage: external_exports.enum(["tidal", "qobuz", "local"]).optional().describe("Where the albums live."),
51704
+ album_type: external_exports.string().optional().describe("Roon's album type, comma-separated: main, single, ep, compilation, soundtrack, show, other."),
51705
+ exclude_album_type: external_exports.string().optional().describe('Album types to leave out, e.g. "single, ep".'),
51706
+ bootleg: external_exports.boolean().optional(),
51614
51707
  played_within_days: days,
51615
51708
  not_played_within_days: days,
51616
51709
  added_within_days: days
@@ -51619,13 +51712,13 @@ var filters = /* @__PURE__ */ __name((a) => ({ ...a }), "filters");
51619
51712
  function registerLibraryTools(server) {
51620
51713
  server.registerTool("roon_library", {
51621
51714
  title: "Library (Focus)",
51622
- description: 'The user\'s Roon LIBRARY \u2014 the albums they own or added \u2014 filtered and sorted with Roon\'s Focus. Filters combine freely: `min_stars` (Roon\'s editorial album rating; 5 = only five-star albums \u2014 THE tool for "five-star albums in my library"), `genre`, `label`, `artist`, `composer`, `producer`, `year_from` / `year_to`, `hires`, `live`, `compilation`, `picks`, `text`, `favorites`, `played_within_days` / `not_played_within_days` / `added_within_days`. `sort`: artist (default), added, released, most_played, title, popular, random \u2014 `random` is the way to "pick something from my library"; `ascending` flips a sort. `total` counts all matches; `offset` pages. Rows carry stars, year, format and a `key` for roon_play / roon_album. `matched` says which artist, composer or producer a name became.',
51715
+ description: 'The user\'s Roon LIBRARY \u2014 the albums they own or added \u2014 filtered and sorted with Roon\'s Focus. Filters combine freely: `min_stars` (Roon\'s editorial album rating; 5 = only five-star albums \u2014 THE tool for "five-star albums in my library"), `genre`, `label`, `artist`, `composer`, `producer`, `year_from` / `year_to`, `hires`, `live`, `compilation`, `picks`, `album_type` / `exclude_album_type` (main, single, ep, compilation, soundtrack, show), `bootleg`, `text`, `favorites`, `played_within_days` / `not_played_within_days` / `added_within_days`. `sort`: artist (default), added, released, most_played, title, popular, random \u2014 `random` is the way to "pick something from my library"; `ascending` flips a sort. `total` counts all matches; `offset` pages. Rows carry stars, year, format and a `key` for roon_play / roon_album. `matched` says which artist, composer or producer a name became.',
51623
51716
  inputSchema: { ...FOCUS, sort: external_exports.enum(["artist", "added", "released", "most_played", "title", "popular", "random"]).optional(), ascending: external_exports.boolean().optional(), limit: limit2(100, 50), offset },
51624
51717
  annotations: READ2
51625
51718
  }, ({ sort, ascending, limit: n, offset: o, ...f }) => run(() => library2(filters(f), sort, ascending, n ?? 50, o ?? 0)));
51626
51719
  server.registerTool("roon_focus", {
51627
51720
  title: "Focus panel",
51628
- description: 'Roon\'s Focus panel: what the library \u2014 or a filtered part of it \u2014 is MADE OF, with counts: genres and sub-genres, labels, artists, composers, producers, decades, star ratings, sample rates and bit depths, live albums, compilations, Roon\'s picks. Same filters as roon_library ("what labels are my five-star albums on", "which decades is my ECM collection from"). Use it for questions ABOUT the library and to find exact genre or label names for roon_library. The panel shows the top twenty of each list; `more` (labels, artists, composers, producers, genres) returns one list in full, optionally narrowed by `search`.',
51721
+ description: 'Roon\'s Focus panel: what the library \u2014 or a filtered part of it \u2014 is MADE OF, with counts: genres and sub-genres, labels, artists, composers, producers, decades, star ratings, sample rates and bit depths, live albums, compilations, album types (main release, single, EP, soundtrack \u2026), Roon\'s picks. Same filters as roon_library ("what labels are my five-star albums on", "which decades is my ECM collection from"). Use it for questions ABOUT the library and to find exact genre or label names for roon_library. The panel shows the top twenty of each list; `more` (labels, artists, composers, producers, genres) returns one list in full, optionally narrowed by `search`.',
51629
51722
  inputSchema: { ...FOCUS, more: external_exports.enum(["labels", "artists", "composers", "producers", "genres"]).optional(), search: external_exports.string().optional().describe("With `more`: only names containing this."), limit: limit2(200, 40) },
51630
51723
  annotations: READ2
51631
51724
  }, ({ more: m, search: search2, limit: n, ...f }) => run(() => focus(filters(f), m, search2, n ?? 40)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deep-roon-mcp",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
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>",