@withpica/mcp-server 2.6.2 → 2.7.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/dist/config.d.ts +25 -4
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +12 -36
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/pica-sdk.d.ts +1231 -0
- package/dist/pica-sdk.d.ts.map +1 -0
- package/dist/pica-sdk.js +1403 -0
- package/dist/pica-sdk.js.map +1 -0
- package/dist/prompts/index.d.ts +64 -64
- package/dist/prompts/index.js +24 -24
- package/dist/prompts/index.js.map +1 -1
- package/dist/resources/index.d.ts +53 -55
- package/dist/resources/index.d.ts.map +1 -1
- package/dist/resources/index.js +54 -133
- package/dist/resources/index.js.map +1 -1
- package/dist/server.d.ts +32 -49
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +14 -103
- package/dist/server.js.map +1 -1
- package/dist/tools/index.d.ts +37 -83
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +84 -442
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/people.d.ts +47 -39
- package/dist/tools/people.d.ts.map +1 -1
- package/dist/tools/people.js +109 -148
- package/dist/tools/people.js.map +1 -1
- package/dist/tools/recordings.d.ts +9 -9
- package/dist/tools/recordings.d.ts.map +1 -1
- package/dist/tools/recordings.js +48 -121
- package/dist/tools/recordings.js.map +1 -1
- package/dist/tools/search.d.ts +21 -21
- package/dist/tools/search.d.ts.map +1 -1
- package/dist/tools/search.js +3 -3
- package/dist/tools/search.js.map +1 -1
- package/dist/tools/works.d.ts +47 -39
- package/dist/tools/works.d.ts.map +1 -1
- package/dist/tools/works.js +116 -201
- package/dist/tools/works.js.map +1 -1
- package/dist/utils/errors.d.ts +29 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +115 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/formatting.d.ts +82 -0
- package/dist/utils/formatting.d.ts.map +1 -0
- package/dist/utils/formatting.js +125 -0
- package/dist/utils/formatting.js.map +1 -0
- package/package.json +1 -1
- package/server.json +1 -1
- package/dist/__mocks__/mppx-mcp-sdk-server.d.ts +0 -6
- package/dist/__mocks__/mppx-mcp-sdk-server.d.ts.map +0 -1
- package/dist/__mocks__/mppx-mcp-sdk-server.js +0 -6
- package/dist/__mocks__/mppx-mcp-sdk-server.js.map +0 -1
- package/dist/__mocks__/mppx-server.d.ts +0 -12
- package/dist/__mocks__/mppx-server.d.ts.map +0 -1
- package/dist/__mocks__/mppx-server.js +0 -12
- package/dist/__mocks__/mppx-server.js.map +0 -1
- package/dist/apps/download.d.ts +0 -2
- package/dist/apps/download.d.ts.map +0 -1
- package/dist/apps/download.js +0 -125
- package/dist/apps/download.js.map +0 -1
- package/dist/apps/generated/shared-bundle.d.ts +0 -5
- package/dist/apps/generated/shared-bundle.d.ts.map +0 -1
- package/dist/apps/generated/shared-bundle.js +0 -7
- package/dist/apps/generated/shared-bundle.js.map +0 -1
- package/dist/apps/shared.d.ts +0 -15
- package/dist/apps/shared.d.ts.map +0 -1
- package/dist/apps/shared.js +0 -480
- package/dist/apps/shared.js.map +0 -1
- package/dist/apps/upload.d.ts +0 -2
- package/dist/apps/upload.d.ts.map +0 -1
- package/dist/apps/upload.js +0 -280
- package/dist/apps/upload.js.map +0 -1
- package/dist/resources/llms-primer.d.ts +0 -2
- package/dist/resources/llms-primer.d.ts.map +0 -1
- package/dist/resources/llms-primer.js +0 -68
- package/dist/resources/llms-primer.js.map +0 -1
- package/dist/server-instructions.d.ts +0 -9
- package/dist/server-instructions.d.ts.map +0 -1
- package/dist/server-instructions.js +0 -34
- package/dist/server-instructions.js.map +0 -1
- package/dist/tools/agreement-types.d.ts +0 -27
- package/dist/tools/agreement-types.d.ts.map +0 -1
- package/dist/tools/agreement-types.js +0 -387
- package/dist/tools/agreement-types.js.map +0 -1
- package/dist/tools/agreements.d.ts +0 -20
- package/dist/tools/agreements.d.ts.map +0 -1
- package/dist/tools/agreements.js +0 -363
- package/dist/tools/agreements.js.map +0 -1
- package/dist/tools/analytics.d.ts +0 -20
- package/dist/tools/analytics.d.ts.map +0 -1
- package/dist/tools/analytics.js +0 -124
- package/dist/tools/analytics.js.map +0 -1
- package/dist/tools/app-tools.d.ts +0 -21
- package/dist/tools/app-tools.d.ts.map +0 -1
- package/dist/tools/app-tools.js +0 -248
- package/dist/tools/app-tools.js.map +0 -1
- package/dist/tools/assets.d.ts +0 -21
- package/dist/tools/assets.d.ts.map +0 -1
- package/dist/tools/assets.js +0 -441
- package/dist/tools/assets.js.map +0 -1
- package/dist/tools/audio-files.d.ts +0 -20
- package/dist/tools/audio-files.d.ts.map +0 -1
- package/dist/tools/audio-files.js +0 -384
- package/dist/tools/audio-files.js.map +0 -1
- package/dist/tools/auth.d.ts +0 -22
- package/dist/tools/auth.d.ts.map +0 -1
- package/dist/tools/auth.js +0 -210
- package/dist/tools/auth.js.map +0 -1
- package/dist/tools/bulk.d.ts +0 -16
- package/dist/tools/bulk.d.ts.map +0 -1
- package/dist/tools/bulk.js +0 -85
- package/dist/tools/bulk.js.map +0 -1
- package/dist/tools/calendar.d.ts +0 -15
- package/dist/tools/calendar.d.ts.map +0 -1
- package/dist/tools/calendar.js +0 -67
- package/dist/tools/calendar.js.map +0 -1
- package/dist/tools/collaborators.d.ts +0 -17
- package/dist/tools/collaborators.d.ts.map +0 -1
- package/dist/tools/collaborators.js +0 -131
- package/dist/tools/collaborators.js.map +0 -1
- package/dist/tools/comparisons.d.ts +0 -22
- package/dist/tools/comparisons.d.ts.map +0 -1
- package/dist/tools/comparisons.js +0 -78
- package/dist/tools/comparisons.js.map +0 -1
- package/dist/tools/credits.d.ts +0 -17
- package/dist/tools/credits.d.ts.map +0 -1
- package/dist/tools/credits.js +0 -312
- package/dist/tools/credits.js.map +0 -1
- package/dist/tools/dashboard.d.ts +0 -19
- package/dist/tools/dashboard.d.ts.map +0 -1
- package/dist/tools/dashboard.js +0 -146
- package/dist/tools/dashboard.js.map +0 -1
- package/dist/tools/directory.d.ts +0 -15
- package/dist/tools/directory.d.ts.map +0 -1
- package/dist/tools/directory.js +0 -106
- package/dist/tools/directory.js.map +0 -1
- package/dist/tools/discovery.d.ts +0 -28
- package/dist/tools/discovery.d.ts.map +0 -1
- package/dist/tools/discovery.js +0 -560
- package/dist/tools/discovery.js.map +0 -1
- package/dist/tools/disputes.d.ts +0 -18
- package/dist/tools/disputes.d.ts.map +0 -1
- package/dist/tools/disputes.js +0 -61
- package/dist/tools/disputes.js.map +0 -1
- package/dist/tools/documents.d.ts +0 -15
- package/dist/tools/documents.d.ts.map +0 -1
- package/dist/tools/documents.js +0 -36
- package/dist/tools/documents.js.map +0 -1
- package/dist/tools/duplicates.d.ts +0 -16
- package/dist/tools/duplicates.d.ts.map +0 -1
- package/dist/tools/duplicates.js +0 -87
- package/dist/tools/duplicates.js.map +0 -1
- package/dist/tools/enrichment.d.ts +0 -20
- package/dist/tools/enrichment.d.ts.map +0 -1
- package/dist/tools/enrichment.js +0 -154
- package/dist/tools/enrichment.js.map +0 -1
- package/dist/tools/exports.d.ts +0 -19
- package/dist/tools/exports.d.ts.map +0 -1
- package/dist/tools/exports.js +0 -175
- package/dist/tools/exports.js.map +0 -1
- package/dist/tools/import-documents.d.ts +0 -21
- package/dist/tools/import-documents.d.ts.map +0 -1
- package/dist/tools/import-documents.js +0 -203
- package/dist/tools/import-documents.js.map +0 -1
- package/dist/tools/import.d.ts +0 -30
- package/dist/tools/import.d.ts.map +0 -1
- package/dist/tools/import.js +0 -455
- package/dist/tools/import.js.map +0 -1
- package/dist/tools/integrations.d.ts +0 -15
- package/dist/tools/integrations.d.ts.map +0 -1
- package/dist/tools/integrations.js +0 -100
- package/dist/tools/integrations.js.map +0 -1
- package/dist/tools/licensing.d.ts +0 -40
- package/dist/tools/licensing.d.ts.map +0 -1
- package/dist/tools/licensing.js +0 -431
- package/dist/tools/licensing.js.map +0 -1
- package/dist/tools/memory.d.ts +0 -21
- package/dist/tools/memory.d.ts.map +0 -1
- package/dist/tools/memory.js +0 -116
- package/dist/tools/memory.js.map +0 -1
- package/dist/tools/metadata.d.ts +0 -15
- package/dist/tools/metadata.d.ts.map +0 -1
- package/dist/tools/metadata.js +0 -1069
- package/dist/tools/metadata.js.map +0 -1
- package/dist/tools/multimedia.d.ts +0 -19
- package/dist/tools/multimedia.d.ts.map +0 -1
- package/dist/tools/multimedia.js +0 -291
- package/dist/tools/multimedia.js.map +0 -1
- package/dist/tools/notes.d.ts +0 -21
- package/dist/tools/notes.d.ts.map +0 -1
- package/dist/tools/notes.js +0 -108
- package/dist/tools/notes.js.map +0 -1
- package/dist/tools/notifications.d.ts +0 -17
- package/dist/tools/notifications.d.ts.map +0 -1
- package/dist/tools/notifications.js +0 -117
- package/dist/tools/notifications.js.map +0 -1
- package/dist/tools/projects.d.ts +0 -19
- package/dist/tools/projects.d.ts.map +0 -1
- package/dist/tools/projects.js +0 -140
- package/dist/tools/projects.js.map +0 -1
- package/dist/tools/publishers.d.ts +0 -16
- package/dist/tools/publishers.d.ts.map +0 -1
- package/dist/tools/publishers.js +0 -69
- package/dist/tools/publishers.js.map +0 -1
- package/dist/tools/purchases.d.ts +0 -15
- package/dist/tools/purchases.d.ts.map +0 -1
- package/dist/tools/purchases.js +0 -63
- package/dist/tools/purchases.js.map +0 -1
- package/dist/tools/recovery-hints.d.ts +0 -14
- package/dist/tools/recovery-hints.d.ts.map +0 -1
- package/dist/tools/recovery-hints.js +0 -277
- package/dist/tools/recovery-hints.js.map +0 -1
- package/dist/tools/releases.d.ts +0 -18
- package/dist/tools/releases.d.ts.map +0 -1
- package/dist/tools/releases.js +0 -128
- package/dist/tools/releases.js.map +0 -1
- package/dist/tools/royalties.d.ts +0 -23
- package/dist/tools/royalties.d.ts.map +0 -1
- package/dist/tools/royalties.js +0 -257
- package/dist/tools/royalties.js.map +0 -1
- package/dist/tools/send.d.ts +0 -17
- package/dist/tools/send.d.ts.map +0 -1
- package/dist/tools/send.js +0 -185
- package/dist/tools/send.js.map +0 -1
- package/dist/tools/sessions.d.ts +0 -18
- package/dist/tools/sessions.d.ts.map +0 -1
- package/dist/tools/sessions.js +0 -115
- package/dist/tools/sessions.js.map +0 -1
- package/dist/tools/settings.d.ts +0 -18
- package/dist/tools/settings.d.ts.map +0 -1
- package/dist/tools/settings.js +0 -96
- package/dist/tools/settings.js.map +0 -1
- package/dist/tools/share-links.d.ts +0 -19
- package/dist/tools/share-links.d.ts.map +0 -1
- package/dist/tools/share-links.js +0 -121
- package/dist/tools/share-links.js.map +0 -1
- package/dist/tools/split-sheets.d.ts +0 -25
- package/dist/tools/split-sheets.d.ts.map +0 -1
- package/dist/tools/split-sheets.js +0 -307
- package/dist/tools/split-sheets.js.map +0 -1
- package/dist/tools/team.d.ts +0 -22
- package/dist/tools/team.d.ts.map +0 -1
- package/dist/tools/team.js +0 -134
- package/dist/tools/team.js.map +0 -1
- package/dist/tools/telegram.d.ts +0 -20
- package/dist/tools/telegram.d.ts.map +0 -1
- package/dist/tools/telegram.js +0 -88
- package/dist/tools/telegram.js.map +0 -1
- package/dist/tools/uploads.d.ts +0 -17
- package/dist/tools/uploads.d.ts.map +0 -1
- package/dist/tools/uploads.js +0 -156
- package/dist/tools/uploads.js.map +0 -1
package/dist/tools/credits.js
DELETED
|
@@ -1,312 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2024-2026 Withpica Ltd. All rights reserved.
|
|
2
|
-
import { formatSuccess, formatStructuredList, mapGapsToHints, } from "@withpica/mcp-utils";
|
|
3
|
-
import { notifyParties, summarizeNotifications, } from "@withpica/mcp-utils";
|
|
4
|
-
export class CreditsTools {
|
|
5
|
-
pica;
|
|
6
|
-
constructor(pica) {
|
|
7
|
-
this.pica = pica;
|
|
8
|
-
}
|
|
9
|
-
getTools() {
|
|
10
|
-
return [
|
|
11
|
-
{
|
|
12
|
-
definition: {
|
|
13
|
-
name: "pica_credits_balance",
|
|
14
|
-
description: "Check your current credit balance and see what each operation costs. " +
|
|
15
|
-
"Use this before triggering audio analysis or identification to check affordability. If balance is low, use pica_credits_purchase to generate a checkout link.",
|
|
16
|
-
inputSchema: {
|
|
17
|
-
type: "object",
|
|
18
|
-
properties: {},
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
executor: this.getBalance.bind(this),
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
definition: {
|
|
25
|
-
name: "pica_credits_list",
|
|
26
|
-
description: "Get all credits (collaborators, roles, and splits) for a specific work. Returns who wrote, composed, arranged, or produced the work and their percentage splits. " +
|
|
27
|
-
"→ then: pica_credits_update (fix credits), pica_people_inspect (inspect a credited person)",
|
|
28
|
-
inputSchema: {
|
|
29
|
-
type: "object",
|
|
30
|
-
properties: {
|
|
31
|
-
work_id: {
|
|
32
|
-
type: "string",
|
|
33
|
-
description: "The work ID to get credits for",
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
required: ["work_id"],
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
executor: this.listCredits.bind(this),
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
definition: {
|
|
43
|
-
name: "pica_credits_update",
|
|
44
|
-
description: "Set credits on a work. Replaces all existing credits. Splits must total 100%. " +
|
|
45
|
-
"15 roles: writer, composer, arranger, lyricist, producer, performer, engineer, mixer, mastering, owner, vocalist, instrumentalist, conductor, programmer, remixer. " +
|
|
46
|
-
"Supports publisher fields (publisher_name, publisher_ipi, publisher_split_percentage) and territory/rights metadata. " +
|
|
47
|
-
"IMPORTANT: After updating, call pica_credits_list to verify the credits actually persisted — silent failures are possible if roles are invalid. " +
|
|
48
|
-
"→ then: pica_credits_list (verify saved), pica_works_inspect (check progress)",
|
|
49
|
-
inputSchema: {
|
|
50
|
-
type: "object",
|
|
51
|
-
properties: {
|
|
52
|
-
work_id: {
|
|
53
|
-
type: "string",
|
|
54
|
-
description: "The work ID to set credits on",
|
|
55
|
-
},
|
|
56
|
-
credits: {
|
|
57
|
-
type: "array",
|
|
58
|
-
description: "Array of credit entries. Splits must total 100%.",
|
|
59
|
-
items: {
|
|
60
|
-
type: "object",
|
|
61
|
-
properties: {
|
|
62
|
-
person_id: {
|
|
63
|
-
type: "string",
|
|
64
|
-
description: "Person ID of the credited collaborator",
|
|
65
|
-
},
|
|
66
|
-
role: {
|
|
67
|
-
type: "string",
|
|
68
|
-
description: "Role: writer, composer, arranger, lyricist, producer, performer, engineer, mixer, mastering, owner, vocalist, instrumentalist, conductor, programmer, remixer",
|
|
69
|
-
enum: [
|
|
70
|
-
"writer",
|
|
71
|
-
"composer",
|
|
72
|
-
"arranger",
|
|
73
|
-
"lyricist",
|
|
74
|
-
"producer",
|
|
75
|
-
"performer",
|
|
76
|
-
"engineer",
|
|
77
|
-
"mixer",
|
|
78
|
-
"mastering",
|
|
79
|
-
"owner",
|
|
80
|
-
"vocalist",
|
|
81
|
-
"instrumentalist",
|
|
82
|
-
"conductor",
|
|
83
|
-
"programmer",
|
|
84
|
-
"remixer",
|
|
85
|
-
],
|
|
86
|
-
},
|
|
87
|
-
splits: {
|
|
88
|
-
type: "number",
|
|
89
|
-
description: "Percentage split (0-100). All splits must total 100%.",
|
|
90
|
-
},
|
|
91
|
-
publisher_name: {
|
|
92
|
-
type: "string",
|
|
93
|
-
description: "Publisher name for this credit (optional — for publishing credits)",
|
|
94
|
-
},
|
|
95
|
-
publisher_ipi: {
|
|
96
|
-
type: "string",
|
|
97
|
-
description: "Publisher's IPI number (9-11 digits)",
|
|
98
|
-
},
|
|
99
|
-
publisher_split_percentage: {
|
|
100
|
-
type: "number",
|
|
101
|
-
description: "Publisher's share percentage (0-100). Separate from writer split.",
|
|
102
|
-
},
|
|
103
|
-
territory: {
|
|
104
|
-
type: "array",
|
|
105
|
-
items: { type: "string" },
|
|
106
|
-
description: 'Territories where this credit applies (e.g., ["worldwide"], ["UK", "US"]). Default: ["worldwide"].',
|
|
107
|
-
},
|
|
108
|
-
rights_type: {
|
|
109
|
-
type: "string",
|
|
110
|
-
enum: [
|
|
111
|
-
"all",
|
|
112
|
-
"performing",
|
|
113
|
-
"mechanical",
|
|
114
|
-
"synchronization",
|
|
115
|
-
],
|
|
116
|
-
description: "Type of rights covered. Default: all.",
|
|
117
|
-
},
|
|
118
|
-
start_date: {
|
|
119
|
-
type: "string",
|
|
120
|
-
description: "When rights start (ISO date). Null = from inception.",
|
|
121
|
-
},
|
|
122
|
-
end_date: {
|
|
123
|
-
type: "string",
|
|
124
|
-
description: "When rights end (ISO date). Null = perpetual.",
|
|
125
|
-
},
|
|
126
|
-
},
|
|
127
|
-
required: ["person_id", "role", "splits"],
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
required: ["work_id", "credits"],
|
|
132
|
-
},
|
|
133
|
-
},
|
|
134
|
-
executor: this.updateCredits.bind(this),
|
|
135
|
-
},
|
|
136
|
-
];
|
|
137
|
-
}
|
|
138
|
-
async getBalance(_args) {
|
|
139
|
-
const result = await this.pica.creditsBalance.getBalance();
|
|
140
|
-
const balance = result.balance ?? 0;
|
|
141
|
-
const costs = result.credit_costs ?? [];
|
|
142
|
-
const costSummary = costs
|
|
143
|
-
.map((c) => `${c.action_key}: ${c.credits_required} credit(s)`)
|
|
144
|
-
.join(", ");
|
|
145
|
-
return formatSuccess(`Credit balance: ${balance}. Operations: ${costSummary}`, result);
|
|
146
|
-
}
|
|
147
|
-
async listCredits(args) {
|
|
148
|
-
// Fetch both publishing collaborators and recording credits
|
|
149
|
-
const [collabSettled, creditsSettled] = await Promise.allSettled([
|
|
150
|
-
this.pica.credits.listCollaborators(args.work_id),
|
|
151
|
-
this.pica.credits.listForWork(args.work_id),
|
|
152
|
-
]);
|
|
153
|
-
const collaborators = collabSettled.status === "fulfilled"
|
|
154
|
-
? collabSettled.value
|
|
155
|
-
: { collaborators: [], count: 0 };
|
|
156
|
-
const recordingCredits = creditsSettled.status === "fulfilled" ? creditsSettled.value : [];
|
|
157
|
-
// Merge both into a single list
|
|
158
|
-
const collabArray = Array.isArray(collaborators)
|
|
159
|
-
? collaborators
|
|
160
|
-
: collaborators?.collaborators || [];
|
|
161
|
-
const creditArray = Array.isArray(recordingCredits)
|
|
162
|
-
? recordingCredits
|
|
163
|
-
: recordingCredits?.credits || [];
|
|
164
|
-
const allCredits = [...collabArray, ...creditArray];
|
|
165
|
-
return formatStructuredList(allCredits, "credit", {
|
|
166
|
-
work_id: args.work_id,
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
async updateCredits(args) {
|
|
170
|
-
// Validate splits total 100% before saving
|
|
171
|
-
const splitTotal = args.credits.reduce((sum, c) => sum + (c.splits || 0), 0);
|
|
172
|
-
if (splitTotal !== 100) {
|
|
173
|
-
return {
|
|
174
|
-
content: [
|
|
175
|
-
{
|
|
176
|
-
type: "text",
|
|
177
|
-
text: `Splits total ${splitTotal}%, must be exactly 100%. Adjust the splits and try again.`,
|
|
178
|
-
},
|
|
179
|
-
],
|
|
180
|
-
isError: true,
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
// Split credits by role type: publishing roles → /collaborators, recording roles → /credits
|
|
184
|
-
const PUBLISHING_ROLES = new Set([
|
|
185
|
-
"writer",
|
|
186
|
-
"composer",
|
|
187
|
-
"lyricist",
|
|
188
|
-
"arranger",
|
|
189
|
-
]);
|
|
190
|
-
const allCredits = args.credits.map((c) => {
|
|
191
|
-
const credit = {
|
|
192
|
-
person_id: c.person_id,
|
|
193
|
-
role: c.role,
|
|
194
|
-
splits: c.splits || 0,
|
|
195
|
-
};
|
|
196
|
-
if (c.publisher_name)
|
|
197
|
-
credit.publisher_name = c.publisher_name;
|
|
198
|
-
if (c.publisher_ipi)
|
|
199
|
-
credit.publisher_ipi = c.publisher_ipi;
|
|
200
|
-
if (c.publisher_split_percentage !== undefined)
|
|
201
|
-
credit.publisher_split_percentage = c.publisher_split_percentage;
|
|
202
|
-
if (c.territory)
|
|
203
|
-
credit.territory = c.territory;
|
|
204
|
-
if (c.rights_type)
|
|
205
|
-
credit.rights_type = c.rights_type;
|
|
206
|
-
if (c.start_date)
|
|
207
|
-
credit.start_date = c.start_date;
|
|
208
|
-
if (c.end_date)
|
|
209
|
-
credit.end_date = c.end_date;
|
|
210
|
-
return credit;
|
|
211
|
-
});
|
|
212
|
-
const publishingCredits = allCredits.filter((c) => PUBLISHING_ROLES.has(String(c.role || "writer")
|
|
213
|
-
.split(", ")[0]
|
|
214
|
-
.trim()));
|
|
215
|
-
const recordingCredits = allCredits.filter((c) => !PUBLISHING_ROLES.has(String(c.role || "writer")
|
|
216
|
-
.split(", ")[0]
|
|
217
|
-
.trim()));
|
|
218
|
-
let credits;
|
|
219
|
-
// Route to correct endpoint(s)
|
|
220
|
-
if (publishingCredits.length > 0 && recordingCredits.length > 0) {
|
|
221
|
-
// Mixed — call both endpoints, use allSettled so a partial failure is reported not silently swallowed
|
|
222
|
-
const [pubSettled, recSettled] = await Promise.allSettled([
|
|
223
|
-
this.pica.credits.updateCollaborators(args.work_id, {
|
|
224
|
-
credits: publishingCredits,
|
|
225
|
-
}),
|
|
226
|
-
this.pica.credits.updateForWork(args.work_id, {
|
|
227
|
-
credits: recordingCredits,
|
|
228
|
-
}),
|
|
229
|
-
]);
|
|
230
|
-
const pubResult = pubSettled.status === "fulfilled" ? pubSettled.value : null;
|
|
231
|
-
const recResult = recSettled.status === "fulfilled" ? recSettled.value : null;
|
|
232
|
-
const pubError = pubSettled.status === "rejected"
|
|
233
|
-
? pubSettled.reason
|
|
234
|
-
: null;
|
|
235
|
-
const recError = recSettled.status === "rejected"
|
|
236
|
-
? recSettled.reason
|
|
237
|
-
: null;
|
|
238
|
-
if (pubError && recError) {
|
|
239
|
-
return {
|
|
240
|
-
content: [
|
|
241
|
-
{
|
|
242
|
-
type: "text",
|
|
243
|
-
text: `both publishing and recording credits failed to save — publishing error: ${pubError?.message ?? pubError}, recording error: ${recError?.message ?? recError}`,
|
|
244
|
-
},
|
|
245
|
-
],
|
|
246
|
-
isError: true,
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
if (pubError) {
|
|
250
|
-
return {
|
|
251
|
-
content: [
|
|
252
|
-
{
|
|
253
|
-
type: "text",
|
|
254
|
-
text: `recording credits updated, but publishing credits failed — ${pubError?.message ?? pubError}. retry the publishing portion.`,
|
|
255
|
-
},
|
|
256
|
-
],
|
|
257
|
-
isError: true,
|
|
258
|
-
};
|
|
259
|
-
}
|
|
260
|
-
if (recError) {
|
|
261
|
-
return {
|
|
262
|
-
content: [
|
|
263
|
-
{
|
|
264
|
-
type: "text",
|
|
265
|
-
text: `publishing credits updated, but recording credits failed — ${recError?.message ?? recError}. retry the recording portion.`,
|
|
266
|
-
},
|
|
267
|
-
],
|
|
268
|
-
isError: true,
|
|
269
|
-
};
|
|
270
|
-
}
|
|
271
|
-
credits = { collaborators: pubResult, credits: recResult };
|
|
272
|
-
}
|
|
273
|
-
else if (publishingCredits.length > 0) {
|
|
274
|
-
credits = await this.pica.credits.updateCollaborators(args.work_id, {
|
|
275
|
-
credits: publishingCredits,
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
|
-
else {
|
|
279
|
-
credits = await this.pica.credits.updateForWork(args.work_id, {
|
|
280
|
-
credits: recordingCredits,
|
|
281
|
-
});
|
|
282
|
-
}
|
|
283
|
-
// Check completeness for hints about next steps
|
|
284
|
-
const hints = [];
|
|
285
|
-
try {
|
|
286
|
-
const completeness = await this.pica.health.getWorkCompleteness(args.work_id);
|
|
287
|
-
hints.push(...mapGapsToHints(completeness?.gaps || completeness?.missing || [], 3));
|
|
288
|
-
}
|
|
289
|
-
catch {
|
|
290
|
-
// Best-effort
|
|
291
|
-
}
|
|
292
|
-
// Notify all credited people about their credit
|
|
293
|
-
const parties = args.credits
|
|
294
|
-
.filter((c) => c.person_id)
|
|
295
|
-
.map((c) => ({
|
|
296
|
-
person_id: c.person_id,
|
|
297
|
-
message: `you've been credited as ${c.role || "writer"} (${c.splits || 0}%) on a work — please verify`,
|
|
298
|
-
work_id: args.work_id,
|
|
299
|
-
notification_type: "credit_added",
|
|
300
|
-
}));
|
|
301
|
-
let notifySummary = "";
|
|
302
|
-
if (parties.length > 0) {
|
|
303
|
-
const results = await notifyParties(this.pica, parties);
|
|
304
|
-
notifySummary = summarizeNotifications(results);
|
|
305
|
-
}
|
|
306
|
-
const msg = notifySummary
|
|
307
|
-
? `Credits updated. ${notifySummary}`
|
|
308
|
-
: "Credits updated successfully";
|
|
309
|
-
return formatSuccess(msg, credits, hints);
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
//# sourceMappingURL=credits.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"credits.js","sourceRoot":"","sources":["../../src/tools/credits.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAQ7D,OAAO,EAEL,aAAa,EACb,oBAAoB,EAEpB,cAAc,GACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,aAAa,EACb,sBAAsB,GAEvB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,OAAO,YAAY;IACf,IAAI,CAAa;IAEzB,YAAY,IAAgB;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,QAAQ;QACN,OAAO;YACL;gBACE,UAAU,EAAE;oBACV,IAAI,EAAE,sBAAsB;oBAC5B,WAAW,EACT,uEAAuE;wBACvE,+JAA+J;oBACjK,WAAW,EAAE;wBACX,IAAI,EAAE,QAAQ;wBACd,UAAU,EAAE,EAAE;qBACf;iBACF;gBACD,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC;aACrC;YACD;gBACE,UAAU,EAAE;oBACV,IAAI,EAAE,mBAAmB;oBACzB,WAAW,EACT,mKAAmK;wBACnK,4FAA4F;oBAC9F,WAAW,EAAE;wBACX,IAAI,EAAE,QAAQ;wBACd,UAAU,EAAE;4BACV,OAAO,EAAE;gCACP,IAAI,EAAE,QAAQ;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sBAAsB,CAAC,OAAO,CAAC,CAAC;QAClD,CAAC;QAED,MAAM,GAAG,GAAG,aAAa;YACvB,CAAC,CAAC,oBAAoB,aAAa,EAAE;YACrC,CAAC,CAAC,8BAA8B,CAAC;QACnC,OAAO,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IAC5C,CAAC;CACF"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Dashboard & Discovery Tools — surface what needs attention, what PICA found, and daily briefings
|
|
3
|
-
*/
|
|
4
|
-
import { PicaClient } from "@withpica/mcp-sdk";
|
|
5
|
-
import { ToolDefinition, ToolExecutor } from "./index.js";
|
|
6
|
-
export declare class DashboardTools {
|
|
7
|
-
private pica;
|
|
8
|
-
constructor(pica: PicaClient);
|
|
9
|
-
getTools(): Array<{
|
|
10
|
-
definition: ToolDefinition;
|
|
11
|
-
executor: ToolExecutor;
|
|
12
|
-
}>;
|
|
13
|
-
private queryDiscoveries;
|
|
14
|
-
private reviewDiscovery;
|
|
15
|
-
private attentionItems;
|
|
16
|
-
private briefing;
|
|
17
|
-
private pulse;
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=dashboard.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dashboard.d.ts","sourceRoot":"","sources":["../../src/tools/dashboard.ts"],"names":[],"mappings":"AAEA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,YAAY,EAAc,MAAM,YAAY,CAAC;AAOtE,qBAAa,cAAc;IACzB,OAAO,CAAC,IAAI,CAAa;gBAEb,IAAI,EAAE,UAAU;IAI5B,QAAQ,IAAI,KAAK,CAAC;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,QAAQ,EAAE,YAAY,CAAA;KAAE,CAAC;YA2G3D,gBAAgB;YA8BhB,eAAe;YAaf,cAAc;YAYd,QAAQ;YAMR,KAAK;CAIpB"}
|
package/dist/tools/dashboard.js
DELETED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2024-2026 Withpica Ltd. All rights reserved.
|
|
2
|
-
import { formatAsText, formatSuccess, formatStructuredList, } from "@withpica/mcp-utils";
|
|
3
|
-
export class DashboardTools {
|
|
4
|
-
pica;
|
|
5
|
-
constructor(pica) {
|
|
6
|
-
this.pica = pica;
|
|
7
|
-
}
|
|
8
|
-
getTools() {
|
|
9
|
-
return [
|
|
10
|
-
// --- Discoveries ---
|
|
11
|
-
{
|
|
12
|
-
definition: {
|
|
13
|
-
name: "pica_discoveries_query",
|
|
14
|
-
description: "Query discoveries — system-computed findings like ISRC matches, " +
|
|
15
|
-
"duplicate detection, enrichment opportunities, and registration gaps. " +
|
|
16
|
-
"Filter by status to see all, pending (needing review), or reviewed items.",
|
|
17
|
-
inputSchema: {
|
|
18
|
-
type: "object",
|
|
19
|
-
properties: {
|
|
20
|
-
status: {
|
|
21
|
-
type: "string",
|
|
22
|
-
enum: ["all", "pending", "reviewed"],
|
|
23
|
-
description: "Filter by status: 'all' for everything, 'pending' for items needing review, 'reviewed' for already-handled (default: all)",
|
|
24
|
-
},
|
|
25
|
-
limit: {
|
|
26
|
-
type: "number",
|
|
27
|
-
description: "Max results (default 50)",
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
executor: this.queryDiscoveries.bind(this),
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
definition: {
|
|
36
|
-
name: "pica_discoveries_review",
|
|
37
|
-
description: "Accept or reject a pending discovery. " +
|
|
38
|
-
"Accepted discoveries update your catalog automatically.",
|
|
39
|
-
inputSchema: {
|
|
40
|
-
type: "object",
|
|
41
|
-
properties: {
|
|
42
|
-
discovery_id: {
|
|
43
|
-
type: "string",
|
|
44
|
-
description: "The discovery ID to review",
|
|
45
|
-
},
|
|
46
|
-
status: {
|
|
47
|
-
type: "string",
|
|
48
|
-
enum: ["accepted", "rejected"],
|
|
49
|
-
description: "Accept or reject the discovery",
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
required: ["discovery_id", "status"],
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
executor: this.reviewDiscovery.bind(this),
|
|
56
|
-
},
|
|
57
|
-
// --- Dashboard ---
|
|
58
|
-
{
|
|
59
|
-
definition: {
|
|
60
|
-
name: "pica_dashboard_attention",
|
|
61
|
-
description: "What needs my attention? Shows items requiring action — " +
|
|
62
|
-
"incomplete works, unsigned agreements, overdue tasks, " +
|
|
63
|
-
"pending invites, and quality issues.",
|
|
64
|
-
inputSchema: {
|
|
65
|
-
type: "object",
|
|
66
|
-
properties: {
|
|
67
|
-
door: {
|
|
68
|
-
type: "string",
|
|
69
|
-
enum: ["respond", "catalog"],
|
|
70
|
-
description: "Focus area: 'respond' for urgent items, 'catalog' for data quality",
|
|
71
|
-
},
|
|
72
|
-
limit: {
|
|
73
|
-
type: "number",
|
|
74
|
-
description: "Max items (default 10)",
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
executor: this.attentionItems.bind(this),
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
definition: {
|
|
83
|
-
name: "pica_dashboard_briefing",
|
|
84
|
-
description: "Get your daily briefing — a summary of catalog health, " +
|
|
85
|
-
"recent activity, upcoming deadlines, and recommended actions.",
|
|
86
|
-
inputSchema: {
|
|
87
|
-
type: "object",
|
|
88
|
-
properties: {},
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
executor: this.briefing.bind(this),
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
definition: {
|
|
95
|
-
name: "pica_dashboard_pulse",
|
|
96
|
-
description: "Get the pulse of your catalog — works needing attention, " +
|
|
97
|
-
"upcoming deadlines, provenance status, and background task progress.",
|
|
98
|
-
inputSchema: {
|
|
99
|
-
type: "object",
|
|
100
|
-
properties: {},
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
executor: this.pulse.bind(this),
|
|
104
|
-
},
|
|
105
|
-
];
|
|
106
|
-
}
|
|
107
|
-
async queryDiscoveries(args) {
|
|
108
|
-
const status = args.status || "all";
|
|
109
|
-
// "pending" delegates to the dedicated pending endpoint
|
|
110
|
-
if (status === "pending") {
|
|
111
|
-
const result = await this.pica.dashboard.pendingDiscoveries();
|
|
112
|
-
const items = result?.data || result || [];
|
|
113
|
-
return formatStructuredList(Array.isArray(items) ? items : [], "pending discovery");
|
|
114
|
-
}
|
|
115
|
-
// "all" or "reviewed" use the general discoveries endpoint
|
|
116
|
-
const result = await this.pica.dashboard.discoveries({
|
|
117
|
-
unread: status === "all" ? undefined : false,
|
|
118
|
-
limit: args.limit,
|
|
119
|
-
});
|
|
120
|
-
const items = result?.data || result || [];
|
|
121
|
-
const unreadCount = result?.unreadCount ?? 0;
|
|
122
|
-
return formatStructuredList(Array.isArray(items) ? items : [], "discovery", { unreadCount });
|
|
123
|
-
}
|
|
124
|
-
async reviewDiscovery(args) {
|
|
125
|
-
const result = await this.pica.dashboard.reviewDiscovery(args.discovery_id, args.status);
|
|
126
|
-
return formatSuccess(`Discovery ${args.discovery_id} ${args.status}`, result);
|
|
127
|
-
}
|
|
128
|
-
async attentionItems(args) {
|
|
129
|
-
const result = await this.pica.dashboard.attentionItems({
|
|
130
|
-
door: args.door,
|
|
131
|
-
limit: args.limit,
|
|
132
|
-
});
|
|
133
|
-
const items = result?.data?.items || result?.items || [];
|
|
134
|
-
return formatStructuredList(Array.isArray(items) ? items : [], "attention item");
|
|
135
|
-
}
|
|
136
|
-
async briefing(_args) {
|
|
137
|
-
const result = await this.pica.dashboard.briefing();
|
|
138
|
-
const insights = result?.data?.insights || result?.insights || result;
|
|
139
|
-
return formatSuccess("Daily briefing", insights);
|
|
140
|
-
}
|
|
141
|
-
async pulse(_args) {
|
|
142
|
-
const result = await this.pica.dashboard.pulse();
|
|
143
|
-
return formatAsText(result);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
//# sourceMappingURL=dashboard.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dashboard.js","sourceRoot":"","sources":["../../src/tools/dashboard.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAQ7D,OAAO,EACL,YAAY,EACZ,aAAa,EACb,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,OAAO,cAAc;IACjB,IAAI,CAAa;IAEzB,YAAY,IAAgB;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,QAAQ;QACN,OAAO;YACL,sBAAsB;YACtB;gBACE,UAAU,EAAE;oBACV,IAAI,EAAE,wBAAwB;oBAC9B,WAAW,EACT,kEAAkE;wBAClE,wEAAwE;wBACxE,2EAA2E;oBAC7E,WAAW,EAAE;wBACX,IAAI,EAAE,QAAQ;wBACd,UAAU,EAAE;4BACV,MAAM,EAAE;gCACN,IAAI,EAAE,QAAQ;gCACd,IAAI,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,UAAU,CAAC;gCACpC,WAAW,EACT,2HAA2H;6BAC9H;4BACD,KAAK,EAAE;gCACL,IAAI,EAAE,QAAQ;gCACd,WAAW,EAAE,0BAA0B;6BACxC;yBACF;qBACF;iBACF;gBACD,QAAQ,EAAE,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC;aAC3C;YACD;gBACE,UAAU,EAAE;oBACV,IAAI,EAAE,yBAAyB;oBAC/B,WAAW,EACT,wCAAwC;wBACxC,yDAAyD;oBAC3D,WAAW,EAAE;wBACX,IAAI,EAAE,QAAQ;wBACd,UAAU,EAAE;4BACV,YAAY,EAAE;gCACZ,IAAI,EAAE,QAAQ;gCACd,WAAW,EAAE,4BAA4B;6BAC1C;4BACD,MAAM,EAAE;gCACN,IAAI,EAAE,QAAQ;gCACd,IAAI,EAAE,CAAC,UAAU,EAAE,UAAU,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C;IACJ,CAAC;IAEO,KAAK,CAAC,cAAc,CAAC,IAAyB;QACpD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC;YACtD,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,KAAK,EAAE,IAAI,CAAC,KAAK;SAClB,CAAC,CAAC;QACH,MAAM,KAAK,GAAG,MAAM,EAAE,IAAI,EAAE,KAAK,IAAI,MAAM,EAAE,KAAK,IAAI,EAAE,CAAC;QACzD,OAAO,oBAAoB,CACzB,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EACjC,gBAAgB,CACjB,CAAC;IACJ,CAAC;IAEO,KAAK,CAAC,QAAQ,CAAC,KAA0B;QAC/C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;QACpD,MAAM,QAAQ,GAAG,MAAM,EAAE,IAAI,EAAE,QAAQ,IAAI,MAAM,EAAE,QAAQ,IAAI,MAAM,CAAC;QACtE,OAAO,aAAa,CAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAC;IACnD,CAAC;IAEO,KAAK,CAAC,KAAK,CAAC,KAA0B;QAC5C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;QACjD,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC;CACF"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Directory Tools — manage directory visibility and settings
|
|
3
|
-
*/
|
|
4
|
-
import { PicaClient } from "@withpica/mcp-sdk";
|
|
5
|
-
import { ToolDefinition, ToolExecutor } from "./index.js";
|
|
6
|
-
export declare class DirectoryTools {
|
|
7
|
-
private pica;
|
|
8
|
-
constructor(pica: PicaClient);
|
|
9
|
-
getTools(): Array<{
|
|
10
|
-
definition: ToolDefinition;
|
|
11
|
-
executor: ToolExecutor;
|
|
12
|
-
}>;
|
|
13
|
-
private directorySettings;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=directory.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"directory.d.ts","sourceRoot":"","sources":["../../src/tools/directory.ts"],"names":[],"mappings":"AAEA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG1D,qBAAa,cAAc;IACzB,OAAO,CAAC,IAAI,CAAa;gBAEb,IAAI,EAAE,UAAU;IAI5B,QAAQ,IAAI,KAAK,CAAC;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,QAAQ,EAAE,YAAY,CAAA;KAAE,CAAC;YA6D3D,iBAAiB;CAkDhC"}
|
package/dist/tools/directory.js
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2024-2026 Withpica Ltd. All rights reserved.
|
|
2
|
-
import { formatAsText, formatSuccess } from "@withpica/mcp-utils";
|
|
3
|
-
export class DirectoryTools {
|
|
4
|
-
pica;
|
|
5
|
-
constructor(pica) {
|
|
6
|
-
this.pica = pica;
|
|
7
|
-
}
|
|
8
|
-
getTools() {
|
|
9
|
-
return [
|
|
10
|
-
{
|
|
11
|
-
definition: {
|
|
12
|
-
name: "pica_directory_settings",
|
|
13
|
-
description: "Get or update your organisation's directory visibility settings. " +
|
|
14
|
-
"Controls whether your catalogue appears in the PICA public directory " +
|
|
15
|
-
"and what information is shown (audio previews, splits, publishers, etc.).",
|
|
16
|
-
inputSchema: {
|
|
17
|
-
type: "object",
|
|
18
|
-
properties: {
|
|
19
|
-
action: {
|
|
20
|
-
type: "string",
|
|
21
|
-
enum: ["get", "update"],
|
|
22
|
-
description: "Action to perform. 'get' returns current settings. 'update' changes settings.",
|
|
23
|
-
},
|
|
24
|
-
opted_in: {
|
|
25
|
-
type: "boolean",
|
|
26
|
-
description: "Make catalogue discoverable in the PICA directory. " +
|
|
27
|
-
"When true, sync supervisors and AI agents can find your recordings.",
|
|
28
|
-
},
|
|
29
|
-
show_audio_preview: {
|
|
30
|
-
type: "boolean",
|
|
31
|
-
description: "Allow audio previews in directory listings. " +
|
|
32
|
-
"When true, visitors can listen to your tracks.",
|
|
33
|
-
},
|
|
34
|
-
show_splits: {
|
|
35
|
-
type: "boolean",
|
|
36
|
-
description: "Show credit split percentages in directory.",
|
|
37
|
-
},
|
|
38
|
-
show_publishers: {
|
|
39
|
-
type: "boolean",
|
|
40
|
-
description: "Show publisher information in directory.",
|
|
41
|
-
},
|
|
42
|
-
show_agreements: {
|
|
43
|
-
type: "boolean",
|
|
44
|
-
description: "Show agreement details in directory.",
|
|
45
|
-
},
|
|
46
|
-
show_stems: {
|
|
47
|
-
type: "boolean",
|
|
48
|
-
description: "Show stems/instrumentals in directory.",
|
|
49
|
-
},
|
|
50
|
-
contact_enabled: {
|
|
51
|
-
type: "boolean",
|
|
52
|
-
description: "Allow licensing enquiries from the directory. " +
|
|
53
|
-
"When true, supervisors can send enquiries directly.",
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
required: ["action"],
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
executor: this.directorySettings.bind(this),
|
|
60
|
-
},
|
|
61
|
-
];
|
|
62
|
-
}
|
|
63
|
-
async directorySettings(args) {
|
|
64
|
-
if (args.action === "get") {
|
|
65
|
-
const result = await this.pica.directory.getSettings();
|
|
66
|
-
const s = result.settings;
|
|
67
|
-
const status = s.opted_in ? "discoverable" : "private";
|
|
68
|
-
const summary = [
|
|
69
|
-
`Directory status: ${status}`,
|
|
70
|
-
`Eligible works: ${result.eligible_work_count}`,
|
|
71
|
-
s.show_audio_preview ? "Audio preview: on" : "Audio preview: off",
|
|
72
|
-
s.contact_enabled ? "Enquiries: on" : "Enquiries: off",
|
|
73
|
-
s.show_splits ? "Splits: visible" : "Splits: hidden",
|
|
74
|
-
s.show_publishers ? "Publishers: visible" : "Publishers: hidden",
|
|
75
|
-
].join("\n");
|
|
76
|
-
return {
|
|
77
|
-
content: [{ type: "text", text: summary }],
|
|
78
|
-
structuredContent: result,
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
// Update
|
|
82
|
-
const updates = {};
|
|
83
|
-
const boolFields = [
|
|
84
|
-
"opted_in",
|
|
85
|
-
"show_audio_preview",
|
|
86
|
-
"show_splits",
|
|
87
|
-
"show_publishers",
|
|
88
|
-
"show_agreements",
|
|
89
|
-
"show_stems",
|
|
90
|
-
"contact_enabled",
|
|
91
|
-
];
|
|
92
|
-
for (const field of boolFields) {
|
|
93
|
-
if (args[field] !== undefined)
|
|
94
|
-
updates[field] = Boolean(args[field]);
|
|
95
|
-
}
|
|
96
|
-
if (Object.keys(updates).length === 0) {
|
|
97
|
-
return formatAsText({
|
|
98
|
-
error: "No settings to update. Provide at least one setting field.",
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
const result = await this.pica.directory.updateSettings(updates);
|
|
102
|
-
const status = result.opted_in ? "discoverable" : "private";
|
|
103
|
-
return formatSuccess(`Directory settings updated. Your catalogue is now ${status}.`, result);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
//# sourceMappingURL=directory.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"directory.js","sourceRoot":"","sources":["../../src/tools/directory.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAQ7D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAElE,MAAM,OAAO,cAAc;IACjB,IAAI,CAAa;IAEzB,YAAY,IAAgB;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,QAAQ;QACN,OAAO;YACL;gBACE,UAAU,EAAE;oBACV,IAAI,EAAE,yBAAyB;oBAC/B,WAAW,EACT,mEAAmE;w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