deep-roon-mcp 0.5.1 → 0.5.3

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.
@@ -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.1";
15541
+ version2 = "0.5.3";
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);
@@ -49497,7 +49517,7 @@ init_library();
49497
49517
  var PAGE = 500;
49498
49518
  var BUDGET_MS = 45e3;
49499
49519
  var at = /* @__PURE__ */ __name((e) => Date.parse(e.playedAt), "at");
49500
- async function history(limit3, offset2 = 0, before) {
49520
+ async function history(limit3, offset2 = 0, before, since) {
49501
49521
  return withCore(async (first) => {
49502
49522
  const c = first.graph.findByType("HistoryPlay").length > 0 ? await fresh() : first;
49503
49523
  const n = Math.min(Math.max(0, limit3), 500), skip = Math.max(0, offset2);
@@ -49507,7 +49527,8 @@ async function history(limit3, offset2 = 0, before) {
49507
49527
  pageSize: PAGE,
49508
49528
  timeoutMs: 15e3,
49509
49529
  deadline: Date.now() + BUDGET_MS,
49510
- maxDate: cutoff === null ? void 0 : new Date(cutoff)
49530
+ maxDate: cutoff === null ? void 0 : new Date(cutoff),
49531
+ minDate: since ? new Date(Date.parse(since)) : void 0
49511
49532
  });
49512
49533
  const picked = (cutoff === null ? all.events : all.events.filter((e) => at(e) < cutoff)).slice(skip, skip + n);
49513
49534
  const out = { ...all, events: picked };
@@ -49539,7 +49560,7 @@ async function history(limit3, offset2 = 0, before) {
49539
49560
  });
49540
49561
  }
49541
49562
  __name(history, "history");
49542
- async function top(what, limit3, since) {
49563
+ async function top(what, limit3, since, until) {
49543
49564
  return withCore(async (first) => {
49544
49565
  const c = first.graph.findByType("HistoryPlay").length > 0 ? await fresh() : first;
49545
49566
  const from = since ? Date.parse(since) : null;
@@ -49548,7 +49569,8 @@ async function top(what, limit3, since) {
49548
49569
  pageSize: PAGE,
49549
49570
  timeoutMs: 15e3,
49550
49571
  deadline: Date.now() + BUDGET_MS,
49551
- minDate: from === null ? void 0 : new Date(from)
49572
+ minDate: from === null ? void 0 : new Date(from),
49573
+ maxDate: until ? new Date(Date.parse(until)) : void 0
49552
49574
  });
49553
49575
  closeSoon("after the history");
49554
49576
  const count = /* @__PURE__ */ new Map();
@@ -50610,16 +50632,26 @@ function registerReadTools(server, internal = true) {
50610
50632
  }, ({ category, genre, limit: n }) => run(() => radio(category, genre, n ?? 40)));
50611
50633
  reg("roon_history", {
50612
50634
  title: "Play history",
50613
- description: 'What was played in Roon, newest first \u2014 Roon\'s own play history, with how much of each track was heard. Goes back as far as Roon\'s history does: `before` (YYYY-MM-DD) gives the plays before that date (e.g. "what did I play in March 2019": before 2019-04-01), `offset` skips the newest ones. For "most played" questions use roon_top instead of counting this.',
50614
- inputSchema: { limit: limit(300, 30), offset: external_exports.number().int().min(0).optional(), before: external_exports.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional().describe("Only plays before this date (YYYY-MM-DD).") },
50635
+ description: 'What was played in Roon, newest first \u2014 Roon\'s own play history, with how much of each track was heard. Goes back as far as Roon\'s history does \u2014 Roon filters by date itself: `since` and `before` (YYYY-MM-DD) give the plays in that window (e.g. "what did I play in March 2019": since 2019-03-01, before 2019-04-01; up to 500 per call, `offset` for the next ones). For "most played" questions use roon_top instead of counting this.',
50636
+ inputSchema: {
50637
+ limit: limit(500, 30),
50638
+ offset: external_exports.number().int().min(0).optional(),
50639
+ since: external_exports.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional().describe("Only plays from this date on (YYYY-MM-DD)."),
50640
+ before: external_exports.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional().describe("Only plays before this date (YYYY-MM-DD).")
50641
+ },
50615
50642
  annotations: READ
50616
- }, ({ limit: n, offset: offset2, before }) => run(() => history(n ?? 30, offset2 ?? 0, before)));
50643
+ }, ({ limit: n, offset: offset2, since, before }) => run(() => history(n ?? 30, offset2 ?? 0, before, since)));
50617
50644
  reg("roon_top", {
50618
50645
  title: "Most played",
50619
- 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` (YYYY-MM-DD) limits the period.',
50620
- inputSchema: { what: external_exports.enum(["albums", "artists", "tracks"]).optional(), limit: limit(100, 20), since: external_exports.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional().describe("Only plays from this date on (YYYY-MM-DD).") },
50646
+ 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
+ inputSchema: {
50648
+ what: external_exports.enum(["albums", "artists", "tracks"]).optional(),
50649
+ limit: limit(100, 20),
50650
+ since: external_exports.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional().describe("Only plays from this date on (YYYY-MM-DD)."),
50651
+ until: external_exports.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional().describe("Only plays before this date (YYYY-MM-DD).")
50652
+ },
50621
50653
  annotations: READ
50622
- }, ({ what, limit: n, since }) => run(() => top(what ?? "albums", n ?? 20, since)));
50654
+ }, ({ what, limit: n, since, until }) => run(() => top(what ?? "albums", n ?? 20, since, until)));
50623
50655
  }
50624
50656
  __name(registerReadTools, "registerReadTools");
50625
50657
 
@@ -51599,6 +51631,9 @@ var FOCUS = {
51599
51631
  bits: external_exports.string().optional().describe('Bit depths, comma-separated: "16, 24".'),
51600
51632
  mqa: external_exports.boolean().optional(),
51601
51633
  storage: external_exports.enum(["tidal", "qobuz", "local"]).optional().describe("Where the albums live."),
51634
+ album_type: external_exports.string().optional().describe("Roon's album type, comma-separated: main, single, ep, compilation, soundtrack, show, other."),
51635
+ exclude_album_type: external_exports.string().optional().describe('Album types to leave out, e.g. "single, ep".'),
51636
+ bootleg: external_exports.boolean().optional(),
51602
51637
  played_within_days: days,
51603
51638
  not_played_within_days: days,
51604
51639
  added_within_days: days
@@ -51607,13 +51642,13 @@ var filters = /* @__PURE__ */ __name((a) => ({ ...a }), "filters");
51607
51642
  function registerLibraryTools(server) {
51608
51643
  server.registerTool("roon_library", {
51609
51644
  title: "Library (Focus)",
51610
- 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.',
51645
+ 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.',
51611
51646
  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 },
51612
51647
  annotations: READ2
51613
51648
  }, ({ sort, ascending, limit: n, offset: o, ...f }) => run(() => library2(filters(f), sort, ascending, n ?? 50, o ?? 0)));
51614
51649
  server.registerTool("roon_focus", {
51615
51650
  title: "Focus panel",
51616
- 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`.',
51651
+ 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`.',
51617
51652
  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) },
51618
51653
  annotations: READ2
51619
51654
  }, ({ 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.1",
3
+ "version": "0.5.3",
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>",