deep-roon-mcp 0.5.3 → 0.5.5

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 |
@@ -9246,7 +9246,7 @@ function parseAlbumEditInfo(decoded4) {
9246
9246
  raw: decoded4
9247
9247
  };
9248
9248
  }
9249
- var ROOT_SERVICE_GUID, RoonClient, ALBUM_EDIT, EDIT_OPTIONAL_VAL_INT, EDIT_REQUIRED_REF_STR, EDIT_LIST_STR, LIBRARY_EDIT;
9249
+ var ROOT_SERVICE_GUID, RoonClient;
9250
9250
  var init_client = __esm({
9251
9251
  "src/intern/proto/client.ts"() {
9252
9252
  "use strict";
@@ -9720,97 +9720,16 @@ var init_client = __esm({
9720
9720
  const decoded4 = this.graph.decodeReturnValue(Uint8Array.from(res.payload));
9721
9721
  return parseAlbumEditInfo(decoded4);
9722
9722
  }
9723
- // --- metadata editing: write side (Phase E) ---
9724
- /**
9725
- * Edit an album's metadata via Library::Edit. **Proven live & reversible** for
9726
- * title, rating, genres and labels (set then call again with the prior values to
9727
- * restore). `albumId` is the AlbumLite::AlbumId long (see albumIdOf), NOT the oid.
9728
- *
9729
- * Encoding (validated against the live core): a LibraryEdit by-value struct whose
9730
- * Albums is an IList<AlbumEdit> (LengthPrefixed: int(len)+flexInt(count)+items);
9731
- * each AlbumEdit member uses a nested Edit*<T> wrapper (EditRequiredRef<string>
9732
- * for Title, EditOptionalVal<int> for Rating, EditList<string> for Genres/Labels).
9733
- *
9734
- * NOTE: boolean flags (IsPick/IsUserHidden/IsCompilation/…) are intentionally not
9735
- * supported — the core does not respond to EditOptionalVal<bool> edits (the apply
9736
- * hangs server-side; the encoding is correct). Genres/labels must be values Roon
9737
- * recognises; unknown strings return Success but are silently dropped.
9738
- */
9739
- editAlbum(albumId, edits) {
9740
- const fields = [];
9741
- if (edits.title !== void 0) {
9742
- const w = this.structArg(EDIT_REQUIRED_REF_STR, [
9743
- { name: `string ${EDIT_REQUIRED_REF_STR}::EditValue`, propType: 20 /* String */, value: new BinaryWriter().string(edits.title).toBuffer() }
9744
- ]);
9745
- fields.push({ name: `${EDIT_REQUIRED_REF_STR} ${ALBUM_EDIT}::Title`, propType: 23 /* Object */, value: w });
9746
- }
9747
- if (edits.rating !== void 0) {
9748
- const w = this.structArg(EDIT_OPTIONAL_VAL_INT, [
9749
- { name: `int? ${EDIT_OPTIONAL_VAL_INT}::EditValue`, propType: 10 /* NullableInt */, value: new BinaryWriter().boolean(true).integer(edits.rating).toBuffer() }
9750
- ]);
9751
- fields.push({ name: `${EDIT_OPTIONAL_VAL_INT} ${ALBUM_EDIT}::Rating`, propType: 23 /* Object */, value: w });
9752
- }
9753
- if (edits.addGenres || edits.removeGenres) {
9754
- fields.push({ name: `${EDIT_LIST_STR} ${ALBUM_EDIT}::Genres`, propType: 23 /* Object */, value: this.editListStr(edits.addGenres ?? [], edits.removeGenres ?? []) });
9755
- }
9756
- if (edits.addLabels || edits.removeLabels) {
9757
- fields.push({ name: `${EDIT_LIST_STR} ${ALBUM_EDIT}::Labels`, propType: 23 /* Object */, value: this.editListStr(edits.addLabels ?? [], edits.removeLabels ?? []) });
9758
- }
9759
- if (!fields.length) throw new Error("editAlbum: no edits supplied");
9760
- return this.editAlbumStruct(albumId, fields);
9761
- }
9762
- /** Convenience: set just an album's rating (see editAlbum). */
9763
- editAlbumRating(albumId, rating) {
9764
- return this.editAlbum(albumId, { rating });
9765
- }
9766
- /** AlbumLite::AlbumId (the long id Library::Edit keys on). */
9723
+ // Geen schrijfkant voor albumgegevens (René, 26 okt 2026): editAlbum (titel, waardering, genres, labels via
9724
+ // Library::Edit) is eruit — er hing geen tool aan, en wat er niet in staat kan ook niet per ongeluk aangesloten worden.
9725
+ /** AlbumLite::AlbumId (the long id favoriteAlbum keys on). */
9767
9726
  albumIdOf(album2) {
9768
9727
  for (const [k, v] of Object.entries(album2.fields)) {
9769
9728
  if (k.endsWith("::AlbumId")) return typeof v === "bigint" ? v : BigInt(String(v));
9770
9729
  }
9771
9730
  return void 0;
9772
9731
  }
9773
- /** Build an EditList<string> wrapper value (AddValues/RemoveValues). */
9774
- editListStr(add, remove) {
9775
- const list = /* @__PURE__ */ __name((xs) => {
9776
- const w = new BinaryWriter().flexInt(xs.length);
9777
- for (const x of xs) w.string(x);
9778
- const b = w.toBuffer();
9779
- return new BinaryWriter().integer(b.length).bytes(b).toBuffer();
9780
- }, "list");
9781
- return this.structArg(EDIT_LIST_STR, [
9782
- { name: `System.Collections.Generic.IList<string> ${EDIT_LIST_STR}::AddValues`, propType: 24 /* LengthPrefixed */, value: list(add) },
9783
- { name: `System.Collections.Generic.IList<string> ${EDIT_LIST_STR}::RemoveValues`, propType: 24 /* LengthPrefixed */, value: list(remove) }
9784
- ]);
9785
- }
9786
- /** Build + send a single-album Library::Edit from pre-serialized AlbumEdit member fields. */
9787
- editAlbumStruct(albumId, fields) {
9788
- const albumEdit = this.structArg(ALBUM_EDIT, [
9789
- { name: `long ${ALBUM_EDIT}::AlbumId`, propType: 1 /* Long */, value: new BinaryWriter().long(albumId).toBuffer() },
9790
- ...fields
9791
- ]);
9792
- const blob = new BinaryWriter().flexInt(1).bytes(albumEdit).toBuffer();
9793
- const libraryEdit = this.structArg(LIBRARY_EDIT, [
9794
- {
9795
- name: `System.Collections.Generic.IList<${ALBUM_EDIT}> ${LIBRARY_EDIT}::Albums`,
9796
- propType: 24 /* LengthPrefixed */,
9797
- value: new BinaryWriter().integer(blob.length).bytes(blob).toBuffer()
9798
- }
9799
- ]);
9800
- return this.call(
9801
- "Library",
9802
- "Edit",
9803
- [{ type: "LibraryEdit", name: "edit" }, { type: "ResultCallback", name: "cb" }],
9804
- libraryEdit,
9805
- this.serviceOid("Library")
9806
- );
9807
- }
9808
9732
  };
9809
- ALBUM_EDIT = "Sooloos.Broker.Api.AlbumEdit";
9810
- EDIT_OPTIONAL_VAL_INT = "Sooloos.Broker.Api.EditOptionalVal<int>";
9811
- EDIT_REQUIRED_REF_STR = "Sooloos.Broker.Api.EditRequiredRef<string>";
9812
- EDIT_LIST_STR = "Sooloos.Broker.Api.EditList<string>";
9813
- LIBRARY_EDIT = "Sooloos.Broker.Api.LibraryEdit";
9814
9733
  __name(member, "member");
9815
9734
  __name(decodeStringList, "decodeStringList");
9816
9735
  __name(editField, "editField");
@@ -15538,7 +15457,7 @@ var require_lib2 = __commonJS({
15538
15457
  var version2;
15539
15458
  var init_package = __esm({
15540
15459
  "package.json"() {
15541
- version2 = "0.5.3";
15460
+ version2 = "0.5.5";
15542
15461
  }
15543
15462
  });
15544
15463
 
@@ -49723,6 +49642,66 @@ async function nowPlaying() {
49723
49642
  });
49724
49643
  }
49725
49644
  __name(nowPlaying, "nowPlaying");
49645
+ function ints(c, v) {
49646
+ const o = obj(c, v);
49647
+ const list = o?.fields?.$items ?? o?.$items ?? (Array.isArray(o) ? o : null);
49648
+ if (Array.isArray(list)) return list.map(Number).filter((n) => Number.isFinite(n));
49649
+ return null;
49650
+ }
49651
+ __name(ints, "ints");
49652
+ var lastWave = /* @__PURE__ */ new Map();
49653
+ async function waveform(zone3, points = 100, raw = false) {
49654
+ return withCore(async (c) => {
49655
+ const zn = findZone(c, zone3);
49656
+ const z2 = c.graph.getObject(zn.oid);
49657
+ const v = field2(z2, "WaveformData");
49658
+ const vals = ints(c, v);
49659
+ const np = obj(c, field2(z2, "NowPlaying"));
49660
+ const tr = obj(c, field2(items(c, field2(np, "Tracks"))[0], "Track"));
49661
+ const r = { zone: zn.name };
49662
+ if (field2(tr, "Title")) r.title = field2(tr, "Title");
49663
+ if (raw) {
49664
+ r.shape = v === void 0 ? "absent" : isRef2(v) ? "ref" : Buffer.isBuffer(v) ? `buffer ${v.length}` : typeof v;
49665
+ if (Buffer.isBuffer(v)) r.bytes = [...v.subarray(0, 64)];
49666
+ if (isRef2(v)) r.object = Object.keys(obj(c, v)?.fields ?? {});
49667
+ if (vals) {
49668
+ r.count = vals.length;
49669
+ r.values = vals;
49670
+ }
49671
+ return r;
49672
+ }
49673
+ 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.";
49674
+ if (!vals?.length) {
49675
+ r.waveform = null;
49676
+ r.note = none;
49677
+ return r;
49678
+ }
49679
+ const track = String(field2(tr, "TrackId") ?? field2(tr, "Title") ?? ""), sig = vals.join(","), was = lastWave.get(String(zn.oid));
49680
+ if (was && was.track !== track && was.sig === sig) {
49681
+ r.waveform = null;
49682
+ r.note = none;
49683
+ return r;
49684
+ }
49685
+ lastWave.set(String(zn.oid), { track, sig });
49686
+ const steps = Array.from({ length: Math.floor(vals.length / 2) }, (_, i) => Math.max(vals[2 * i], vals[2 * i + 1]));
49687
+ const n = Math.max(1, Math.min(points, steps.length)), per = steps.length / n;
49688
+ r.points = n;
49689
+ r.waveform = Array.from({ length: n }, (_, i) => {
49690
+ let som = 0, k = 0;
49691
+ for (let j = Math.floor(i * per); j < Math.max(Math.floor((i + 1) * per), Math.floor(i * per) + 1); j++) {
49692
+ som += steps[j];
49693
+ k++;
49694
+ }
49695
+ return Math.round(som / k / 255 * 100) / 100;
49696
+ });
49697
+ const pos = field2(z2, "SeekPosition");
49698
+ if (typeof pos === "number") r.position = duration3(pos);
49699
+ const l = field2(tr, "LengthSeconds");
49700
+ if (typeof l === "number") r.length = duration3(l);
49701
+ return r;
49702
+ });
49703
+ }
49704
+ __name(waveform, "waveform");
49726
49705
 
49727
49706
  // src/roon/radio.ts
49728
49707
  init_intern();
@@ -50618,6 +50597,16 @@ function registerReadTools(server, internal = true) {
50618
50597
  inputSchema: {},
50619
50598
  annotations: READ
50620
50599
  }, () => run(() => internal ? zones2() : zones3()));
50600
+ reg("roon_waveform", {
50601
+ title: "Waveform",
50602
+ 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.",
50603
+ inputSchema: {
50604
+ zone: external_exports.string().min(1).describe("The zone, by (part of) its name."),
50605
+ points: external_exports.number().int().min(10).max(2e3).optional().describe("How many heights (default 100)."),
50606
+ raw: external_exports.boolean().optional().describe("The values as the Core sends them, for debugging.")
50607
+ },
50608
+ annotations: READ
50609
+ }, ({ zone: zone3, points, raw }) => run(() => waveform(zone3, points ?? 100, raw === true)));
50621
50610
  reg("roon_now_playing", {
50622
50611
  title: "Now playing in Roon",
50623
50612
  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.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deep-roon-mcp",
3
- "version": "0.5.3",
3
+ "version": "0.5.5",
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>",