deep-roon-mcp 0.5.11 → 0.5.12
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 +8 -4
- package/dist/deep-roon-mcp.js +223 -30
- package/package.json +1 -1
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-
|
|
25
|
+
Version 0.5: sixty-eight tools (sixty with a read-only library; seventy-two 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
|
|
|
@@ -57,6 +57,8 @@ Version 0.5: sixty-four tools (fifty-eight with a read-only library; sixty-eight
|
|
|
57
57
|
| `roon_tidal_playlists` | TIDAL's playlists: its editorial shelves, by genre or mood, and your own TIDAL mixes |
|
|
58
58
|
| `roon_favorites` | Albums with a heart in Roon, or your Qobuz or TIDAL favourites |
|
|
59
59
|
| `roon_listen_later` | Your Listen Later list |
|
|
60
|
+
| `roon_tags` | Your tags: name, key, smart or not |
|
|
61
|
+
| `roon_album_tags` | The tags of one album |
|
|
60
62
|
| `roon_versions` | Other versions of an album: remasters, hi-res, in your library and streaming |
|
|
61
63
|
| `roon_similar` | More like this, for an album or an artist |
|
|
62
64
|
| `roon_signal_path` | Roon's signal path for what plays: is it bit-perfect, what happens on the way |
|
|
@@ -87,11 +89,11 @@ Version 0.5: sixty-four tools (fifty-eight with a read-only library; sixty-eight
|
|
|
87
89
|
|
|
88
90
|
**Changing your library or sound** — only on your request; each one reads the result back and says if Roon didn't follow.
|
|
89
91
|
|
|
90
|
-
> **A word of care.** These
|
|
92
|
+
> **A word of care.** These eight tools write into your Core's library and settings through Roon's *internal* protocol —
|
|
91
93
|
> the same wiring Roon's own apps use, but not an API Roon Labs supports for others. Deep Roon is careful with it (one
|
|
92
|
-
> change at a time, read back,
|
|
94
|
+
> change at a time, read back; only tagging takes a list of albums, and asks for `confirm`), but a Roon update can change that wiring under it. **Keep a recent backup
|
|
93
95
|
> of your Roon database** (Roon › Settings › Backups) before you let an assistant change things — and if you only want to
|
|
94
|
-
> ask and listen, switch on **Read-only library** below: then these
|
|
96
|
+
> ask and listen, switch on **Read-only library** below: then these eight tools aren't there at all.
|
|
95
97
|
|
|
96
98
|
|
|
97
99
|
| Tool | What it does |
|
|
@@ -99,6 +101,8 @@ Version 0.5: sixty-four tools (fifty-eight with a read-only library; sixty-eight
|
|
|
99
101
|
| `roon_favorite` | A heart on an album or track, or off |
|
|
100
102
|
| `roon_listen_later_set` | On or off the Listen Later list |
|
|
101
103
|
| `roon_library_add` | A Qobuz or TIDAL album into your library |
|
|
104
|
+
| `roon_tag_albums` | Albums into a tag (or out of it); `create` makes the tag — you see the list first, then `confirm` |
|
|
105
|
+
| `roon_tag_delete` | A tag away (its albums stay), with `confirm` |
|
|
102
106
|
| `roon_playlist_create` | A new playlist from tracks |
|
|
103
107
|
| `roon_dsp_set` | MUSE on or off, one part on or off, or a preset |
|
|
104
108
|
| `roon_radio_favorite` | A station into My Live Radio, or out of it |
|
package/dist/deep-roon-mcp.js
CHANGED
|
@@ -5407,8 +5407,8 @@ var require_multipleOf = __commonJS({
|
|
|
5407
5407
|
const { gen, data, schemaCode, it } = cxt;
|
|
5408
5408
|
const prec = it.opts.multipleOfPrecision;
|
|
5409
5409
|
const res = gen.let("res");
|
|
5410
|
-
const
|
|
5411
|
-
cxt.fail$data((0, codegen_1._)`(${schemaCode} === 0 || (${res} = ${data}/${schemaCode}, ${
|
|
5410
|
+
const invalid3 = prec ? (0, codegen_1._)`Math.abs(Math.round(${res}) - ${res}) > 1e-${prec}` : (0, codegen_1._)`${res} !== parseInt(${res})`;
|
|
5411
|
+
cxt.fail$data((0, codegen_1._)`(${schemaCode} === 0 || (${res} = ${data}/${schemaCode}, ${invalid3}))`);
|
|
5412
5412
|
}
|
|
5413
5413
|
};
|
|
5414
5414
|
exports2.default = def;
|
|
@@ -15489,7 +15489,7 @@ var require_lib2 = __commonJS({
|
|
|
15489
15489
|
var version2;
|
|
15490
15490
|
var init_package = __esm({
|
|
15491
15491
|
"package.json"() {
|
|
15492
|
-
version2 = "0.5.
|
|
15492
|
+
version2 = "0.5.12";
|
|
15493
15493
|
}
|
|
15494
15494
|
});
|
|
15495
15495
|
|
|
@@ -16574,20 +16574,20 @@ async function trackFiles(a) {
|
|
|
16574
16574
|
const paden = /* @__PURE__ */ __name((x) => items(c, field2(x, "DuplicateTracks")).map((d) => field2(d, "FilePath")).filter((p) => typeof p === "string" && !!p), "paden");
|
|
16575
16575
|
const tracks2 = infos.map((x) => {
|
|
16576
16576
|
const t = obj(c, field2(x, "Track"));
|
|
16577
|
-
const
|
|
16577
|
+
const row2 = { key: String(field2(t, "TrackId") ?? "") };
|
|
16578
16578
|
const title = field2(t, "Title");
|
|
16579
|
-
if (title)
|
|
16579
|
+
if (title) row2.title = title;
|
|
16580
16580
|
const al = field2(obj(c, field2(t, "Album")), "Title");
|
|
16581
|
-
if (al)
|
|
16581
|
+
if (al) row2.album = al;
|
|
16582
16582
|
const n2 = field2(t, "TrackNumber");
|
|
16583
|
-
if (n2 != null)
|
|
16583
|
+
if (n2 != null) row2.n = n2;
|
|
16584
16584
|
const path2 = field2(x, "FilePath");
|
|
16585
|
-
if (typeof path2 === "string" && path2)
|
|
16585
|
+
if (typeof path2 === "string" && path2) row2.path = path2;
|
|
16586
16586
|
const format = field2(t, "Format");
|
|
16587
|
-
if (format)
|
|
16587
|
+
if (format) row2.format = format;
|
|
16588
16588
|
const dup = paden(x);
|
|
16589
|
-
if (dup.length)
|
|
16590
|
-
return
|
|
16589
|
+
if (dup.length) row2.duplicates = dup;
|
|
16590
|
+
return row2;
|
|
16591
16591
|
});
|
|
16592
16592
|
const gevraagd = a.tracks?.length ?? 0, ontbreekt = gevraagd ? gevraagd - tracks2.length : 0;
|
|
16593
16593
|
const zonder = tracks2.filter((t) => !t.path).length + Math.max(0, ontbreekt);
|
|
@@ -16671,7 +16671,7 @@ function albumTypeOf(x) {
|
|
|
16671
16671
|
const alias = { mainrelease: "main", album: "main", extendedplay: "ep", ost: "soundtrack" };
|
|
16672
16672
|
return ALBUM_TYPES.indexOf(alias[k] ?? k);
|
|
16673
16673
|
}
|
|
16674
|
-
async function virtualQuery(c, kind, members2, limit3, offset2,
|
|
16674
|
+
async function virtualQuery(c, kind, members2, limit3, offset2, row2) {
|
|
16675
16675
|
const schema = structSchema(`Sooloos.Broker.Api.${kind}QueryCriteria`) ?? [];
|
|
16676
16676
|
const missing = members2.find((f) => !schema.some((m) => m.shortName === f.name));
|
|
16677
16677
|
if (missing) throw new RoonError(`The filter ${missing.name} doesn't exist for ${kind.toLowerCase()}s in this Roon version`, "invalid");
|
|
@@ -16704,7 +16704,7 @@ async function virtualQuery(c, kind, members2, limit3, offset2, row) {
|
|
|
16704
16704
|
if (found.length >= expected && found.every(loaded)) break;
|
|
16705
16705
|
await wait(60);
|
|
16706
16706
|
}
|
|
16707
|
-
return { total, offset: page * size, rows: found.filter(loaded).map(
|
|
16707
|
+
return { total, offset: page * size, rows: found.filter(loaded).map(row2) };
|
|
16708
16708
|
} finally {
|
|
16709
16709
|
try {
|
|
16710
16710
|
c.remoting.callMethodNoReply(qoid, formatMethodSignature(type, "ReleasePage", pageParams), buildArgs([Arg.int(page)]));
|
|
@@ -51787,6 +51787,168 @@ async function deviceReset(opts) {
|
|
|
51787
51787
|
}
|
|
51788
51788
|
__name(deviceReset, "deviceReset");
|
|
51789
51789
|
|
|
51790
|
+
// src/roon/tags.ts
|
|
51791
|
+
init_intern();
|
|
51792
|
+
init_serializer();
|
|
51793
|
+
init_writer();
|
|
51794
|
+
init_session();
|
|
51795
|
+
init_graph();
|
|
51796
|
+
init_library();
|
|
51797
|
+
var invalid = /* @__PURE__ */ __name((s) => {
|
|
51798
|
+
throw new RoonError(s, "invalid");
|
|
51799
|
+
}, "invalid");
|
|
51800
|
+
var tagKey = /* @__PURE__ */ __name((t) => {
|
|
51801
|
+
const id = field2(t, "TagId");
|
|
51802
|
+
return Buffer.isBuffer(id) ? id.toString("hex") : String(id ?? "");
|
|
51803
|
+
}, "tagKey");
|
|
51804
|
+
var isExplicit = /* @__PURE__ */ __name((t) => /ExplicitTag(Lite)?$/.test(t?.typeName ?? ""), "isExplicit");
|
|
51805
|
+
var row = /* @__PURE__ */ __name((t) => ({
|
|
51806
|
+
key: tagKey(t),
|
|
51807
|
+
name: field2(t, "Name") ?? "",
|
|
51808
|
+
kind: isExplicit(t) ? "tag" : "smart tag",
|
|
51809
|
+
...typeof field2(t, "ItemCount") === "number" ? { items: field2(t, "ItemCount") } : {},
|
|
51810
|
+
...field2(t, "IsReadOnly") === true ? { read_only: true } : {}
|
|
51811
|
+
}), "row");
|
|
51812
|
+
var refList3 = /* @__PURE__ */ __name((oids) => {
|
|
51813
|
+
const w = new BinaryWriter().flexInt(oids.length);
|
|
51814
|
+
for (const x of oids) w.long(x);
|
|
51815
|
+
const b = w.toBuffer();
|
|
51816
|
+
return new BinaryWriter().integer(b.length).bytes(b).toBuffer();
|
|
51817
|
+
}, "refList");
|
|
51818
|
+
async function allTags(c) {
|
|
51819
|
+
const res = await c.call(
|
|
51820
|
+
"Library",
|
|
51821
|
+
"GetAllTagLites",
|
|
51822
|
+
[{ type: "Profile", name: "profile" }, { type: "ResultCallback<DataList<TagLite>>", name: "cb_result" }],
|
|
51823
|
+
buildArgs([Arg.ref(profileObject(c).oid)]),
|
|
51824
|
+
c.serviceOid("Library")
|
|
51825
|
+
);
|
|
51826
|
+
if (!res.success) throw new RoonError(`Roon refused the list of tags (${res.status})`);
|
|
51827
|
+
const list = items(c, decoded3(c, res.payload));
|
|
51828
|
+
await untilLoaded(c, list.map((t) => ({ $ref: t.oid })), 2500);
|
|
51829
|
+
return list;
|
|
51830
|
+
}
|
|
51831
|
+
__name(allTags, "allTags");
|
|
51832
|
+
async function tags() {
|
|
51833
|
+
return withCore(async (c) => {
|
|
51834
|
+
const all = await allTags(c);
|
|
51835
|
+
return { count: all.length, tags: all.map(row).sort((a, b) => String(a.name).localeCompare(String(b.name))) };
|
|
51836
|
+
});
|
|
51837
|
+
}
|
|
51838
|
+
__name(tags, "tags");
|
|
51839
|
+
async function tagsOfAlbum(c, al) {
|
|
51840
|
+
const v = field2(al, "Tags");
|
|
51841
|
+
const list = isRef2(v) ? items(c, v) : (v?.$items ?? []).map((x) => obj(c, x)).filter(Boolean);
|
|
51842
|
+
await untilLoaded(c, list.map((t) => ({ $ref: t.oid })), 1500);
|
|
51843
|
+
return list.map((t) => String(field2(t, "Name") ?? "")).filter(Boolean);
|
|
51844
|
+
}
|
|
51845
|
+
__name(tagsOfAlbum, "tagsOfAlbum");
|
|
51846
|
+
async function albumTags(key) {
|
|
51847
|
+
return withCore(async (c) => {
|
|
51848
|
+
const al = await findAlbum(c, key);
|
|
51849
|
+
return { key, title: field2(al, "Title"), tags: await tagsOfAlbum(c, al) };
|
|
51850
|
+
});
|
|
51851
|
+
}
|
|
51852
|
+
__name(albumTags, "albumTags");
|
|
51853
|
+
async function tagAlbums(name, keys, opts) {
|
|
51854
|
+
if (!opts.confirm) invalid("Tagging changes the library: pass confirm: true, after the user agreed to these albums and this tag.");
|
|
51855
|
+
const wanted2 = name.trim();
|
|
51856
|
+
if (!wanted2) invalid("A tag name, please.");
|
|
51857
|
+
const unique = [...new Set(keys.map((k) => k.trim()).filter(Boolean))];
|
|
51858
|
+
if (!unique.length) invalid("No album keys.");
|
|
51859
|
+
if (unique.length > 500) invalid("At most 500 albums at a time.");
|
|
51860
|
+
return withCore(async (c) => {
|
|
51861
|
+
const albums = [];
|
|
51862
|
+
for (const k of unique) albums.push(await findAlbum(c, k));
|
|
51863
|
+
const lib = c.serviceOid("Library");
|
|
51864
|
+
let all = await allTags(c);
|
|
51865
|
+
let tag = all.find((t) => String(field2(t, "Name") ?? "").toLowerCase() === wanted2.toLowerCase());
|
|
51866
|
+
let created = false;
|
|
51867
|
+
if (!tag) {
|
|
51868
|
+
if (opts.remove) invalid(`There is no tag called "${wanted2}".`);
|
|
51869
|
+
if (!opts.create) invalid(`There is no tag called "${wanted2}" yet \u2014 pass create: true to make it.`);
|
|
51870
|
+
const params = c.structArg("Sooloos.Broker.Api.CreateTagParameters", [
|
|
51871
|
+
{ name: "Name", propType: 20, value: new BinaryWriter().string(wanted2).toBuffer() },
|
|
51872
|
+
{ name: "Profile", propType: 23, value: new BinaryWriter().long(profileObject(c).oid).toBuffer() }
|
|
51873
|
+
]);
|
|
51874
|
+
const res2 = await c.call(
|
|
51875
|
+
"Library",
|
|
51876
|
+
"CreateTag",
|
|
51877
|
+
[{ type: "CreateTagParameters", name: "parameters" }, { type: "ResultCallback<CreateTagResult>", name: "cb_result" }],
|
|
51878
|
+
params,
|
|
51879
|
+
lib
|
|
51880
|
+
);
|
|
51881
|
+
if (!res2.success) throw new RoonError(`Roon refused to create the tag (${res2.status})`);
|
|
51882
|
+
for (let i = 0; i < 20 && !tag; i++) {
|
|
51883
|
+
await wait(150);
|
|
51884
|
+
all = await allTags(c);
|
|
51885
|
+
tag = all.find((t) => String(field2(t, "Name") ?? "").toLowerCase() === wanted2.toLowerCase());
|
|
51886
|
+
}
|
|
51887
|
+
if (!tag) throw new RoonError(`Roon said the tag was created, but "${wanted2}" isn't in the list`);
|
|
51888
|
+
created = true;
|
|
51889
|
+
}
|
|
51890
|
+
if (!isExplicit(tag)) invalid(`"${field2(tag, "Name")}" is a smart tag: Roon fills it from its rules, it can't be edited by hand.`);
|
|
51891
|
+
if (field2(tag, "IsReadOnly") === true) invalid(`"${field2(tag, "Name")}" is read-only.`);
|
|
51892
|
+
const explicit = c.structArg("Sooloos.Broker.Api.EditExplicitTagParameters", [
|
|
51893
|
+
{ name: opts.remove ? "RemoveAlbums" : "AddAlbums", propType: 23, value: refList3(albums.map((a) => a.oid)) }
|
|
51894
|
+
]);
|
|
51895
|
+
const edit = c.structArg("Sooloos.Broker.Api.EditTagParameters", [{ name: "EditExplicitTag", propType: 23, value: explicit }]);
|
|
51896
|
+
const res = await c.call(
|
|
51897
|
+
"Library",
|
|
51898
|
+
"EditTag",
|
|
51899
|
+
[{ type: "TagBase", name: "tag" }, { type: "EditTagParameters", name: "parameters" }, { type: "ResultCallback<EditTagResult>", name: "cb_result" }],
|
|
51900
|
+
Buffer.concat([buildArgs([Arg.ref(tag.oid)]), edit]),
|
|
51901
|
+
lib
|
|
51902
|
+
);
|
|
51903
|
+
if (!res.success) throw new RoonError(`Roon refused the change to "${field2(tag, "Name")}" (${res.status})`);
|
|
51904
|
+
await wait(500);
|
|
51905
|
+
const rows = [];
|
|
51906
|
+
let ok = 0;
|
|
51907
|
+
for (const a of albums) {
|
|
51908
|
+
const fresh2 = await findAlbum(c, String(field2(a, "AlbumId")));
|
|
51909
|
+
const has = (await tagsOfAlbum(c, fresh2)).some((n) => n.toLowerCase() === wanted2.toLowerCase());
|
|
51910
|
+
const good = opts.remove ? !has : has;
|
|
51911
|
+
if (good) ok++;
|
|
51912
|
+
rows.push({ key: String(field2(a, "AlbumId")), title: field2(a, "Title"), tagged: has });
|
|
51913
|
+
}
|
|
51914
|
+
return {
|
|
51915
|
+
tag: field2(tag, "Name"),
|
|
51916
|
+
created: created || void 0,
|
|
51917
|
+
action: opts.remove ? "removed" : "added",
|
|
51918
|
+
albums: unique.length,
|
|
51919
|
+
confirmed: ok,
|
|
51920
|
+
...ok < unique.length ? { note: `Roon said ok; ${unique.length - ok} album(s) didn't read back as ${opts.remove ? "untagged" : "tagged"}` } : {},
|
|
51921
|
+
rows
|
|
51922
|
+
};
|
|
51923
|
+
});
|
|
51924
|
+
}
|
|
51925
|
+
__name(tagAlbums, "tagAlbums");
|
|
51926
|
+
async function deleteTag(name, confirm) {
|
|
51927
|
+
if (!confirm) invalid("Deleting a tag can't be undone: pass confirm: true, after the user agreed.");
|
|
51928
|
+
const wanted2 = name.trim();
|
|
51929
|
+
if (!wanted2) invalid("A tag name, please.");
|
|
51930
|
+
return withCore(async (c) => {
|
|
51931
|
+
const tag = (await allTags(c)).find((t) => String(field2(t, "Name") ?? "").toLowerCase() === wanted2.toLowerCase());
|
|
51932
|
+
if (!tag) invalid(`There is no tag called "${wanted2}".`);
|
|
51933
|
+
if (field2(tag, "IsDeletable") === false || field2(tag, "IsReadOnly") === true) invalid(`Roon doesn't allow deleting "${field2(tag, "Name")}".`);
|
|
51934
|
+
const res = await c.call(
|
|
51935
|
+
"Library",
|
|
51936
|
+
"DeleteTag",
|
|
51937
|
+
[{ type: "TagBase", name: "tag" }, { type: "ResultCallback", name: "cb_result" }],
|
|
51938
|
+
buildArgs([Arg.ref(tag.oid)]),
|
|
51939
|
+
c.serviceOid("Library")
|
|
51940
|
+
);
|
|
51941
|
+
if (!res.success) throw new RoonError(`Roon refused to delete "${field2(tag, "Name")}" (${res.status})`);
|
|
51942
|
+
let gone = false;
|
|
51943
|
+
for (let i = 0; i < 10 && !gone; i++) {
|
|
51944
|
+
await wait(200);
|
|
51945
|
+
gone = !(await allTags(c)).some((t) => String(field2(t, "Name") ?? "").toLowerCase() === wanted2.toLowerCase());
|
|
51946
|
+
}
|
|
51947
|
+
return { tag: field2(tag, "Name"), deleted: gone, ...gone ? {} : { note: "Roon said ok, but the tag is still in the list" } };
|
|
51948
|
+
});
|
|
51949
|
+
}
|
|
51950
|
+
__name(deleteTag, "deleteTag");
|
|
51951
|
+
|
|
51790
51952
|
// src/tools/library.ts
|
|
51791
51953
|
init_session();
|
|
51792
51954
|
|
|
@@ -51814,7 +51976,7 @@ function writablePlaylist(c, p) {
|
|
|
51814
51976
|
return field2(p, "Type") === 5 && (ro === false || ro === void 0 && declaredBool);
|
|
51815
51977
|
}
|
|
51816
51978
|
__name(writablePlaylist, "writablePlaylist");
|
|
51817
|
-
var
|
|
51979
|
+
var invalid2 = /* @__PURE__ */ __name((s) => {
|
|
51818
51980
|
throw new RoonError(s, "invalid");
|
|
51819
51981
|
}, "invalid");
|
|
51820
51982
|
var trackKeyValid = /* @__PURE__ */ __name((key) => /^(0|[1-9]\d{0,19})$/.test(key) && BigInt(key) <= 0xffffffffffffffffn, "trackKeyValid");
|
|
@@ -51825,12 +51987,12 @@ function revisionOf(key, name, entries) {
|
|
|
51825
51987
|
__name(revisionOf, "revisionOf");
|
|
51826
51988
|
var playlistEditOn = /* @__PURE__ */ __name(() => ["1", "true", "on", "yes"].includes((process.env.DEEP_ROON_PLAYLIST_EDIT ?? "").trim().toLowerCase()), "playlistEditOn");
|
|
51827
51989
|
function enabled() {
|
|
51828
|
-
if (readOnlyMode() !== "off")
|
|
51829
|
-
if (!playlistEditOn())
|
|
51990
|
+
if (readOnlyMode() !== "off") invalid2("Playlist editing is disabled by DEEP_ROON_READ_ONLY.");
|
|
51991
|
+
if (!playlistEditOn()) invalid2("Playlist editing is experimental and disabled; see docs/playlist-editing.md.");
|
|
51830
51992
|
}
|
|
51831
51993
|
__name(enabled, "enabled");
|
|
51832
51994
|
async function snapshotOn(c, key, timeoutMs = 3e3) {
|
|
51833
|
-
if (!/^(?:[0-9a-f]{2})+$/i.test(key))
|
|
51995
|
+
if (!/^(?:[0-9a-f]{2})+$/i.test(key)) invalid2("Use the exact playlist key from roon_playlists.");
|
|
51834
51996
|
const service2 = c.graph.findByType("Playlists")[0];
|
|
51835
51997
|
if (!service2) throw new RoonError("No playlists service", "unavailable");
|
|
51836
51998
|
const got = await c.call("Playlists", "GetPlaylist", [{ type: "Sooid", name: "id" }, { type: "ResultCallback<Playlist>", name: "cb" }], buildArgs([Arg.sooid(Buffer.from(key, "hex"))]), service2.oid);
|
|
@@ -51893,29 +52055,29 @@ var publicSnapshot = /* @__PURE__ */ __name((s) => ({
|
|
|
51893
52055
|
}), "publicSnapshot");
|
|
51894
52056
|
var playlistSnapshot = /* @__PURE__ */ __name((key) => withCore(async (c) => publicSnapshot(await snapshotOn(c, key))), "playlistSnapshot");
|
|
51895
52057
|
function planEdit(s, edit) {
|
|
51896
|
-
if (edit.confirm !== true)
|
|
51897
|
-
if (!s.writable)
|
|
51898
|
-
if (s.key !== edit.key || s.revision !== edit.revision)
|
|
52058
|
+
if (edit.confirm !== true) invalid2("Explicit confirmation is required.");
|
|
52059
|
+
if (!s.writable) invalid2("Only writable native Roon playlists can be edited.");
|
|
52060
|
+
if (s.key !== edit.key || s.revision !== edit.revision) invalid2("Playlist changed since the snapshot; read a fresh snapshot and review the edit.");
|
|
51899
52061
|
let name = s.name;
|
|
51900
52062
|
let entries = s.entries.slice();
|
|
51901
52063
|
let selected = [];
|
|
51902
52064
|
if (edit.action === "rename") {
|
|
51903
|
-
if (!edit.name.trim() || edit.name.length > 500)
|
|
52065
|
+
if (!edit.name.trim() || edit.name.length > 500) invalid2("Choose a nonempty name of at most 500 characters.");
|
|
51904
52066
|
name = edit.name;
|
|
51905
52067
|
} else if (edit.action === "add") {
|
|
51906
|
-
if (!edit.keys.length || edit.keys.length > 200 || edit.keys.some((k) => !trackKeyValid(k)))
|
|
52068
|
+
if (!edit.keys.length || edit.keys.length > 200 || edit.keys.some((k) => !trackKeyValid(k))) invalid2("Provide 1\u2013200 valid track keys.");
|
|
51907
52069
|
const at2 = edit.before === void 0 ? entries.length : entries.findIndex((e) => e.id === edit.before);
|
|
51908
|
-
if (at2 < 0)
|
|
52070
|
+
if (at2 < 0) invalid2("Insertion anchor is no longer in the playlist.");
|
|
51909
52071
|
entries.splice(at2, 0, ...edit.keys.map((key) => ({ id: "", key })));
|
|
51910
52072
|
} else {
|
|
51911
|
-
if (!edit.items.length || edit.items.length > 200 || new Set(edit.items).size !== edit.items.length)
|
|
52073
|
+
if (!edit.items.length || edit.items.length > 200 || new Set(edit.items).size !== edit.items.length) invalid2("Provide 1\u2013200 distinct playlist item ids.");
|
|
51912
52074
|
selected = s.entries.filter((e) => edit.items.includes(e.id));
|
|
51913
|
-
if (selected.length !== edit.items.length)
|
|
52075
|
+
if (selected.length !== edit.items.length) invalid2("A selected item is no longer in the playlist.");
|
|
51914
52076
|
entries = entries.filter((e) => !edit.items.includes(e.id));
|
|
51915
52077
|
if (edit.action === "reorder") {
|
|
51916
|
-
if (edit.before !== void 0 && edit.items.includes(edit.before))
|
|
52078
|
+
if (edit.before !== void 0 && edit.items.includes(edit.before)) invalid2("The anchor cannot be one of the moved items.");
|
|
51917
52079
|
const at2 = edit.before === void 0 ? entries.length : entries.findIndex((e) => e.id === edit.before);
|
|
51918
|
-
if (at2 < 0)
|
|
52080
|
+
if (at2 < 0) invalid2("Move anchor is no longer in the playlist.");
|
|
51919
52081
|
entries.splice(at2, 0, ...selected);
|
|
51920
52082
|
}
|
|
51921
52083
|
}
|
|
@@ -51935,9 +52097,9 @@ async function executeEdit(io, edit, attempts = 12) {
|
|
|
51935
52097
|
const plan = planEdit(before, edit);
|
|
51936
52098
|
if (plan.noop) return { ok: true, verified: true, unchanged: true, ...publicSnapshot(before) };
|
|
51937
52099
|
if (edit.action === "add") await io.validateTracks(edit.keys);
|
|
51938
|
-
if (edit.action === "rename" && io.nameTaken && await io.nameTaken(plan.name, before.key))
|
|
52100
|
+
if (edit.action === "rename" && io.nameTaken && await io.nameTaken(plan.name, before.key)) invalid2(`Another playlist is already called "${plan.name}"; choose another name.`);
|
|
51939
52101
|
const checked = await io.read();
|
|
51940
|
-
if (checked.revision !== before.revision || !checked.writable)
|
|
52102
|
+
if (checked.revision !== before.revision || !checked.writable) invalid2("Playlist changed before the write; read a fresh snapshot.");
|
|
51941
52103
|
const finalPlan = planEdit(checked, edit);
|
|
51942
52104
|
let uncertain;
|
|
51943
52105
|
try {
|
|
@@ -52250,6 +52412,37 @@ function registerLibraryTools(server) {
|
|
|
52250
52412
|
inputSchema: { kind: external_exports.enum(["album", "track"]), key: external_exports.string(), on: external_exports.boolean().optional(), profile: profile2 },
|
|
52251
52413
|
annotations: CHANGES
|
|
52252
52414
|
}, ({ kind, key, on, profile: p }) => run(() => asProfile(p, () => listenLaterSet(kind, key, on !== false))));
|
|
52415
|
+
server.registerTool("roon_tags", {
|
|
52416
|
+
title: "Tags",
|
|
52417
|
+
description: "Roon's tags for the profile: name, `key`, how many items, and whether it is a `smart tag` (filled by Roon's rules, not editable). For \"which tags do I have\". The tags of one album: roon_album_tags.",
|
|
52418
|
+
inputSchema: { profile: profile2 },
|
|
52419
|
+
annotations: READ2
|
|
52420
|
+
}, ({ profile: p }) => run(() => asProfile(p, () => tags())));
|
|
52421
|
+
server.registerTool("roon_album_tags", {
|
|
52422
|
+
title: "Tags of an album",
|
|
52423
|
+
description: "The tags an album (by album `key`) carries in Roon.",
|
|
52424
|
+
inputSchema: { key: external_exports.string().describe("An album key."), profile: profile2 },
|
|
52425
|
+
annotations: READ2
|
|
52426
|
+
}, ({ key, profile: p }) => run(() => asProfile(p, () => albumTags(key))));
|
|
52427
|
+
server.registerTool("roon_tag_albums", {
|
|
52428
|
+
title: "Tag albums",
|
|
52429
|
+
description: "Put albums (album `keys`, up to 500) into a Roon tag by its `name`, or take them out with `remove: true`. `create: true` makes the tag when none has that name. Changes the library: first show the user the list of albums and the tag, and pass `confirm: true` only after they agreed. Smart tags can't be edited. Every album is read back.",
|
|
52430
|
+
inputSchema: {
|
|
52431
|
+
name: external_exports.string(),
|
|
52432
|
+
keys: external_exports.array(external_exports.string()).min(1).max(500),
|
|
52433
|
+
remove: external_exports.boolean().optional(),
|
|
52434
|
+
create: external_exports.boolean().optional(),
|
|
52435
|
+
confirm: external_exports.boolean().describe("true only after the user agreed to these albums and this tag."),
|
|
52436
|
+
profile: profile2
|
|
52437
|
+
},
|
|
52438
|
+
annotations: CHANGES
|
|
52439
|
+
}, ({ name, keys, remove, create, confirm, profile: p }) => run(() => asProfile(p, () => tagAlbums(name, keys, { remove, create, confirm: confirm === true }))));
|
|
52440
|
+
server.registerTool("roon_tag_delete", {
|
|
52441
|
+
title: "Delete a tag",
|
|
52442
|
+
description: "Delete a Roon tag by its `name` (the albums and tracks in it stay in the library). Can't be undone: only on an explicit request, and `confirm: true` only after the user agreed.",
|
|
52443
|
+
inputSchema: { name: external_exports.string(), confirm: external_exports.boolean().describe("true only after the user agreed."), profile: profile2 },
|
|
52444
|
+
annotations: CHANGES
|
|
52445
|
+
}, ({ name, confirm, profile: p }) => run(() => asProfile(p, () => deleteTag(name, confirm === true))));
|
|
52253
52446
|
server.registerTool("roon_library_add", {
|
|
52254
52447
|
title: "Add to the library",
|
|
52255
52448
|
description: "Add a Qobuz or TIDAL album to the user's Roon library (the album `key` from a search, shelf or discography). Changes the library: only on an explicit request.",
|
|
@@ -52421,7 +52614,7 @@ var INSTRUCTIONS = `Deep Roon MCP connects to the user's own Roon Core (music pl
|
|
|
52421
52614
|
- What plays changes all the time: read roon_now_playing afresh before describing it.
|
|
52422
52615
|
- "Daily Mixes" are Roon's own (roon_mixes); the user's TIDAL mixes (My Mix 1 \u2026, My Daily Discovery) are roon_tidal_playlists with shelf my_mixes, and their tracks can be read with roon_playlist.
|
|
52423
52616
|
- 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.`;
|
|
52424
|
-
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"]);
|
|
52617
|
+
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", "roon_tag_albums", "roon_tag_delete"]);
|
|
52425
52618
|
var PLAYBACK = /* @__PURE__ */ new Set([
|
|
52426
52619
|
"roon_device_reset",
|
|
52427
52620
|
"roon_play",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "deep-roon-mcp",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.12",
|
|
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>",
|