@withpica/mcp-server 2.5.1 → 2.5.4
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/assets/fonts/GeistSans-Light.woff2 +0 -0
- package/assets/fonts/InstrumentSerif-Italic.woff2 +0 -0
- package/assets/fonts/InstrumentSerif-Regular.woff2 +0 -0
- package/dist/apps/briefing.d.ts +2 -0
- package/dist/apps/briefing.d.ts.map +1 -0
- package/dist/apps/briefing.js +308 -0
- package/dist/apps/briefing.js.map +1 -0
- package/dist/apps/generated/shared-bundle.d.ts +5 -0
- package/dist/apps/generated/shared-bundle.d.ts.map +1 -0
- package/dist/apps/generated/shared-bundle.js +7 -0
- package/dist/apps/generated/shared-bundle.js.map +1 -0
- package/dist/apps/shared.d.ts +4 -0
- package/dist/apps/shared.d.ts.map +1 -0
- package/dist/apps/shared.js +268 -0
- package/dist/apps/shared.js.map +1 -0
- package/dist/config.d.ts +3 -25
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +25 -12
- package/dist/config.js.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/pica-sdk.d.ts +11 -0
- package/dist/pica-sdk.d.ts.map +1 -1
- package/dist/pica-sdk.js +16 -0
- package/dist/pica-sdk.js.map +1 -1
- package/dist/prompts/index.js +24 -24
- package/dist/prompts/index.js.map +1 -1
- package/dist/resources/index.d.ts +3 -1
- package/dist/resources/index.d.ts.map +1 -1
- package/dist/resources/index.js +101 -53
- package/dist/resources/index.js.map +1 -1
- package/dist/resources/llms-primer.d.ts +1 -1
- package/dist/resources/llms-primer.d.ts.map +1 -1
- package/dist/resources/llms-primer.js +4 -4
- package/dist/server-instructions.d.ts +9 -0
- package/dist/server-instructions.d.ts.map +1 -0
- package/dist/server-instructions.js +34 -0
- package/dist/server-instructions.js.map +1 -0
- package/dist/server.d.ts +4 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +30 -8
- package/dist/server.js.map +1 -1
- package/dist/tools/agreement-types.d.ts +9 -19
- package/dist/tools/agreement-types.d.ts.map +1 -1
- package/dist/tools/agreement-types.js +201 -417
- package/dist/tools/agreement-types.js.map +1 -1
- package/dist/tools/agreements.d.ts +2 -3
- package/dist/tools/agreements.d.ts.map +1 -1
- package/dist/tools/agreements.js +71 -51
- package/dist/tools/agreements.js.map +1 -1
- package/dist/tools/app-tools.d.ts +18 -0
- package/dist/tools/app-tools.d.ts.map +1 -0
- package/dist/tools/app-tools.js +87 -0
- package/dist/tools/app-tools.js.map +1 -0
- package/dist/tools/assets.d.ts +1 -3
- package/dist/tools/assets.d.ts.map +1 -1
- package/dist/tools/assets.js +63 -45
- package/dist/tools/assets.js.map +1 -1
- package/dist/tools/audio-files.d.ts +2 -3
- package/dist/tools/audio-files.d.ts.map +1 -1
- package/dist/tools/audio-files.js +61 -33
- package/dist/tools/audio-files.js.map +1 -1
- package/dist/tools/auth.d.ts +20 -0
- package/dist/tools/auth.d.ts.map +1 -0
- package/dist/tools/auth.js +195 -0
- package/dist/tools/auth.js.map +1 -0
- package/dist/tools/collaborators.js +1 -1
- package/dist/tools/collaborators.js.map +1 -1
- package/dist/tools/credits.d.ts.map +1 -1
- package/dist/tools/credits.js +129 -18
- package/dist/tools/credits.js.map +1 -1
- package/dist/tools/dashboard.d.ts +1 -2
- package/dist/tools/dashboard.d.ts.map +1 -1
- package/dist/tools/dashboard.js +19 -27
- package/dist/tools/dashboard.js.map +1 -1
- package/dist/tools/duplicates.d.ts.map +1 -1
- package/dist/tools/duplicates.js +15 -0
- package/dist/tools/duplicates.js.map +1 -1
- package/dist/tools/enrichment.d.ts +0 -3
- package/dist/tools/enrichment.d.ts.map +1 -1
- package/dist/tools/enrichment.js +17 -120
- package/dist/tools/enrichment.js.map +1 -1
- package/dist/tools/import-documents.d.ts +3 -3
- package/dist/tools/import-documents.d.ts.map +1 -1
- package/dist/tools/import-documents.js +64 -50
- package/dist/tools/import-documents.js.map +1 -1
- package/dist/tools/import.d.ts +1 -0
- package/dist/tools/import.d.ts.map +1 -1
- package/dist/tools/import.js +63 -1
- package/dist/tools/import.js.map +1 -1
- package/dist/tools/index.d.ts +44 -3
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +410 -81
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/metadata.d.ts +15 -0
- package/dist/tools/metadata.d.ts.map +1 -0
- package/dist/tools/metadata.js +1057 -0
- package/dist/tools/metadata.js.map +1 -0
- package/dist/tools/people.d.ts +4 -12
- package/dist/tools/people.d.ts.map +1 -1
- package/dist/tools/people.js +151 -109
- package/dist/tools/people.js.map +1 -1
- package/dist/tools/publishers.d.ts +16 -0
- package/dist/tools/publishers.d.ts.map +1 -0
- package/dist/tools/publishers.js +69 -0
- package/dist/tools/publishers.js.map +1 -0
- package/dist/tools/recordings.d.ts +8 -8
- package/dist/tools/recordings.d.ts.map +1 -1
- package/dist/tools/recordings.js +123 -48
- package/dist/tools/recordings.js.map +1 -1
- package/dist/tools/recovery-hints.d.ts +14 -0
- package/dist/tools/recovery-hints.d.ts.map +1 -0
- package/dist/tools/recovery-hints.js +277 -0
- package/dist/tools/recovery-hints.js.map +1 -0
- package/dist/tools/royalties.js +1 -1
- package/dist/tools/royalties.js.map +1 -1
- package/dist/tools/search.js +2 -2
- package/dist/tools/search.js.map +1 -1
- package/dist/tools/send.d.ts +1 -2
- package/dist/tools/send.d.ts.map +1 -1
- package/dist/tools/send.js +19 -27
- package/dist/tools/send.js.map +1 -1
- package/dist/tools/split-sheets.d.ts.map +1 -1
- package/dist/tools/split-sheets.js +12 -0
- package/dist/tools/split-sheets.js.map +1 -1
- package/dist/tools/works.d.ts +4 -12
- package/dist/tools/works.d.ts.map +1 -1
- package/dist/tools/works.js +203 -116
- package/dist/tools/works.js.map +1 -1
- package/dist/utils/audit.d.ts +28 -0
- package/dist/utils/audit.d.ts.map +1 -0
- package/dist/utils/audit.js +28 -0
- package/dist/utils/audit.js.map +1 -0
- package/dist/utils/confirmation.d.ts +12 -0
- package/dist/utils/confirmation.d.ts.map +1 -0
- package/dist/utils/confirmation.js +78 -0
- package/dist/utils/confirmation.js.map +1 -0
- package/dist/utils/credentials.d.ts +11 -0
- package/dist/utils/credentials.d.ts.map +1 -0
- package/dist/utils/credentials.js +47 -0
- package/dist/utils/credentials.js.map +1 -0
- package/dist/utils/enrichment-format.d.ts +31 -0
- package/dist/utils/enrichment-format.d.ts.map +1 -0
- package/dist/utils/enrichment-format.js +69 -0
- package/dist/utils/enrichment-format.js.map +1 -0
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js +29 -5
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/formatting.d.ts +1 -0
- package/dist/utils/formatting.d.ts.map +1 -1
- package/dist/utils/formatting.js +30 -2
- package/dist/utils/formatting.js.map +1 -1
- package/package.json +3 -1
- package/scripts/bundle-apps.ts +61 -0
|
@@ -6,512 +6,370 @@ export class AgreementTypesTools {
|
|
|
6
6
|
constructor(pica) {
|
|
7
7
|
this.pica = pica;
|
|
8
8
|
}
|
|
9
|
+
getResource(type) {
|
|
10
|
+
switch (type) {
|
|
11
|
+
case "template":
|
|
12
|
+
return this.pica.agreementTemplates;
|
|
13
|
+
case "producer":
|
|
14
|
+
return this.pica.producerAgreements;
|
|
15
|
+
case "work_for_hire":
|
|
16
|
+
return this.pica.workForHire;
|
|
17
|
+
default:
|
|
18
|
+
throw new Error(`Unknown agreement type: ${type}`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
labelFor(type) {
|
|
22
|
+
switch (type) {
|
|
23
|
+
case "template":
|
|
24
|
+
return "Agreement template";
|
|
25
|
+
case "producer":
|
|
26
|
+
return "Producer agreement";
|
|
27
|
+
case "work_for_hire":
|
|
28
|
+
return "Work-for-hire agreement";
|
|
29
|
+
}
|
|
30
|
+
}
|
|
9
31
|
getTools() {
|
|
10
32
|
return [
|
|
11
|
-
// ──
|
|
33
|
+
// ── Unified CRUD ────────────────────────────────────────────────
|
|
12
34
|
{
|
|
13
35
|
definition: {
|
|
14
|
-
name: "
|
|
15
|
-
description: "List
|
|
16
|
-
inputSchema: {
|
|
17
|
-
type: "object",
|
|
18
|
-
properties: {},
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
executor: this.listTemplates.bind(this),
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
definition: {
|
|
25
|
-
name: "pica_agreement_templates_get",
|
|
26
|
-
description: "Get a specific agreement template with its full body, placeholders, and metadata.",
|
|
36
|
+
name: "pica_agreement_types_query",
|
|
37
|
+
description: "List agreements by type — templates, producer agreements, or work-for-hire contracts.",
|
|
27
38
|
inputSchema: {
|
|
28
39
|
type: "object",
|
|
29
40
|
properties: {
|
|
30
|
-
|
|
41
|
+
type: {
|
|
31
42
|
type: "string",
|
|
32
|
-
|
|
43
|
+
enum: ["template", "producer", "work_for_hire"],
|
|
44
|
+
description: "Agreement sub-type to query",
|
|
45
|
+
},
|
|
46
|
+
limit: {
|
|
47
|
+
type: "number",
|
|
48
|
+
description: "Max results",
|
|
33
49
|
},
|
|
34
50
|
},
|
|
35
|
-
required: ["
|
|
51
|
+
required: ["type"],
|
|
36
52
|
},
|
|
37
53
|
},
|
|
38
|
-
executor: this.
|
|
54
|
+
executor: this.query.bind(this),
|
|
39
55
|
},
|
|
40
56
|
{
|
|
41
57
|
definition: {
|
|
42
|
-
name: "
|
|
43
|
-
description: "
|
|
58
|
+
name: "pica_agreement_types_inspect",
|
|
59
|
+
description: "Get a specific agreement by type and ID — full details including body, terms, and metadata.",
|
|
44
60
|
inputSchema: {
|
|
45
61
|
type: "object",
|
|
46
62
|
properties: {
|
|
47
|
-
|
|
48
|
-
type: "string",
|
|
49
|
-
description: "Template name (e.g. 'Standard Publishing Deal')",
|
|
50
|
-
},
|
|
51
|
-
template_type: {
|
|
63
|
+
type: {
|
|
52
64
|
type: "string",
|
|
53
|
-
|
|
65
|
+
enum: ["template", "producer", "work_for_hire"],
|
|
66
|
+
description: "Agreement sub-type",
|
|
54
67
|
},
|
|
55
|
-
|
|
56
|
-
type: "string",
|
|
57
|
-
description: "Template body with placeholders — use {{placeholder_name}} syntax",
|
|
58
|
-
},
|
|
59
|
-
description: {
|
|
68
|
+
id: {
|
|
60
69
|
type: "string",
|
|
61
|
-
description: "
|
|
62
|
-
},
|
|
63
|
-
is_default: {
|
|
64
|
-
type: "boolean",
|
|
65
|
-
description: "Whether this is the default template for its type",
|
|
70
|
+
description: "Agreement ID",
|
|
66
71
|
},
|
|
67
72
|
},
|
|
68
|
-
required: ["
|
|
73
|
+
required: ["type", "id"],
|
|
69
74
|
},
|
|
70
75
|
},
|
|
71
|
-
executor: this.
|
|
76
|
+
executor: this.inspect.bind(this),
|
|
72
77
|
},
|
|
73
78
|
{
|
|
74
79
|
definition: {
|
|
75
|
-
name: "
|
|
76
|
-
description: "
|
|
80
|
+
name: "pica_agreement_types_create",
|
|
81
|
+
description: "Create a new agreement of the specified type. Templates need name + template_type + body. " +
|
|
82
|
+
"Producer agreements need title (plus optional advance, points, recoupment). " +
|
|
83
|
+
"Work-for-hire needs title (plus optional fee, contractor, rights).",
|
|
77
84
|
inputSchema: {
|
|
78
85
|
type: "object",
|
|
79
86
|
properties: {
|
|
80
|
-
|
|
87
|
+
type: {
|
|
81
88
|
type: "string",
|
|
82
|
-
|
|
89
|
+
enum: ["template", "producer", "work_for_hire"],
|
|
90
|
+
description: "Agreement sub-type to create",
|
|
83
91
|
},
|
|
92
|
+
// Template fields
|
|
84
93
|
name: {
|
|
85
94
|
type: "string",
|
|
86
|
-
description: "
|
|
95
|
+
description: "Template name (templates only)",
|
|
87
96
|
},
|
|
88
97
|
template_type: {
|
|
89
98
|
type: "string",
|
|
90
|
-
description: "
|
|
99
|
+
description: "Type of agreement this template produces (templates only)",
|
|
91
100
|
},
|
|
92
101
|
body: {
|
|
93
102
|
type: "string",
|
|
94
|
-
description: "
|
|
103
|
+
description: "Template body with {{placeholders}} (templates only)",
|
|
95
104
|
},
|
|
96
105
|
description: {
|
|
97
106
|
type: "string",
|
|
98
|
-
description: "
|
|
107
|
+
description: "Short description",
|
|
99
108
|
},
|
|
100
109
|
is_default: {
|
|
101
110
|
type: "boolean",
|
|
102
|
-
description: "Set as default for its type",
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
required: ["id"],
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
executor: this.updateTemplate.bind(this),
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
definition: {
|
|
112
|
-
name: "pica_agreement_templates_delete",
|
|
113
|
-
description: "Delete an agreement template.",
|
|
114
|
-
inputSchema: {
|
|
115
|
-
type: "object",
|
|
116
|
-
properties: {
|
|
117
|
-
id: {
|
|
118
|
-
type: "string",
|
|
119
|
-
description: "Template ID",
|
|
111
|
+
description: "Set as default for its type (templates only)",
|
|
120
112
|
},
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
},
|
|
124
|
-
},
|
|
125
|
-
executor: this.deleteTemplate.bind(this),
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
definition: {
|
|
129
|
-
name: "pica_agreement_templates_render",
|
|
130
|
-
description: "Fill an agreement template with work and people data — generates a ready-to-send agreement. Pass the template ID plus work_id and/or people_ids to populate the placeholders with real catalog data.",
|
|
131
|
-
inputSchema: {
|
|
132
|
-
type: "object",
|
|
133
|
-
properties: {
|
|
134
|
-
id: {
|
|
113
|
+
// Producer + work-for-hire shared
|
|
114
|
+
title: {
|
|
135
115
|
type: "string",
|
|
136
|
-
description: "
|
|
116
|
+
description: "Agreement title (producer / work-for-hire)",
|
|
137
117
|
},
|
|
138
118
|
work_id: {
|
|
139
119
|
type: "string",
|
|
140
|
-
description: "Work
|
|
141
|
-
},
|
|
142
|
-
people_ids: {
|
|
143
|
-
type: "array",
|
|
144
|
-
items: { type: "string" },
|
|
145
|
-
description: "People IDs to include as parties in the agreement",
|
|
146
|
-
},
|
|
147
|
-
variables: {
|
|
148
|
-
type: "object",
|
|
149
|
-
description: "Additional variables to substitute — keys match placeholder names in the template body",
|
|
150
|
-
},
|
|
151
|
-
},
|
|
152
|
-
required: ["id"],
|
|
153
|
-
},
|
|
154
|
-
},
|
|
155
|
-
executor: this.renderTemplate.bind(this),
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
definition: {
|
|
159
|
-
name: "pica_agreement_templates_duplicate",
|
|
160
|
-
description: "Duplicate an agreement template — creates a copy you can customise without changing the original.",
|
|
161
|
-
inputSchema: {
|
|
162
|
-
type: "object",
|
|
163
|
-
properties: {
|
|
164
|
-
id: {
|
|
165
|
-
type: "string",
|
|
166
|
-
description: "Template ID to duplicate",
|
|
167
|
-
},
|
|
168
|
-
},
|
|
169
|
-
required: ["id"],
|
|
170
|
-
},
|
|
171
|
-
},
|
|
172
|
-
executor: this.duplicateTemplate.bind(this),
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
definition: {
|
|
176
|
-
name: "pica_agreement_templates_set_default",
|
|
177
|
-
description: "Set a template as the default for its type — when creating agreements of that type, this template will be suggested first.",
|
|
178
|
-
inputSchema: {
|
|
179
|
-
type: "object",
|
|
180
|
-
properties: {
|
|
181
|
-
id: {
|
|
182
|
-
type: "string",
|
|
183
|
-
description: "Template ID to set as default",
|
|
120
|
+
description: "Work this agreement covers",
|
|
184
121
|
},
|
|
185
|
-
|
|
186
|
-
required: ["id"],
|
|
187
|
-
},
|
|
188
|
-
},
|
|
189
|
-
executor: this.setDefaultTemplate.bind(this),
|
|
190
|
-
},
|
|
191
|
-
// ── Producer Agreements ──────────────────────────────────────────
|
|
192
|
-
{
|
|
193
|
-
definition: {
|
|
194
|
-
name: "pica_producer_agreements_list",
|
|
195
|
-
description: "List producer agreements — advance + points deals with recoupment tracking. Shows all producer deals for the catalogue.",
|
|
196
|
-
inputSchema: {
|
|
197
|
-
type: "object",
|
|
198
|
-
properties: {},
|
|
199
|
-
},
|
|
200
|
-
},
|
|
201
|
-
executor: this.listProducerAgreements.bind(this),
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
definition: {
|
|
205
|
-
name: "pica_producer_agreements_get",
|
|
206
|
-
description: "Get a producer agreement with full details including advance amount, points percentage, and recoupment status.",
|
|
207
|
-
inputSchema: {
|
|
208
|
-
type: "object",
|
|
209
|
-
properties: {
|
|
210
|
-
id: {
|
|
122
|
+
status: {
|
|
211
123
|
type: "string",
|
|
212
|
-
|
|
124
|
+
enum: ["draft", "active", "completed", "terminated"],
|
|
125
|
+
description: "Agreement status",
|
|
213
126
|
},
|
|
214
|
-
|
|
215
|
-
required: ["id"],
|
|
216
|
-
},
|
|
217
|
-
},
|
|
218
|
-
executor: this.getProducerAgreement.bind(this),
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
definition: {
|
|
222
|
-
name: "pica_producer_agreements_create",
|
|
223
|
-
description: "Create a producer agreement — set advance, points percentage, and recoupment terms. Links a producer to a work or recording with specific commercial terms.",
|
|
224
|
-
inputSchema: {
|
|
225
|
-
type: "object",
|
|
226
|
-
properties: {
|
|
227
|
-
title: {
|
|
127
|
+
notes: {
|
|
228
128
|
type: "string",
|
|
229
|
-
description: "
|
|
129
|
+
description: "Internal notes",
|
|
230
130
|
},
|
|
131
|
+
// Producer-specific
|
|
231
132
|
producer_id: {
|
|
232
133
|
type: "string",
|
|
233
|
-
description: "Person ID of the producer",
|
|
234
|
-
},
|
|
235
|
-
work_id: {
|
|
236
|
-
type: "string",
|
|
237
|
-
description: "Work this agreement covers",
|
|
134
|
+
description: "Person ID of the producer (producer only)",
|
|
238
135
|
},
|
|
239
136
|
recording_id: {
|
|
240
137
|
type: "string",
|
|
241
|
-
description: "Recording this agreement covers (
|
|
138
|
+
description: "Recording this agreement covers (producer only)",
|
|
242
139
|
},
|
|
243
140
|
advance_amount: {
|
|
244
141
|
type: "number",
|
|
245
|
-
description: "Advance amount
|
|
142
|
+
description: "Advance amount (producer only)",
|
|
246
143
|
},
|
|
247
144
|
advance_currency: {
|
|
248
145
|
type: "string",
|
|
249
|
-
description: "Currency code (
|
|
146
|
+
description: "Currency code (producer only)",
|
|
250
147
|
},
|
|
251
148
|
points_percentage: {
|
|
252
149
|
type: "number",
|
|
253
|
-
description: "Producer points
|
|
150
|
+
description: "Producer points percentage (producer only)",
|
|
254
151
|
},
|
|
255
152
|
recoupment_terms: {
|
|
256
153
|
type: "string",
|
|
257
|
-
description: "
|
|
154
|
+
description: "Recoupment terms (producer only)",
|
|
258
155
|
},
|
|
259
|
-
|
|
156
|
+
// Work-for-hire-specific
|
|
157
|
+
contractor_id: {
|
|
260
158
|
type: "string",
|
|
261
|
-
description: "
|
|
262
|
-
enum: ["draft", "active", "completed", "terminated"],
|
|
159
|
+
description: "Person ID of the contractor (work-for-hire only)",
|
|
263
160
|
},
|
|
264
|
-
|
|
161
|
+
fee_amount: {
|
|
162
|
+
type: "number",
|
|
163
|
+
description: "Flat fee amount (work-for-hire only)",
|
|
164
|
+
},
|
|
165
|
+
fee_currency: {
|
|
265
166
|
type: "string",
|
|
266
|
-
description: "
|
|
167
|
+
description: "Currency code (work-for-hire only)",
|
|
168
|
+
},
|
|
169
|
+
rights_assigned: {
|
|
170
|
+
type: "string",
|
|
171
|
+
description: "Rights being assigned (work-for-hire only)",
|
|
267
172
|
},
|
|
268
173
|
},
|
|
269
|
-
required: ["
|
|
174
|
+
required: ["type"],
|
|
270
175
|
},
|
|
271
176
|
},
|
|
272
|
-
executor: this.
|
|
177
|
+
executor: this.create.bind(this),
|
|
273
178
|
},
|
|
274
179
|
{
|
|
275
180
|
definition: {
|
|
276
|
-
name: "
|
|
277
|
-
description: "Update
|
|
181
|
+
name: "pica_agreement_types_update",
|
|
182
|
+
description: "Update an existing agreement by type and ID.",
|
|
278
183
|
inputSchema: {
|
|
279
184
|
type: "object",
|
|
280
185
|
properties: {
|
|
281
|
-
|
|
282
|
-
type: "string",
|
|
283
|
-
description: "Producer agreement ID",
|
|
284
|
-
},
|
|
285
|
-
title: {
|
|
286
|
-
type: "string",
|
|
287
|
-
description: "Updated title",
|
|
288
|
-
},
|
|
289
|
-
producer_id: {
|
|
290
|
-
type: "string",
|
|
291
|
-
description: "Updated producer person ID",
|
|
292
|
-
},
|
|
293
|
-
work_id: {
|
|
294
|
-
type: "string",
|
|
295
|
-
description: "Updated work ID",
|
|
296
|
-
},
|
|
297
|
-
recording_id: {
|
|
298
|
-
type: "string",
|
|
299
|
-
description: "Updated recording ID",
|
|
300
|
-
},
|
|
301
|
-
advance_amount: {
|
|
302
|
-
type: "number",
|
|
303
|
-
description: "Updated advance amount",
|
|
304
|
-
},
|
|
305
|
-
advance_currency: {
|
|
186
|
+
type: {
|
|
306
187
|
type: "string",
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
points_percentage: {
|
|
310
|
-
type: "number",
|
|
311
|
-
description: "Updated points percentage",
|
|
188
|
+
enum: ["template", "producer", "work_for_hire"],
|
|
189
|
+
description: "Agreement sub-type",
|
|
312
190
|
},
|
|
313
|
-
|
|
191
|
+
id: {
|
|
314
192
|
type: "string",
|
|
315
|
-
description: "
|
|
193
|
+
description: "Agreement ID",
|
|
316
194
|
},
|
|
195
|
+
// All possible update fields (same as create minus type/id)
|
|
196
|
+
name: { type: "string" },
|
|
197
|
+
template_type: { type: "string" },
|
|
198
|
+
body: { type: "string" },
|
|
199
|
+
description: { type: "string" },
|
|
200
|
+
is_default: { type: "boolean" },
|
|
201
|
+
title: { type: "string" },
|
|
202
|
+
work_id: { type: "string" },
|
|
317
203
|
status: {
|
|
318
204
|
type: "string",
|
|
319
|
-
description: "Updated status",
|
|
320
205
|
enum: ["draft", "active", "completed", "terminated"],
|
|
321
206
|
},
|
|
322
|
-
notes: {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
},
|
|
207
|
+
notes: { type: "string" },
|
|
208
|
+
producer_id: { type: "string" },
|
|
209
|
+
recording_id: { type: "string" },
|
|
210
|
+
advance_amount: { type: "number" },
|
|
211
|
+
advance_currency: { type: "string" },
|
|
212
|
+
points_percentage: { type: "number" },
|
|
213
|
+
recoupment_terms: { type: "string" },
|
|
214
|
+
contractor_id: { type: "string" },
|
|
215
|
+
fee_amount: { type: "number" },
|
|
216
|
+
fee_currency: { type: "string" },
|
|
217
|
+
rights_assigned: { type: "string" },
|
|
326
218
|
},
|
|
327
|
-
required: ["id"],
|
|
219
|
+
required: ["type", "id"],
|
|
328
220
|
},
|
|
329
221
|
},
|
|
330
|
-
executor: this.
|
|
222
|
+
executor: this.update.bind(this),
|
|
331
223
|
},
|
|
332
224
|
{
|
|
333
225
|
definition: {
|
|
334
|
-
name: "
|
|
335
|
-
description: "Delete
|
|
226
|
+
name: "pica_agreement_types_delete",
|
|
227
|
+
description: "Delete an agreement by type and ID.",
|
|
336
228
|
inputSchema: {
|
|
337
229
|
type: "object",
|
|
338
230
|
properties: {
|
|
339
|
-
|
|
231
|
+
type: {
|
|
340
232
|
type: "string",
|
|
341
|
-
|
|
233
|
+
enum: ["template", "producer", "work_for_hire"],
|
|
234
|
+
description: "Agreement sub-type",
|
|
342
235
|
},
|
|
343
|
-
},
|
|
344
|
-
required: ["id"],
|
|
345
|
-
},
|
|
346
|
-
},
|
|
347
|
-
executor: this.deleteProducerAgreement.bind(this),
|
|
348
|
-
},
|
|
349
|
-
// ── Work-for-Hire ────────────────────────────────────────────────
|
|
350
|
-
{
|
|
351
|
-
definition: {
|
|
352
|
-
name: "pica_work_for_hire_list",
|
|
353
|
-
description: "List work-for-hire agreements — flat-fee contracts where all rights are assigned to the commissioning party.",
|
|
354
|
-
inputSchema: {
|
|
355
|
-
type: "object",
|
|
356
|
-
properties: {},
|
|
357
|
-
},
|
|
358
|
-
},
|
|
359
|
-
executor: this.listWorkForHire.bind(this),
|
|
360
|
-
},
|
|
361
|
-
{
|
|
362
|
-
definition: {
|
|
363
|
-
name: "pica_work_for_hire_get",
|
|
364
|
-
description: "Get a work-for-hire agreement with full details — fee, contractor, rights assignment, and linked works.",
|
|
365
|
-
inputSchema: {
|
|
366
|
-
type: "object",
|
|
367
|
-
properties: {
|
|
368
236
|
id: {
|
|
369
237
|
type: "string",
|
|
370
|
-
description: "
|
|
238
|
+
description: "Agreement ID",
|
|
371
239
|
},
|
|
372
240
|
},
|
|
373
|
-
required: ["id"],
|
|
241
|
+
required: ["type", "id"],
|
|
374
242
|
},
|
|
375
243
|
},
|
|
376
|
-
executor: this.
|
|
244
|
+
executor: this.delete.bind(this),
|
|
377
245
|
},
|
|
246
|
+
// ── Template-specific operations ────────────────────────────────
|
|
378
247
|
{
|
|
379
248
|
definition: {
|
|
380
|
-
name: "
|
|
381
|
-
description: "
|
|
249
|
+
name: "pica_agreement_templates_render",
|
|
250
|
+
description: "Fill an agreement template with work and people data — generates a ready-to-send agreement. Pass the template ID plus work_id and/or people_ids to populate the placeholders with real catalog data.",
|
|
382
251
|
inputSchema: {
|
|
383
252
|
type: "object",
|
|
384
253
|
properties: {
|
|
385
|
-
|
|
386
|
-
type: "string",
|
|
387
|
-
description: "Agreement title",
|
|
388
|
-
},
|
|
389
|
-
contractor_id: {
|
|
254
|
+
id: {
|
|
390
255
|
type: "string",
|
|
391
|
-
description: "
|
|
256
|
+
description: "Template ID to render",
|
|
392
257
|
},
|
|
393
258
|
work_id: {
|
|
394
259
|
type: "string",
|
|
395
|
-
description: "Work
|
|
396
|
-
},
|
|
397
|
-
fee_amount: {
|
|
398
|
-
type: "number",
|
|
399
|
-
description: "Flat fee amount",
|
|
400
|
-
},
|
|
401
|
-
fee_currency: {
|
|
402
|
-
type: "string",
|
|
403
|
-
description: "Currency code (e.g. GBP, USD, EUR)",
|
|
404
|
-
},
|
|
405
|
-
rights_assigned: {
|
|
406
|
-
type: "string",
|
|
407
|
-
description: "Description of rights being assigned (e.g. 'All publishing and master rights')",
|
|
260
|
+
description: "Work ID to pull title, credits, and metadata from",
|
|
408
261
|
},
|
|
409
|
-
|
|
410
|
-
type: "
|
|
411
|
-
|
|
412
|
-
|
|
262
|
+
people_ids: {
|
|
263
|
+
type: "array",
|
|
264
|
+
items: { type: "string" },
|
|
265
|
+
description: "People IDs to include as parties in the agreement",
|
|
413
266
|
},
|
|
414
|
-
|
|
415
|
-
type: "
|
|
416
|
-
description: "
|
|
267
|
+
variables: {
|
|
268
|
+
type: "object",
|
|
269
|
+
description: "Additional variables to substitute — keys match placeholder names in the template body",
|
|
417
270
|
},
|
|
418
271
|
},
|
|
419
|
-
required: ["
|
|
272
|
+
required: ["id"],
|
|
420
273
|
},
|
|
421
274
|
},
|
|
422
|
-
executor: this.
|
|
275
|
+
executor: this.renderTemplate.bind(this),
|
|
423
276
|
},
|
|
424
277
|
{
|
|
425
278
|
definition: {
|
|
426
|
-
name: "
|
|
427
|
-
description: "
|
|
279
|
+
name: "pica_agreement_templates_duplicate",
|
|
280
|
+
description: "Duplicate an agreement template — creates a copy you can customise without changing the original.",
|
|
428
281
|
inputSchema: {
|
|
429
282
|
type: "object",
|
|
430
283
|
properties: {
|
|
431
284
|
id: {
|
|
432
285
|
type: "string",
|
|
433
|
-
description: "
|
|
434
|
-
},
|
|
435
|
-
title: {
|
|
436
|
-
type: "string",
|
|
437
|
-
description: "Updated title",
|
|
438
|
-
},
|
|
439
|
-
contractor_id: {
|
|
440
|
-
type: "string",
|
|
441
|
-
description: "Updated contractor person ID",
|
|
442
|
-
},
|
|
443
|
-
work_id: {
|
|
444
|
-
type: "string",
|
|
445
|
-
description: "Updated work ID",
|
|
446
|
-
},
|
|
447
|
-
fee_amount: {
|
|
448
|
-
type: "number",
|
|
449
|
-
description: "Updated fee amount",
|
|
450
|
-
},
|
|
451
|
-
fee_currency: {
|
|
452
|
-
type: "string",
|
|
453
|
-
description: "Updated currency code",
|
|
454
|
-
},
|
|
455
|
-
rights_assigned: {
|
|
456
|
-
type: "string",
|
|
457
|
-
description: "Updated rights description",
|
|
458
|
-
},
|
|
459
|
-
status: {
|
|
460
|
-
type: "string",
|
|
461
|
-
description: "Updated status",
|
|
462
|
-
enum: ["draft", "active", "completed", "terminated"],
|
|
463
|
-
},
|
|
464
|
-
notes: {
|
|
465
|
-
type: "string",
|
|
466
|
-
description: "Updated notes",
|
|
286
|
+
description: "Template ID to duplicate",
|
|
467
287
|
},
|
|
468
288
|
},
|
|
469
289
|
required: ["id"],
|
|
470
290
|
},
|
|
471
291
|
},
|
|
472
|
-
executor: this.
|
|
292
|
+
executor: this.duplicateTemplate.bind(this),
|
|
473
293
|
},
|
|
474
294
|
{
|
|
475
295
|
definition: {
|
|
476
|
-
name: "
|
|
477
|
-
description: "
|
|
296
|
+
name: "pica_agreement_templates_set_default",
|
|
297
|
+
description: "Set a template as the default for its type — when creating agreements of that type, this template will be suggested first.",
|
|
478
298
|
inputSchema: {
|
|
479
299
|
type: "object",
|
|
480
300
|
properties: {
|
|
481
301
|
id: {
|
|
482
302
|
type: "string",
|
|
483
|
-
description: "
|
|
303
|
+
description: "Template ID to set as default",
|
|
484
304
|
},
|
|
485
305
|
},
|
|
486
306
|
required: ["id"],
|
|
487
307
|
},
|
|
488
308
|
},
|
|
489
|
-
executor: this.
|
|
309
|
+
executor: this.setDefaultTemplate.bind(this),
|
|
490
310
|
},
|
|
491
311
|
];
|
|
492
312
|
}
|
|
493
|
-
// ──
|
|
494
|
-
async
|
|
495
|
-
const
|
|
496
|
-
|
|
313
|
+
// ── Unified CRUD executors ──────────────────────────────────────────
|
|
314
|
+
async query(args) {
|
|
315
|
+
const resource = this.getResource(args.type);
|
|
316
|
+
const items = await resource.list();
|
|
317
|
+
return formatList(items, { total: items.length });
|
|
497
318
|
}
|
|
498
|
-
async
|
|
499
|
-
const
|
|
500
|
-
|
|
319
|
+
async inspect(args) {
|
|
320
|
+
const resource = this.getResource(args.type);
|
|
321
|
+
const item = await resource.get(args.id);
|
|
322
|
+
return formatAsText(item);
|
|
501
323
|
}
|
|
502
|
-
async
|
|
503
|
-
const
|
|
504
|
-
|
|
324
|
+
async create(args) {
|
|
325
|
+
const { type, ...fields } = args;
|
|
326
|
+
const resource = this.getResource(type);
|
|
327
|
+
const item = await resource.create(fields);
|
|
328
|
+
// Notification for producer agreements
|
|
329
|
+
if (type === "producer" && fields.producer_id) {
|
|
330
|
+
const results = await notifyParties(this.pica, [
|
|
331
|
+
{
|
|
332
|
+
person_id: fields.producer_id,
|
|
333
|
+
message: `a producer agreement has been created for "${fields.title || "untitled"}" — please review the terms`,
|
|
334
|
+
work_id: fields.work_id,
|
|
335
|
+
notification_type: "agreement_created",
|
|
336
|
+
},
|
|
337
|
+
]);
|
|
338
|
+
const notifySummary = summarizeNotifications(results);
|
|
339
|
+
if (notifySummary) {
|
|
340
|
+
return formatSuccess(`Producer agreement created. ${notifySummary}`, item);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
// Notification for work-for-hire
|
|
344
|
+
if (type === "work_for_hire" && fields.contractor_id) {
|
|
345
|
+
const results = await notifyParties(this.pica, [
|
|
346
|
+
{
|
|
347
|
+
person_id: fields.contractor_id,
|
|
348
|
+
message: `a work-for-hire agreement has been created: "${fields.title || "untitled"}" — please review`,
|
|
349
|
+
work_id: fields.work_id,
|
|
350
|
+
notification_type: "agreement_created",
|
|
351
|
+
},
|
|
352
|
+
]);
|
|
353
|
+
const notifySummary = summarizeNotifications(results);
|
|
354
|
+
if (notifySummary) {
|
|
355
|
+
return formatSuccess(`Work-for-hire agreement created. ${notifySummary}`, item);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
return formatSuccess(`${this.labelFor(type)} created`, item);
|
|
505
359
|
}
|
|
506
|
-
async
|
|
507
|
-
const { id, ...updates } = args;
|
|
508
|
-
const
|
|
509
|
-
|
|
360
|
+
async update(args) {
|
|
361
|
+
const { type, id, ...updates } = args;
|
|
362
|
+
const resource = this.getResource(type);
|
|
363
|
+
const item = await resource.update(id, updates);
|
|
364
|
+
return formatSuccess(`${this.labelFor(type)} updated`, item);
|
|
510
365
|
}
|
|
511
|
-
async
|
|
512
|
-
|
|
513
|
-
|
|
366
|
+
async delete(args) {
|
|
367
|
+
const { type, id } = args;
|
|
368
|
+
const resource = this.getResource(type);
|
|
369
|
+
await resource.delete(id);
|
|
370
|
+
return formatSuccess(`${this.labelFor(type)} ${id} deleted`);
|
|
514
371
|
}
|
|
372
|
+
// ── Template-specific executors ─────────────────────────────────────
|
|
515
373
|
async renderTemplate(args) {
|
|
516
374
|
const { id, ...renderData } = args;
|
|
517
375
|
const rendered = await this.pica.agreementTemplates.render(id, renderData);
|
|
@@ -525,79 +383,5 @@ export class AgreementTypesTools {
|
|
|
525
383
|
const result = await this.pica.agreementTemplates.setDefault(args.id);
|
|
526
384
|
return formatSuccess("Template set as default for its type", result);
|
|
527
385
|
}
|
|
528
|
-
// ── Producer agreement executors ───────────────────────────────────
|
|
529
|
-
async listProducerAgreements() {
|
|
530
|
-
const agreements = await this.pica.producerAgreements.list();
|
|
531
|
-
return formatList(agreements, { total: agreements.length });
|
|
532
|
-
}
|
|
533
|
-
async getProducerAgreement(args) {
|
|
534
|
-
const agreement = await this.pica.producerAgreements.get(args.id);
|
|
535
|
-
return formatAsText(agreement);
|
|
536
|
-
}
|
|
537
|
-
async createProducerAgreement(args) {
|
|
538
|
-
const agreement = await this.pica.producerAgreements.create(args);
|
|
539
|
-
let notifySummary = "";
|
|
540
|
-
if (args.producer_id) {
|
|
541
|
-
const results = await notifyParties(this.pica, [
|
|
542
|
-
{
|
|
543
|
-
person_id: args.producer_id,
|
|
544
|
-
message: `a producer agreement has been created for "${args.title || "untitled"}" — please review the terms`,
|
|
545
|
-
work_id: args.work_id,
|
|
546
|
-
notification_type: "agreement_created",
|
|
547
|
-
},
|
|
548
|
-
]);
|
|
549
|
-
notifySummary = summarizeNotifications(results);
|
|
550
|
-
}
|
|
551
|
-
const msg = notifySummary
|
|
552
|
-
? `Producer agreement created. ${notifySummary}`
|
|
553
|
-
: "Producer agreement created";
|
|
554
|
-
return formatSuccess(msg, agreement);
|
|
555
|
-
}
|
|
556
|
-
async updateProducerAgreement(args) {
|
|
557
|
-
const { id, ...updates } = args;
|
|
558
|
-
const agreement = await this.pica.producerAgreements.update(id, updates);
|
|
559
|
-
return formatSuccess("Producer agreement updated", agreement);
|
|
560
|
-
}
|
|
561
|
-
async deleteProducerAgreement(args) {
|
|
562
|
-
await this.pica.producerAgreements.delete(args.id);
|
|
563
|
-
return formatSuccess(`Producer agreement ${args.id} deleted`);
|
|
564
|
-
}
|
|
565
|
-
// ── Work-for-hire executors ────────────────────────────────────────
|
|
566
|
-
async listWorkForHire() {
|
|
567
|
-
const agreements = await this.pica.workForHire.list();
|
|
568
|
-
return formatList(agreements, { total: agreements.length });
|
|
569
|
-
}
|
|
570
|
-
async getWorkForHire(args) {
|
|
571
|
-
const agreement = await this.pica.workForHire.get(args.id);
|
|
572
|
-
return formatAsText(agreement);
|
|
573
|
-
}
|
|
574
|
-
async createWorkForHire(args) {
|
|
575
|
-
const agreement = await this.pica.workForHire.create(args);
|
|
576
|
-
let notifySummary = "";
|
|
577
|
-
if (args.contractor_id) {
|
|
578
|
-
const results = await notifyParties(this.pica, [
|
|
579
|
-
{
|
|
580
|
-
person_id: args.contractor_id,
|
|
581
|
-
message: `a work-for-hire agreement has been created: "${args.title || "untitled"}" — please review`,
|
|
582
|
-
work_id: args.work_id,
|
|
583
|
-
notification_type: "agreement_created",
|
|
584
|
-
},
|
|
585
|
-
]);
|
|
586
|
-
notifySummary = summarizeNotifications(results);
|
|
587
|
-
}
|
|
588
|
-
const msg = notifySummary
|
|
589
|
-
? `Work-for-hire agreement created. ${notifySummary}`
|
|
590
|
-
: "Work-for-hire agreement created";
|
|
591
|
-
return formatSuccess(msg, agreement);
|
|
592
|
-
}
|
|
593
|
-
async updateWorkForHire(args) {
|
|
594
|
-
const { id, ...updates } = args;
|
|
595
|
-
const agreement = await this.pica.workForHire.update(id, updates);
|
|
596
|
-
return formatSuccess("Work-for-hire agreement updated", agreement);
|
|
597
|
-
}
|
|
598
|
-
async deleteWorkForHire(args) {
|
|
599
|
-
await this.pica.workForHire.delete(args.id);
|
|
600
|
-
return formatSuccess(`Work-for-hire agreement ${args.id} deleted`);
|
|
601
|
-
}
|
|
602
386
|
}
|
|
603
387
|
//# sourceMappingURL=agreement-types.js.map
|