@withpica/mcp-server 2.102.0 → 2.104.0
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/CHANGELOG.md +114 -0
- package/README.md +10 -6
- package/dist/lib/changelog.generated.d.ts +2 -2
- package/dist/lib/changelog.generated.d.ts.map +1 -1
- package/dist/lib/changelog.generated.js +2 -2
- package/dist/lib/changelog.generated.js.map +1 -1
- package/dist/resources/index.d.ts.map +1 -1
- package/dist/resources/index.js +28 -1
- package/dist/resources/index.js.map +1 -1
- package/dist/resources/required-schemas.generated.d.ts +77 -0
- package/dist/resources/required-schemas.generated.d.ts.map +1 -1
- package/dist/resources/required-schemas.generated.js +114 -0
- package/dist/resources/required-schemas.generated.js.map +1 -1
- package/dist/resources/required-schemas.source.d.ts.map +1 -1
- package/dist/resources/required-schemas.source.js +85 -0
- package/dist/resources/required-schemas.source.js.map +1 -1
- package/dist/server-instructions.d.ts +2 -2
- package/dist/server-instructions.d.ts.map +1 -1
- package/dist/server-instructions.js +2 -0
- package/dist/server-instructions.js.map +1 -1
- package/dist/skills/skills.generated.d.ts.map +1 -1
- package/dist/skills/skills.generated.js +36 -3
- package/dist/skills/skills.generated.js.map +1 -1
- package/dist/tools/agent-hygiene.d.ts.map +1 -1
- package/dist/tools/agent-hygiene.js +2 -0
- package/dist/tools/agent-hygiene.js.map +1 -1
- package/dist/tools/agreement-types.d.ts.map +1 -1
- package/dist/tools/agreement-types.js +2 -0
- package/dist/tools/agreement-types.js.map +1 -1
- package/dist/tools/agreements.d.ts.map +1 -1
- package/dist/tools/agreements.js +9 -2
- package/dist/tools/agreements.js.map +1 -1
- package/dist/tools/assets.d.ts.map +1 -1
- package/dist/tools/assets.js +2 -0
- package/dist/tools/assets.js.map +1 -1
- package/dist/tools/audio-files.d.ts.map +1 -1
- package/dist/tools/audio-files.js +12 -8
- package/dist/tools/audio-files.js.map +1 -1
- package/dist/tools/audit.d.ts.map +1 -1
- package/dist/tools/audit.js +2 -0
- package/dist/tools/audit.js.map +1 -1
- package/dist/tools/auth.d.ts.map +1 -1
- package/dist/tools/auth.js +2 -0
- package/dist/tools/auth.js.map +1 -1
- package/dist/tools/bookings.d.ts.map +1 -1
- package/dist/tools/bookings.js +8 -4
- package/dist/tools/bookings.js.map +1 -1
- package/dist/tools/catalogue-argument.d.ts +76 -0
- package/dist/tools/catalogue-argument.d.ts.map +1 -0
- package/dist/tools/catalogue-argument.js +114 -0
- package/dist/tools/catalogue-argument.js.map +1 -0
- package/dist/tools/collaborations.d.ts.map +1 -1
- package/dist/tools/collaborations.js +2 -0
- package/dist/tools/collaborations.js.map +1 -1
- package/dist/tools/collaborators.d.ts.map +1 -1
- package/dist/tools/collaborators.js +33 -6
- package/dist/tools/collaborators.js.map +1 -1
- package/dist/tools/consent.d.ts.map +1 -1
- package/dist/tools/consent.js +5 -1
- package/dist/tools/consent.js.map +1 -1
- package/dist/tools/custody.d.ts +2 -2
- package/dist/tools/custody.d.ts.map +1 -1
- package/dist/tools/custody.js +47 -25
- package/dist/tools/custody.js.map +1 -1
- package/dist/tools/dashboard.d.ts.map +1 -1
- package/dist/tools/dashboard.js +12 -4
- package/dist/tools/dashboard.js.map +1 -1
- package/dist/tools/directory.d.ts.map +1 -1
- package/dist/tools/directory.js +7 -3
- package/dist/tools/directory.js.map +1 -1
- package/dist/tools/discovery.d.ts.map +1 -1
- package/dist/tools/discovery.js +31 -2
- package/dist/tools/discovery.js.map +1 -1
- package/dist/tools/documents.js +2 -2
- package/dist/tools/documents.js.map +1 -1
- package/dist/tools/duplicates.d.ts +15 -2
- package/dist/tools/duplicates.d.ts.map +1 -1
- package/dist/tools/duplicates.js +120 -14
- package/dist/tools/duplicates.js.map +1 -1
- package/dist/tools/enrichment.d.ts.map +1 -1
- package/dist/tools/enrichment.js +24 -32
- package/dist/tools/enrichment.js.map +1 -1
- package/dist/tools/handovers.d.ts +42 -0
- package/dist/tools/handovers.d.ts.map +1 -0
- package/dist/tools/handovers.js +302 -0
- package/dist/tools/handovers.js.map +1 -0
- package/dist/tools/import-documents.d.ts.map +1 -1
- package/dist/tools/import-documents.js +4 -0
- package/dist/tools/import-documents.js.map +1 -1
- package/dist/tools/index.d.ts +14 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +102 -4
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/labels.d.ts.map +1 -1
- package/dist/tools/labels.js +18 -2
- package/dist/tools/labels.js.map +1 -1
- package/dist/tools/licensing.d.ts.map +1 -1
- package/dist/tools/licensing.js +13 -6
- package/dist/tools/licensing.js.map +1 -1
- package/dist/tools/measured-audio.d.ts +32 -0
- package/dist/tools/measured-audio.d.ts.map +1 -0
- package/dist/tools/measured-audio.js +65 -0
- package/dist/tools/measured-audio.js.map +1 -0
- package/dist/tools/memory.d.ts.map +1 -1
- package/dist/tools/memory.js +2 -0
- package/dist/tools/memory.js.map +1 -1
- package/dist/tools/metadata.d.ts.map +1 -1
- package/dist/tools/metadata.js +115 -0
- package/dist/tools/metadata.js.map +1 -1
- package/dist/tools/multimedia.d.ts.map +1 -1
- package/dist/tools/multimedia.js +2 -0
- package/dist/tools/multimedia.js.map +1 -1
- package/dist/tools/my-recent-questions.d.ts.map +1 -1
- package/dist/tools/my-recent-questions.js +2 -0
- package/dist/tools/my-recent-questions.js.map +1 -1
- package/dist/tools/my-reported-issues.d.ts.map +1 -1
- package/dist/tools/my-reported-issues.js +2 -0
- package/dist/tools/my-reported-issues.js.map +1 -1
- package/dist/tools/notes.d.ts.map +1 -1
- package/dist/tools/notes.js +2 -0
- package/dist/tools/notes.js.map +1 -1
- package/dist/tools/notifications.d.ts.map +1 -1
- package/dist/tools/notifications.js +12 -3
- package/dist/tools/notifications.js.map +1 -1
- package/dist/tools/party-claims.d.ts.map +1 -1
- package/dist/tools/party-claims.js +14 -3
- package/dist/tools/party-claims.js.map +1 -1
- package/dist/tools/people.d.ts.map +1 -1
- package/dist/tools/people.js +58 -47
- package/dist/tools/people.js.map +1 -1
- package/dist/tools/profile-claims.d.ts +6 -0
- package/dist/tools/profile-claims.d.ts.map +1 -1
- package/dist/tools/profile-claims.js +7 -0
- package/dist/tools/profile-claims.js.map +1 -1
- package/dist/tools/projects.d.ts.map +1 -1
- package/dist/tools/projects.js +2 -0
- package/dist/tools/projects.js.map +1 -1
- package/dist/tools/publishers.d.ts.map +1 -1
- package/dist/tools/publishers.js +20 -5
- package/dist/tools/publishers.js.map +1 -1
- package/dist/tools/recordings.d.ts.map +1 -1
- package/dist/tools/recordings.js +49 -49
- package/dist/tools/recordings.js.map +1 -1
- package/dist/tools/recovery-hints.d.ts.map +1 -1
- package/dist/tools/recovery-hints.js +143 -0
- package/dist/tools/recovery-hints.js.map +1 -1
- package/dist/tools/relationship-change.d.ts +16 -0
- package/dist/tools/relationship-change.d.ts.map +1 -0
- package/dist/tools/relationship-change.js +60 -0
- package/dist/tools/relationship-change.js.map +1 -0
- package/dist/tools/relationship-copy.d.ts +99 -0
- package/dist/tools/relationship-copy.d.ts.map +1 -0
- package/dist/tools/relationship-copy.js +213 -0
- package/dist/tools/relationship-copy.js.map +1 -0
- package/dist/tools/relationship-scope.d.ts +104 -0
- package/dist/tools/relationship-scope.d.ts.map +1 -0
- package/dist/tools/relationship-scope.js +106 -0
- package/dist/tools/relationship-scope.js.map +1 -0
- package/dist/tools/relationships.d.ts +64 -0
- package/dist/tools/relationships.d.ts.map +1 -0
- package/dist/tools/relationships.js +1062 -0
- package/dist/tools/relationships.js.map +1 -0
- package/dist/tools/release-notes.d.ts.map +1 -1
- package/dist/tools/release-notes.js +2 -0
- package/dist/tools/release-notes.js.map +1 -1
- package/dist/tools/release-rich.d.ts.map +1 -1
- package/dist/tools/release-rich.js +4 -6
- package/dist/tools/release-rich.js.map +1 -1
- package/dist/tools/releases.d.ts.map +1 -1
- package/dist/tools/releases.js +16 -11
- package/dist/tools/releases.js.map +1 -1
- package/dist/tools/royalties.d.ts.map +1 -1
- package/dist/tools/royalties.js +10 -0
- package/dist/tools/royalties.js.map +1 -1
- package/dist/tools/search.d.ts.map +1 -1
- package/dist/tools/search.js +2 -0
- package/dist/tools/search.js.map +1 -1
- package/dist/tools/selections.d.ts.map +1 -1
- package/dist/tools/selections.js +4 -0
- package/dist/tools/selections.js.map +1 -1
- package/dist/tools/send.d.ts.map +1 -1
- package/dist/tools/send.js +2 -0
- package/dist/tools/send.js.map +1 -1
- package/dist/tools/sessions.d.ts.map +1 -1
- package/dist/tools/sessions.js +13 -7
- package/dist/tools/sessions.js.map +1 -1
- package/dist/tools/settings.d.ts.map +1 -1
- package/dist/tools/settings.js +4 -1
- package/dist/tools/settings.js.map +1 -1
- package/dist/tools/statements.d.ts.map +1 -1
- package/dist/tools/statements.js +2 -0
- package/dist/tools/statements.js.map +1 -1
- package/dist/tools/sync-fit.d.ts +27 -0
- package/dist/tools/sync-fit.d.ts.map +1 -0
- package/dist/tools/sync-fit.js +118 -0
- package/dist/tools/sync-fit.js.map +1 -0
- package/dist/tools/sync-placements.d.ts.map +1 -1
- package/dist/tools/sync-placements.js +2 -0
- package/dist/tools/sync-placements.js.map +1 -1
- package/dist/tools/users.d.ts.map +1 -1
- package/dist/tools/users.js +14 -3
- package/dist/tools/users.js.map +1 -1
- package/dist/tools/work-themes.d.ts +39 -0
- package/dist/tools/work-themes.d.ts.map +1 -0
- package/dist/tools/work-themes.js +330 -0
- package/dist/tools/work-themes.js.map +1 -0
- package/dist/tools/works.d.ts +11 -0
- package/dist/tools/works.d.ts.map +1 -1
- package/dist/tools/works.js +67 -5
- package/dist/tools/works.js.map +1 -1
- package/package.json +4 -4
- package/scripts/build-required-schemas.ts +6 -4
- package/server.json +2 -2
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
// Copyright (c) 2025-2026 Withpica Ltd. All rights reserved.
|
|
2
|
+
import { formatSuccess } from "@withpica/mcp-utils";
|
|
3
|
+
/** Mirrors lib/services/directory/themes.ts THEME_VOCABULARY (parity test). */
|
|
4
|
+
export const THEME_VOCABULARY = [
|
|
5
|
+
"love",
|
|
6
|
+
"heartbreak",
|
|
7
|
+
"longing",
|
|
8
|
+
"desire",
|
|
9
|
+
"friendship",
|
|
10
|
+
"family",
|
|
11
|
+
"home",
|
|
12
|
+
"nostalgia",
|
|
13
|
+
"loss",
|
|
14
|
+
"loneliness",
|
|
15
|
+
"hope",
|
|
16
|
+
"faith",
|
|
17
|
+
"worship",
|
|
18
|
+
"gratitude",
|
|
19
|
+
"joy",
|
|
20
|
+
"celebration",
|
|
21
|
+
"freedom",
|
|
22
|
+
"empowerment",
|
|
23
|
+
"resilience",
|
|
24
|
+
"struggle",
|
|
25
|
+
"rebellion",
|
|
26
|
+
"identity",
|
|
27
|
+
"ambition",
|
|
28
|
+
"money",
|
|
29
|
+
"peace",
|
|
30
|
+
"nature",
|
|
31
|
+
"night",
|
|
32
|
+
"city",
|
|
33
|
+
"travel",
|
|
34
|
+
"summer",
|
|
35
|
+
];
|
|
36
|
+
/** Mirrors lib/services/mood-derivation.ts MOOD_VOCABULARY (parity test). */
|
|
37
|
+
export const MOOD_VOCABULARY = [
|
|
38
|
+
"aggressive",
|
|
39
|
+
"ambient",
|
|
40
|
+
"calm",
|
|
41
|
+
"contemplative",
|
|
42
|
+
"dark",
|
|
43
|
+
"dramatic",
|
|
44
|
+
"dreamy",
|
|
45
|
+
"energetic",
|
|
46
|
+
"epic",
|
|
47
|
+
"ethereal",
|
|
48
|
+
"hopeful",
|
|
49
|
+
"intense",
|
|
50
|
+
"melancholic",
|
|
51
|
+
"nostalgic",
|
|
52
|
+
"passionate",
|
|
53
|
+
"playful",
|
|
54
|
+
"romantic",
|
|
55
|
+
"sad",
|
|
56
|
+
"tender",
|
|
57
|
+
"tense",
|
|
58
|
+
"triumphant",
|
|
59
|
+
"uplifting",
|
|
60
|
+
"warm",
|
|
61
|
+
];
|
|
62
|
+
function stateText(s) {
|
|
63
|
+
const list = (xs) => xs.length > 0 ? xs.map((x) => x.theme).join(", ") : "none";
|
|
64
|
+
const lines = [
|
|
65
|
+
`${s.title}: topics ${s.themes_enabled ? "on" : "switched off"}, lyrics shown publicly as: ${s.lyrics_visibility}.`,
|
|
66
|
+
`Approved topics: ${list(s.approved)}.`,
|
|
67
|
+
`Awaiting the owner's review: ${list(s.proposed)}.`,
|
|
68
|
+
];
|
|
69
|
+
if (s.proposed_moods.length > 0) {
|
|
70
|
+
lines.push(`Moods awaiting review: ${s.proposed_moods
|
|
71
|
+
.map((m) => `${m.moods.join(", ")} (recording ${m.recording_id})`)
|
|
72
|
+
.join("; ")}.`);
|
|
73
|
+
}
|
|
74
|
+
if (!s.has_lyrics)
|
|
75
|
+
lines.push("This song has no lyrics in PICA.");
|
|
76
|
+
return lines.join("\n");
|
|
77
|
+
}
|
|
78
|
+
export class WorkThemesTools {
|
|
79
|
+
pica;
|
|
80
|
+
constructor(pica) {
|
|
81
|
+
this.pica = pica;
|
|
82
|
+
}
|
|
83
|
+
getTools() {
|
|
84
|
+
return [
|
|
85
|
+
{
|
|
86
|
+
definition: {
|
|
87
|
+
name: "pica_topics_untagged",
|
|
88
|
+
scope: "read:catalog",
|
|
89
|
+
audiences: ["stdio", "http", "public"],
|
|
90
|
+
tier: "read",
|
|
91
|
+
description: "Songs in this catalogue that are listed in the public directory and have lyrics in PICA, " +
|
|
92
|
+
'but no approved topic yet, so people searching the directory by topic ("a song about love") ' +
|
|
93
|
+
"cannot find them. Use when the user asks: 'which of my songs need topics?', " +
|
|
94
|
+
"'tag my songs for the directory'. Returns each song's id and title and how many proposed " +
|
|
95
|
+
"topics already await review. Never returns lyrics. " +
|
|
96
|
+
"→ then: pica_topics_inspect (one song) → pica_topics_propose",
|
|
97
|
+
workflows: "infrastructure",
|
|
98
|
+
vernacular_kind: "creator-entry",
|
|
99
|
+
inputSchema: { type: "object", properties: {} },
|
|
100
|
+
annotations: { readOnlyHint: true },
|
|
101
|
+
},
|
|
102
|
+
executor: this.untagged.bind(this),
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
definition: {
|
|
106
|
+
name: "pica_topics_inspect",
|
|
107
|
+
scope: "read:catalog",
|
|
108
|
+
audiences: ["stdio", "http", "public"],
|
|
109
|
+
tier: "read",
|
|
110
|
+
description: "One song's directory topics: those approved (public when the song is listed), those " +
|
|
111
|
+
"awaiting the owner's review, moods proposed for its recordings, whether topics are " +
|
|
112
|
+
"switched on, and how much of the lyrics the public directory may show. Use when the user " +
|
|
113
|
+
"asks: 'what topics does this song have?', 'what's waiting for my approval?'. Only for " +
|
|
114
|
+
"songs this catalogue owns. Does not return the lyrics: read them with pica_works_inspect. " +
|
|
115
|
+
"→ then: pica_topics_review (approve or change)",
|
|
116
|
+
workflows: "infrastructure",
|
|
117
|
+
vernacular_kind: "creator-entry",
|
|
118
|
+
inputSchema: {
|
|
119
|
+
type: "object",
|
|
120
|
+
properties: {
|
|
121
|
+
work_id: {
|
|
122
|
+
type: "string",
|
|
123
|
+
description: "The song's id (from pica_works_query).",
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
required: ["work_id"],
|
|
127
|
+
},
|
|
128
|
+
annotations: { readOnlyHint: true },
|
|
129
|
+
},
|
|
130
|
+
executor: this.inspect.bind(this),
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
definition: {
|
|
134
|
+
name: "pica_topics_propose",
|
|
135
|
+
scope: "write:catalog",
|
|
136
|
+
audiences: ["stdio", "http", "public"],
|
|
137
|
+
tier: "draft",
|
|
138
|
+
description: "Propose the topics a song is about (up to 5, from a fixed list) and moods for its " +
|
|
139
|
+
"recordings, for the owner to review. Nothing becomes public: proposals wait until " +
|
|
140
|
+
"pica_topics_review approves them. Use when the user asks: 'suggest topics for my " +
|
|
141
|
+
"songs', 'tag this song'. Base topics on what the owner's lyrics are actually about (read " +
|
|
142
|
+
"them with pica_works_inspect), and moods on how the recording sounds (tempo, key, mode, " +
|
|
143
|
+
"energy); never invent a topic outside the list. A new proposal replaces the song's earlier " +
|
|
144
|
+
"pending one; approved topics are kept. Only for songs this catalogue owns. " +
|
|
145
|
+
"→ first: pica_topics_untagged (which songs) → then: show the proposal to the user, " +
|
|
146
|
+
"and pica_topics_review once they decide",
|
|
147
|
+
workflows: "infrastructure",
|
|
148
|
+
vernacular_kind: "creator-entry",
|
|
149
|
+
inputSchema: {
|
|
150
|
+
type: "object",
|
|
151
|
+
properties: {
|
|
152
|
+
work_id: {
|
|
153
|
+
type: "string",
|
|
154
|
+
description: "The song's id (from pica_works_query).",
|
|
155
|
+
},
|
|
156
|
+
themes: {
|
|
157
|
+
type: "array",
|
|
158
|
+
items: { type: "string", enum: [...THEME_VOCABULARY] },
|
|
159
|
+
maxItems: 5,
|
|
160
|
+
description: "Topics the lyrics are about, most central first. Leave out or empty if none fit.",
|
|
161
|
+
},
|
|
162
|
+
moods: {
|
|
163
|
+
type: "array",
|
|
164
|
+
description: "Moods per recording of this song (recording ids from pica_works_inspect).",
|
|
165
|
+
items: {
|
|
166
|
+
type: "object",
|
|
167
|
+
properties: {
|
|
168
|
+
recording_id: {
|
|
169
|
+
type: "string",
|
|
170
|
+
description: "A recording of this song.",
|
|
171
|
+
},
|
|
172
|
+
moods: {
|
|
173
|
+
type: "array",
|
|
174
|
+
items: { type: "string", enum: [...MOOD_VOCABULARY] },
|
|
175
|
+
description: "How the recording sounds.",
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
required: ["recording_id", "moods"],
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
required: ["work_id"],
|
|
183
|
+
},
|
|
184
|
+
annotations: {
|
|
185
|
+
readOnlyHint: false,
|
|
186
|
+
destructiveHint: false,
|
|
187
|
+
idempotentHint: true,
|
|
188
|
+
openWorldHint: false,
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
executor: this.propose.bind(this),
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
definition: {
|
|
195
|
+
name: "pica_topics_review",
|
|
196
|
+
scope: "write:catalog",
|
|
197
|
+
audiences: ["stdio", "http", "public"],
|
|
198
|
+
tier: "write",
|
|
199
|
+
description: "The owner's decision on a song's topics. Approve proposed topics (one by one or all), " +
|
|
200
|
+
"reject topics, approve or discard proposed moods, set the approved topics directly, switch " +
|
|
201
|
+
"topics off for the song, or choose how much of the lyrics the public directory may show " +
|
|
202
|
+
"(themes only, a snippet, or the full lyrics). Approved topics become public on listed " +
|
|
203
|
+
"songs; approved moods are saved on the recording. Use when the user asks: 'approve those " +
|
|
204
|
+
"topics', 'drop heartbreak and keep the rest'. ONLY call after the owner has said yes to " +
|
|
205
|
+
"exactly this: never approve on their behalf. Only for songs this catalogue owns. " +
|
|
206
|
+
"→ first: pica_topics_inspect (see what awaits review)",
|
|
207
|
+
workflows: "infrastructure",
|
|
208
|
+
vernacular_kind: "creator-entry",
|
|
209
|
+
inputSchema: {
|
|
210
|
+
type: "object",
|
|
211
|
+
properties: {
|
|
212
|
+
work_id: {
|
|
213
|
+
type: "string",
|
|
214
|
+
description: "The song's id.",
|
|
215
|
+
},
|
|
216
|
+
approve: {
|
|
217
|
+
type: "array",
|
|
218
|
+
items: { type: "string", enum: [...THEME_VOCABULARY] },
|
|
219
|
+
description: "Proposed topics to approve.",
|
|
220
|
+
},
|
|
221
|
+
approve_all: {
|
|
222
|
+
type: "boolean",
|
|
223
|
+
description: "true approves every topic awaiting review.",
|
|
224
|
+
},
|
|
225
|
+
reject: {
|
|
226
|
+
type: "array",
|
|
227
|
+
items: { type: "string", enum: [...THEME_VOCABULARY] },
|
|
228
|
+
description: "Topics to remove, proposed or approved.",
|
|
229
|
+
},
|
|
230
|
+
set_themes: {
|
|
231
|
+
type: "array",
|
|
232
|
+
items: { type: "string", enum: [...THEME_VOCABULARY] },
|
|
233
|
+
maxItems: 5,
|
|
234
|
+
description: "Make exactly these the song's approved topics. Approved topics left out are removed; other suggestions awaiting review are kept.",
|
|
235
|
+
},
|
|
236
|
+
approve_moods_for: {
|
|
237
|
+
type: "array",
|
|
238
|
+
items: { type: "string" },
|
|
239
|
+
description: "Recording ids whose proposed moods to save.",
|
|
240
|
+
},
|
|
241
|
+
approve_all_moods: {
|
|
242
|
+
type: "boolean",
|
|
243
|
+
description: "true saves every proposed mood on this song.",
|
|
244
|
+
},
|
|
245
|
+
reject_moods_for: {
|
|
246
|
+
type: "array",
|
|
247
|
+
items: { type: "string" },
|
|
248
|
+
description: "Recording ids whose proposed moods to discard.",
|
|
249
|
+
},
|
|
250
|
+
themes_enabled: {
|
|
251
|
+
type: "boolean",
|
|
252
|
+
description: "false hides this song's topics from the directory and from topic search.",
|
|
253
|
+
},
|
|
254
|
+
lyrics_visibility: {
|
|
255
|
+
type: "string",
|
|
256
|
+
enum: ["themes", "snippet", "full"],
|
|
257
|
+
description: "How much of the lyrics the public directory may show. Default themes (topics only).",
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
required: ["work_id"],
|
|
261
|
+
},
|
|
262
|
+
annotations: {
|
|
263
|
+
readOnlyHint: false,
|
|
264
|
+
destructiveHint: false,
|
|
265
|
+
idempotentHint: true,
|
|
266
|
+
openWorldHint: false,
|
|
267
|
+
},
|
|
268
|
+
},
|
|
269
|
+
executor: this.review.bind(this),
|
|
270
|
+
},
|
|
271
|
+
];
|
|
272
|
+
}
|
|
273
|
+
async untagged() {
|
|
274
|
+
const result = await this.pica.directory.untaggedThemes();
|
|
275
|
+
const songs = result?.songs ?? [];
|
|
276
|
+
const text = songs.length === 0
|
|
277
|
+
? "Every listed song with lyrics has a topic (or none have lyrics in PICA)."
|
|
278
|
+
: `${songs.length} listed song${songs.length === 1 ? "" : "s"} with lyrics but no topic yet:\n` +
|
|
279
|
+
songs
|
|
280
|
+
.map((s) => `- ${s.title} (${s.work_id})${s.pending_proposals > 0 ? `, ${s.pending_proposals} proposed awaiting review` : ""}`)
|
|
281
|
+
.join("\n");
|
|
282
|
+
return formatSuccess(text, { count: songs.length, songs });
|
|
283
|
+
}
|
|
284
|
+
async inspect(args) {
|
|
285
|
+
const state = await this.pica.works.getThemes(String(args.work_id));
|
|
286
|
+
return formatSuccess(stateText(state), state);
|
|
287
|
+
}
|
|
288
|
+
async propose(args) {
|
|
289
|
+
const state = await this.pica.works.proposeThemes(String(args.work_id), {
|
|
290
|
+
themes: args.themes,
|
|
291
|
+
moods: args.moods,
|
|
292
|
+
});
|
|
293
|
+
return formatSuccess(`Proposed, not public. Show the owner and ask before approving.\n${stateText(state)}`, state);
|
|
294
|
+
}
|
|
295
|
+
async review(args) {
|
|
296
|
+
const workId = String(args.work_id);
|
|
297
|
+
let state = null;
|
|
298
|
+
if (args.approve !== undefined ||
|
|
299
|
+
args.approve_all === true ||
|
|
300
|
+
args.reject !== undefined ||
|
|
301
|
+
args.approve_moods_for !== undefined ||
|
|
302
|
+
args.approve_all_moods === true ||
|
|
303
|
+
args.reject_moods_for !== undefined) {
|
|
304
|
+
state = await this.pica.works.reviewThemes(workId, {
|
|
305
|
+
approve: args.approve_all === true
|
|
306
|
+
? "all"
|
|
307
|
+
: args.approve,
|
|
308
|
+
reject: args.reject,
|
|
309
|
+
approve_moods_for: args.approve_all_moods === true
|
|
310
|
+
? "all"
|
|
311
|
+
: args.approve_moods_for,
|
|
312
|
+
reject_moods_for: args.reject_moods_for,
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
if (args.set_themes !== undefined ||
|
|
316
|
+
args.themes_enabled !== undefined ||
|
|
317
|
+
args.lyrics_visibility !== undefined) {
|
|
318
|
+
state = await this.pica.works.setThemes(workId, {
|
|
319
|
+
themes: args.set_themes,
|
|
320
|
+
themes_enabled: args.themes_enabled,
|
|
321
|
+
lyrics_visibility: args.lyrics_visibility,
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
if (!state) {
|
|
325
|
+
return formatSuccess("Nothing to change: pass approve, reject, set_themes, the mood fields, themes_enabled or lyrics_visibility.", {});
|
|
326
|
+
}
|
|
327
|
+
return formatSuccess(`Saved.\n${stateText(state)}`, state);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
//# sourceMappingURL=work-themes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"work-themes.js","sourceRoot":"","sources":["../../src/tools/work-themes.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAyB7D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,+EAA+E;AAC/E,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,MAAM;IACN,YAAY;IACZ,SAAS;IACT,QAAQ;IACR,YAAY;IACZ,QAAQ;IACR,MAAM;IACN,WAAW;IACX,MAAM;IACN,YAAY;IACZ,MAAM;IACN,OAAO;IACP,SAAS;IACT,WAAW;IACX,KAAK;IACL,aAAa;IACb,SAAS;IACT,aAAa;IACb,YAAY;IACZ,UAAU;IACV,WAAW;IACX,UAAU;IACV,UAAU;IACV,OAAO;IACP,OAAO;IACP,QAAQ;IACR,OAAO;IACP,MAAM;IACN,QAAQ;IACR,QAAQ;CACA,CAAC;AAEX,6EAA6E;AAC7E,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,YAAY;IACZ,SAAS;IACT,MAAM;IACN,eAAe;IACf,MAAM;IACN,UAAU;IACV,QAAQ;IACR,WAAW;IACX,MAAM;IACN,UAAU;IACV,SAAS;IACT,SAAS;IACT,aAAa;IACb,WAAW;IACX,YAAY;IACZ,SAAS;IACT,UAAU;IACV,KAAK;IACL,QAAQ;IACR,OAAO;IACP,YAAY;IACZ,WAAW;IACX,MAAM;CACE,CAAC;AAEX,SAAS,SAAS,CAAC,CAAiB;IAClC,MAAM,IAAI,GAAG,CAAC,EAA4B,EAAE,EAAE,CAC5C,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IAC7D,MAAM,KAAK,GAAG;QACZ,GAAG,CAAC,CAAC,KAAK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,IAAI,CAAC,iBAAiB,KAAK,IAAI;oBAC7B,CAAC,CAAC,KAAK;oBACP,CAAC,CAAE,IAAI,CAAC,iBAA0C;gBACtD,gBAAgB,EAAE,IAAI,CAAC,gBAAwC;aAChE,CAAC,CAAC;QACL,CAAC;QACD,IACE,IAAI,CAAC,UAAU,KAAK,SAAS;YAC7B,IAAI,CAAC,cAAc,KAAK,SAAS;YACjC,IAAI,CAAC,iBAAiB,KAAK,SAAS,EACpC,CAAC;YACD,KAAK,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,EAAE;gBAC9C,MAAM,EAAE,IAAI,CAAC,UAAkC;gBAC/C,cAAc,EAAE,IAAI,CAAC,cAAqC;gBAC1D,iBAAiB,EAAE,IAAI,CAAC,iBAIX;aACd,CAAC,CAAC;QACL,CAAC;QACD,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,aAAa,CAClB,4GAA4G,EAC5G,EAAE,CACH,CAAC;QACJ,CAAC;QACD,OAAO,aAAa,CAAC,WAAW,SAAS,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;IAC7D,CAAC;CACF"}
|
package/dist/tools/works.d.ts
CHANGED
|
@@ -53,6 +53,17 @@ export declare class WorksTools {
|
|
|
53
53
|
* when nothing matches, so inspect surfaces a hard not-found (ADR-198).
|
|
54
54
|
*/
|
|
55
55
|
private resolveWorkIdByIswc;
|
|
56
|
+
/**
|
|
57
|
+
* pica_works_inspect in a CLIENT's catalogue (ADR-333 PR 1.3). Only the
|
|
58
|
+
* song's own record opens through a relationship (GET /api/admin/works/:id,
|
|
59
|
+
* in the safe shape — lib/auth/catalogue-routes.ts); every other section's
|
|
60
|
+
* route is refused there. So: no sections asked → the record, saying what
|
|
61
|
+
* is not available; a section asked that is not available → refused,
|
|
62
|
+
* naming it. Never the all-sections path, which fails each refused section
|
|
63
|
+
* soft and would answer "success" about a song it never read (D2 Gate 2,
|
|
64
|
+
* holdout run 38435148161).
|
|
65
|
+
*/
|
|
66
|
+
private inspectWorkInClientCatalogue;
|
|
56
67
|
private inspectWork;
|
|
57
68
|
/**
|
|
58
69
|
* Create work
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"works.d.ts","sourceRoot":"","sources":["../../src/tools/works.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAEL,UAAU,
|
|
1
|
+
{"version":3,"file":"works.d.ts","sourceRoot":"","sources":["../../src/tools/works.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAEL,UAAU,EAIX,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,YAAY,EAAc,MAAM,YAAY,CAAC;AAqCtE;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAkKzE,CAAC;AAyDF,qBAAa,UAAU;IACrB,OAAO,CAAC,IAAI,CAAa;gBAEb,IAAI,EAAE,UAAU;IAI5B;;OAEG;IACH,QAAQ,IAAI,KAAK,CAAC;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,QAAQ,EAAE,YAAY,CAAA;KAAE,CAAC;IA4vBzE;;OAEG;YACW,UAAU;IA+LxB;;OAEG;IACH;;;;;OAKG;YACW,mBAAmB;IAmBjC;;;;;;;;;OASG;YACW,4BAA4B;YAmC5B,WAAW;IA0azB;;OAEG;YACW,UAAU;IAgHxB;;OAEG;YACW,UAAU;IA6DxB;;OAEG;YACW,UAAU;IAKxB;;;;;;;;;;OAUG;YACW,UAAU;IAiBxB;;OAEG;YACW,eAAe;IAe7B;;OAEG;YACW,sBAAsB;IAqBpC;;;;OAIG;YACW,UAAU;YAsCV,mBAAmB;CA6DlC"}
|
package/dist/tools/works.js
CHANGED
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
* or `pica_releases_update` with `label_organization_id`, resolving
|
|
19
19
|
* the name via `pica_labels_query` first.
|
|
20
20
|
*/
|
|
21
|
-
import { ApiError, EntityNotFoundError, } from "@withpica/mcp-sdk";
|
|
21
|
+
import { ApiError, EntityNotFoundError, currentCatalogue, } from "@withpica/mcp-sdk";
|
|
22
|
+
import { formatProposedChange, readChangeOutcome, } from "./relationship-change.js";
|
|
22
23
|
import { formatSuccess, formatDeletion, formatStructuredList, withBillingGate, buildDecision, mapGapsToHints, pushSectionError, } from "@withpica/mcp-utils";
|
|
23
24
|
import { buildCustodyHints } from "./custody-hints.js";
|
|
24
25
|
import { typedError } from "./error-envelope.js";
|
|
@@ -227,6 +228,13 @@ function summariseDossier(dossier) {
|
|
|
227
228
|
*/
|
|
228
229
|
const WORKS_HEALTH_MAX_PAGE = 50;
|
|
229
230
|
const LOW_COMPLETENESS_MAX_PAGE = 200;
|
|
231
|
+
/**
|
|
232
|
+
* The pica_works_inspect sections whose route opens through a relationship.
|
|
233
|
+
* A hand-kept mirror of lib/auth/catalogue-routes.ts CATALOGUE_ROUTES (only
|
|
234
|
+
* GET /api/admin/works/:id there serves a single song's sections): opening
|
|
235
|
+
* another works sub-route there means adding its section here.
|
|
236
|
+
*/
|
|
237
|
+
const CLIENT_CATALOGUE_WORK_SECTIONS = ["basic"];
|
|
230
238
|
export class WorksTools {
|
|
231
239
|
pica;
|
|
232
240
|
constructor(pica) {
|
|
@@ -409,6 +417,8 @@ export class WorksTools {
|
|
|
409
417
|
},
|
|
410
418
|
limit: {
|
|
411
419
|
type: "number",
|
|
420
|
+
minimum: 1,
|
|
421
|
+
maximum: 100,
|
|
412
422
|
description: "Max results (default: 50)",
|
|
413
423
|
},
|
|
414
424
|
offset: {
|
|
@@ -813,7 +823,6 @@ export class WorksTools {
|
|
|
813
823
|
required: ["work_ids", "mode"],
|
|
814
824
|
},
|
|
815
825
|
annotations: {
|
|
816
|
-
title: "verify work registrations",
|
|
817
826
|
readOnlyHint: false,
|
|
818
827
|
destructiveHint: false,
|
|
819
828
|
idempotentHint: true,
|
|
@@ -1083,6 +1092,41 @@ export class WorksTools {
|
|
|
1083
1092
|
}
|
|
1084
1093
|
return match.id;
|
|
1085
1094
|
}
|
|
1095
|
+
/**
|
|
1096
|
+
* pica_works_inspect in a CLIENT's catalogue (ADR-333 PR 1.3). Only the
|
|
1097
|
+
* song's own record opens through a relationship (GET /api/admin/works/:id,
|
|
1098
|
+
* in the safe shape — lib/auth/catalogue-routes.ts); every other section's
|
|
1099
|
+
* route is refused there. So: no sections asked → the record, saying what
|
|
1100
|
+
* is not available; a section asked that is not available → refused,
|
|
1101
|
+
* naming it. Never the all-sections path, which fails each refused section
|
|
1102
|
+
* soft and would answer "success" about a song it never read (D2 Gate 2,
|
|
1103
|
+
* holdout run 38435148161).
|
|
1104
|
+
*/
|
|
1105
|
+
async inspectWorkInClientCatalogue(workId, sections) {
|
|
1106
|
+
const unavailable = (sections ?? []).filter((s) => !CLIENT_CATALOGUE_WORK_SECTIONS.includes(s));
|
|
1107
|
+
if (unavailable.length > 0) {
|
|
1108
|
+
return {
|
|
1109
|
+
content: [
|
|
1110
|
+
{
|
|
1111
|
+
type: "text",
|
|
1112
|
+
text: JSON.stringify({
|
|
1113
|
+
error: "CATALOGUE_SECTION_NOT_AVAILABLE",
|
|
1114
|
+
message: `In a client's catalogue only ${CLIENT_CATALOGUE_WORK_SECTIONS.join(", ")} can be read; not ${unavailable.join(", ")}.`,
|
|
1115
|
+
available_sections: CLIENT_CATALOGUE_WORK_SECTIONS,
|
|
1116
|
+
}, null, 2),
|
|
1117
|
+
},
|
|
1118
|
+
],
|
|
1119
|
+
isError: true,
|
|
1120
|
+
};
|
|
1121
|
+
}
|
|
1122
|
+
// Refused (out of scope, ended) → thrown, and answered as an error.
|
|
1123
|
+
const work = await this.pica.works.get(workId);
|
|
1124
|
+
return formatSuccess("Work details", {
|
|
1125
|
+
work,
|
|
1126
|
+
available_sections: CLIENT_CATALOGUE_WORK_SECTIONS,
|
|
1127
|
+
note: "in a client's catalogue only the song's own record can be read through the relationship",
|
|
1128
|
+
});
|
|
1129
|
+
}
|
|
1086
1130
|
async inspectWork(args) {
|
|
1087
1131
|
// Accept work_id as an alias for id — write tools use work_id, so agents
|
|
1088
1132
|
// doing read-after-write naturally pass work_id here. Without this alias
|
|
@@ -1103,6 +1147,8 @@ export class WorksTools {
|
|
|
1103
1147
|
};
|
|
1104
1148
|
}
|
|
1105
1149
|
const sections = args.sections;
|
|
1150
|
+
if (currentCatalogue() !== undefined)
|
|
1151
|
+
return this.inspectWorkInClientCatalogue(workId, sections);
|
|
1106
1152
|
const allSections = !sections || sections.length === 0;
|
|
1107
1153
|
// Sections kept OFF the default `allSections` surface but still callable
|
|
1108
1154
|
// via explicit `sections`:
|
|
@@ -1239,7 +1285,8 @@ export class WorksTools {
|
|
|
1239
1285
|
if (has("agreements") && !result.agreements) {
|
|
1240
1286
|
sectionTasks.push((async () => {
|
|
1241
1287
|
try {
|
|
1242
|
-
|
|
1288
|
+
// This work's agreements — not the org's first page of them.
|
|
1289
|
+
result.agreements = await this.pica.works.getAgreements(workId);
|
|
1243
1290
|
}
|
|
1244
1291
|
catch (e) {
|
|
1245
1292
|
result.agreements = useStructured ? null : [];
|
|
@@ -1567,13 +1614,28 @@ export class WorksTools {
|
|
|
1567
1614
|
async updateWork(args) {
|
|
1568
1615
|
const { verbose, rest } = takeVerbose(args);
|
|
1569
1616
|
const { id, ...updates } = rest;
|
|
1617
|
+
// In a client's catalogue the integrity reads are not opened through the
|
|
1618
|
+
// relationship (lib/auth/catalogue-routes.ts): skip them rather than have
|
|
1619
|
+
// each one refused.
|
|
1620
|
+
const inClientCatalogue = currentCatalogue() !== undefined;
|
|
1570
1621
|
// Compact receipt (ops 61ce1dcc): read the gaps open BEFORE the write so
|
|
1571
1622
|
// the answer can name only the ones this write opened. Skipped when the
|
|
1572
1623
|
// caller asked for the full record, which repeats every gap anyway.
|
|
1573
|
-
const before = verbose
|
|
1624
|
+
const before = verbose || inClientCatalogue
|
|
1574
1625
|
? null
|
|
1575
1626
|
: await buildIntegrityPressure(this.pica, "work", id);
|
|
1576
|
-
const
|
|
1627
|
+
const outcome = readChangeOutcome(await this.pica.works.update(id, updates));
|
|
1628
|
+
if (outcome.kind === "proposed")
|
|
1629
|
+
return formatProposedChange("work", id, Object.keys(updates), outcome);
|
|
1630
|
+
const work = outcome.record;
|
|
1631
|
+
if (inClientCatalogue) {
|
|
1632
|
+
const { changed, unconfirmed } = changedFields(updates, work);
|
|
1633
|
+
return formatSuccess("Work updated successfully", {
|
|
1634
|
+
id: work?.id ?? id,
|
|
1635
|
+
changed,
|
|
1636
|
+
...(unconfirmed.length > 0 ? { unconfirmed } : {}),
|
|
1637
|
+
});
|
|
1638
|
+
}
|
|
1577
1639
|
// Registration integrity floor (Task 9) — same pressure rendering as
|
|
1578
1640
|
// createWork, so an update that clears (or introduces) a gap keeps the
|
|
1579
1641
|
// agent informed without a separate inspect round-trip.
|