@withpica/mcp-server 2.7.0 → 2.9.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/__mocks__/mppx-mcp-sdk-server.d.ts +6 -0
- package/dist/__mocks__/mppx-mcp-sdk-server.d.ts.map +1 -0
- package/dist/__mocks__/mppx-mcp-sdk-server.js +6 -0
- package/dist/__mocks__/mppx-mcp-sdk-server.js.map +1 -0
- package/dist/__mocks__/mppx-server.d.ts +12 -0
- package/dist/__mocks__/mppx-server.d.ts.map +1 -0
- package/dist/__mocks__/mppx-server.js +12 -0
- package/dist/__mocks__/mppx-server.js.map +1 -0
- package/dist/apps/download.d.ts +2 -0
- package/dist/apps/download.d.ts.map +1 -0
- package/dist/apps/download.js +125 -0
- package/dist/apps/download.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 +15 -0
- package/dist/apps/shared.d.ts.map +1 -0
- package/dist/apps/shared.js +480 -0
- package/dist/apps/shared.js.map +1 -0
- package/dist/apps/upload.d.ts +2 -0
- package/dist/apps/upload.d.ts.map +1 -0
- package/dist/apps/upload.js +280 -0
- package/dist/apps/upload.js.map +1 -0
- package/dist/config.d.ts +9 -30
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +36 -12
- package/dist/config.js.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.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 +4 -2
- package/dist/resources/index.d.ts.map +1 -1
- package/dist/resources/index.js +133 -54
- package/dist/resources/index.js.map +1 -1
- package/dist/resources/llms-primer.d.ts +2 -0
- package/dist/resources/llms-primer.d.ts.map +1 -0
- package/dist/resources/llms-primer.js +68 -0
- package/dist/resources/llms-primer.js.map +1 -0
- 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 +17 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +103 -14
- package/dist/server.js.map +1 -1
- package/dist/tools/agreement-types.d.ts +27 -0
- package/dist/tools/agreement-types.d.ts.map +1 -0
- package/dist/tools/agreement-types.js +387 -0
- package/dist/tools/agreement-types.js.map +1 -0
- package/dist/tools/agreements.d.ts +20 -0
- package/dist/tools/agreements.d.ts.map +1 -0
- package/dist/tools/agreements.js +363 -0
- package/dist/tools/agreements.js.map +1 -0
- package/dist/tools/analytics.d.ts +20 -0
- package/dist/tools/analytics.d.ts.map +1 -0
- package/dist/tools/analytics.js +124 -0
- package/dist/tools/analytics.js.map +1 -0
- package/dist/tools/app-tools.d.ts +21 -0
- package/dist/tools/app-tools.d.ts.map +1 -0
- package/dist/tools/app-tools.js +248 -0
- package/dist/tools/app-tools.js.map +1 -0
- package/dist/tools/assets.d.ts +25 -0
- package/dist/tools/assets.d.ts.map +1 -0
- package/dist/tools/assets.js +631 -0
- package/dist/tools/assets.js.map +1 -0
- package/dist/tools/audio-files.d.ts +20 -0
- package/dist/tools/audio-files.d.ts.map +1 -0
- package/dist/tools/audio-files.js +384 -0
- package/dist/tools/audio-files.js.map +1 -0
- package/dist/tools/auth.d.ts +22 -0
- package/dist/tools/auth.d.ts.map +1 -0
- package/dist/tools/auth.js +210 -0
- package/dist/tools/auth.js.map +1 -0
- package/dist/tools/bulk.d.ts +16 -0
- package/dist/tools/bulk.d.ts.map +1 -0
- package/dist/tools/bulk.js +85 -0
- package/dist/tools/bulk.js.map +1 -0
- package/dist/tools/calendar.d.ts +15 -0
- package/dist/tools/calendar.d.ts.map +1 -0
- package/dist/tools/calendar.js +67 -0
- package/dist/tools/calendar.js.map +1 -0
- package/dist/tools/collaborators.d.ts +21 -0
- package/dist/tools/collaborators.d.ts.map +1 -0
- package/dist/tools/collaborators.js +311 -0
- package/dist/tools/collaborators.js.map +1 -0
- package/dist/tools/comparisons.d.ts +22 -0
- package/dist/tools/comparisons.d.ts.map +1 -0
- package/dist/tools/comparisons.js +78 -0
- package/dist/tools/comparisons.js.map +1 -0
- package/dist/tools/credits.d.ts +17 -0
- package/dist/tools/credits.d.ts.map +1 -0
- package/dist/tools/credits.js +312 -0
- package/dist/tools/credits.js.map +1 -0
- package/dist/tools/custody-hints.d.ts +16 -0
- package/dist/tools/custody-hints.d.ts.map +1 -0
- package/dist/tools/custody-hints.js +27 -0
- package/dist/tools/custody-hints.js.map +1 -0
- package/dist/tools/custody.d.ts +38 -0
- package/dist/tools/custody.d.ts.map +1 -0
- package/dist/tools/custody.js +274 -0
- package/dist/tools/custody.js.map +1 -0
- package/dist/tools/dashboard.d.ts +19 -0
- package/dist/tools/dashboard.d.ts.map +1 -0
- package/dist/tools/dashboard.js +146 -0
- package/dist/tools/dashboard.js.map +1 -0
- package/dist/tools/directory.d.ts +15 -0
- package/dist/tools/directory.d.ts.map +1 -0
- package/dist/tools/directory.js +106 -0
- package/dist/tools/directory.js.map +1 -0
- package/dist/tools/discovery.d.ts +28 -0
- package/dist/tools/discovery.d.ts.map +1 -0
- package/dist/tools/discovery.js +560 -0
- package/dist/tools/discovery.js.map +1 -0
- package/dist/tools/disputes.d.ts +18 -0
- package/dist/tools/disputes.d.ts.map +1 -0
- package/dist/tools/disputes.js +61 -0
- package/dist/tools/disputes.js.map +1 -0
- package/dist/tools/documents.d.ts +15 -0
- package/dist/tools/documents.d.ts.map +1 -0
- package/dist/tools/documents.js +36 -0
- package/dist/tools/documents.js.map +1 -0
- package/dist/tools/duplicates.d.ts +16 -0
- package/dist/tools/duplicates.d.ts.map +1 -0
- package/dist/tools/duplicates.js +87 -0
- package/dist/tools/duplicates.js.map +1 -0
- package/dist/tools/enrichment.d.ts +23 -0
- package/dist/tools/enrichment.d.ts.map +1 -0
- package/dist/tools/enrichment.js +220 -0
- package/dist/tools/enrichment.js.map +1 -0
- package/dist/tools/exports.d.ts +19 -0
- package/dist/tools/exports.d.ts.map +1 -0
- package/dist/tools/exports.js +175 -0
- package/dist/tools/exports.js.map +1 -0
- package/dist/tools/import-documents.d.ts +21 -0
- package/dist/tools/import-documents.d.ts.map +1 -0
- package/dist/tools/import-documents.js +203 -0
- package/dist/tools/import-documents.js.map +1 -0
- package/dist/tools/import.d.ts +30 -0
- package/dist/tools/import.d.ts.map +1 -0
- package/dist/tools/import.js +455 -0
- package/dist/tools/import.js.map +1 -0
- package/dist/tools/index.d.ts +67 -5
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +448 -84
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/integrations.d.ts +15 -0
- package/dist/tools/integrations.d.ts.map +1 -0
- package/dist/tools/integrations.js +100 -0
- package/dist/tools/integrations.js.map +1 -0
- package/dist/tools/licensing.d.ts +40 -0
- package/dist/tools/licensing.d.ts.map +1 -0
- package/dist/tools/licensing.js +431 -0
- package/dist/tools/licensing.js.map +1 -0
- package/dist/tools/memory.d.ts +21 -0
- package/dist/tools/memory.d.ts.map +1 -0
- package/dist/tools/memory.js +116 -0
- package/dist/tools/memory.js.map +1 -0
- package/dist/tools/metadata.d.ts +15 -0
- package/dist/tools/metadata.d.ts.map +1 -0
- package/dist/tools/metadata.js +1106 -0
- package/dist/tools/metadata.js.map +1 -0
- package/dist/tools/multimedia.d.ts +19 -0
- package/dist/tools/multimedia.d.ts.map +1 -0
- package/dist/tools/multimedia.js +291 -0
- package/dist/tools/multimedia.js.map +1 -0
- package/dist/tools/notes.d.ts +21 -0
- package/dist/tools/notes.d.ts.map +1 -0
- package/dist/tools/notes.js +108 -0
- package/dist/tools/notes.js.map +1 -0
- package/dist/tools/notifications.d.ts +20 -0
- package/dist/tools/notifications.d.ts.map +1 -0
- package/dist/tools/notifications.js +266 -0
- package/dist/tools/notifications.js.map +1 -0
- package/dist/tools/people.d.ts +5 -13
- package/dist/tools/people.d.ts.map +1 -1
- package/dist/tools/people.js +148 -109
- package/dist/tools/people.js.map +1 -1
- package/dist/tools/projects.d.ts +19 -0
- package/dist/tools/projects.d.ts.map +1 -0
- package/dist/tools/projects.js +140 -0
- package/dist/tools/projects.js.map +1 -0
- 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/purchases.d.ts +15 -0
- package/dist/tools/purchases.d.ts.map +1 -0
- package/dist/tools/purchases.js +63 -0
- package/dist/tools/purchases.js.map +1 -0
- package/dist/tools/recordings.d.ts +35 -35
- package/dist/tools/recordings.d.ts.map +1 -1
- package/dist/tools/recordings.js +136 -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/releases.d.ts +18 -0
- package/dist/tools/releases.d.ts.map +1 -0
- package/dist/tools/releases.js +128 -0
- package/dist/tools/releases.js.map +1 -0
- package/dist/tools/royalties.d.ts +23 -0
- package/dist/tools/royalties.d.ts.map +1 -0
- package/dist/tools/royalties.js +257 -0
- package/dist/tools/royalties.js.map +1 -0
- package/dist/tools/search.d.ts +1 -1
- 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/send.d.ts +17 -0
- package/dist/tools/send.d.ts.map +1 -0
- package/dist/tools/send.js +185 -0
- package/dist/tools/send.js.map +1 -0
- package/dist/tools/sessions.d.ts +18 -0
- package/dist/tools/sessions.d.ts.map +1 -0
- package/dist/tools/sessions.js +115 -0
- package/dist/tools/sessions.js.map +1 -0
- package/dist/tools/settings.d.ts +18 -0
- package/dist/tools/settings.d.ts.map +1 -0
- package/dist/tools/settings.js +96 -0
- package/dist/tools/settings.js.map +1 -0
- package/dist/tools/share-links.d.ts +19 -0
- package/dist/tools/share-links.d.ts.map +1 -0
- package/dist/tools/share-links.js +121 -0
- package/dist/tools/share-links.js.map +1 -0
- package/dist/tools/split-sheets.d.ts +25 -0
- package/dist/tools/split-sheets.d.ts.map +1 -0
- package/dist/tools/split-sheets.js +307 -0
- package/dist/tools/split-sheets.js.map +1 -0
- package/dist/tools/team.d.ts +22 -0
- package/dist/tools/team.d.ts.map +1 -0
- package/dist/tools/team.js +134 -0
- package/dist/tools/team.js.map +1 -0
- package/dist/tools/telegram.d.ts +21 -0
- package/dist/tools/telegram.d.ts.map +1 -0
- package/dist/tools/telegram.js +141 -0
- package/dist/tools/telegram.js.map +1 -0
- package/dist/tools/uploads.d.ts +17 -0
- package/dist/tools/uploads.d.ts.map +1 -0
- package/dist/tools/uploads.js +156 -0
- package/dist/tools/uploads.js.map +1 -0
- package/dist/tools/works.d.ts +5 -13
- package/dist/tools/works.d.ts.map +1 -1
- package/dist/tools/works.js +219 -116
- package/dist/tools/works.js.map +1 -1
- package/package.json +1 -1
- package/dist/pica-sdk.d.ts +0 -1231
- package/dist/pica-sdk.d.ts.map +0 -1
- package/dist/pica-sdk.js +0 -1403
- package/dist/pica-sdk.js.map +0 -1
- package/dist/utils/errors.d.ts +0 -29
- package/dist/utils/errors.d.ts.map +0 -1
- package/dist/utils/errors.js +0 -115
- package/dist/utils/errors.js.map +0 -1
- package/dist/utils/formatting.d.ts +0 -82
- package/dist/utils/formatting.d.ts.map +0 -1
- package/dist/utils/formatting.js +0 -125
- package/dist/utils/formatting.js.map +0 -1
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
// Copyright (c) 2024-2026 Withpica Ltd. All rights reserved.
|
|
2
|
+
import { formatList, formatSuccess } from "@withpica/mcp-utils";
|
|
3
|
+
import { notifyParties, summarizeNotifications } from "@withpica/mcp-utils";
|
|
4
|
+
const AGREEMENT_TYPE_ENUM = [
|
|
5
|
+
"master_recording",
|
|
6
|
+
"library_music",
|
|
7
|
+
"publishing_admin",
|
|
8
|
+
"production",
|
|
9
|
+
"artist_contract",
|
|
10
|
+
"termination",
|
|
11
|
+
"report",
|
|
12
|
+
"other",
|
|
13
|
+
"sub_publishing",
|
|
14
|
+
"co_publishing",
|
|
15
|
+
"admin_only",
|
|
16
|
+
"distribution",
|
|
17
|
+
];
|
|
18
|
+
export class AgreementsTools {
|
|
19
|
+
pica;
|
|
20
|
+
constructor(pica) {
|
|
21
|
+
this.pica = pica;
|
|
22
|
+
}
|
|
23
|
+
getTools() {
|
|
24
|
+
return [
|
|
25
|
+
{
|
|
26
|
+
definition: {
|
|
27
|
+
name: "pica_agreements_query",
|
|
28
|
+
description: "List agreements with optional filters. Returns contracts, publishing deals, and other agreements.",
|
|
29
|
+
inputSchema: {
|
|
30
|
+
type: "object",
|
|
31
|
+
properties: {
|
|
32
|
+
query: {
|
|
33
|
+
type: "string",
|
|
34
|
+
description: "Search by title or party name",
|
|
35
|
+
},
|
|
36
|
+
agreement_type: {
|
|
37
|
+
type: "string",
|
|
38
|
+
description: "Filter by agreement type",
|
|
39
|
+
enum: [...AGREEMENT_TYPE_ENUM],
|
|
40
|
+
},
|
|
41
|
+
status: {
|
|
42
|
+
type: "string",
|
|
43
|
+
description: "Filter by status",
|
|
44
|
+
enum: [
|
|
45
|
+
"draft",
|
|
46
|
+
"pending_signature",
|
|
47
|
+
"partially_signed",
|
|
48
|
+
"fully_executed",
|
|
49
|
+
"active",
|
|
50
|
+
"completed",
|
|
51
|
+
"terminated",
|
|
52
|
+
"expired",
|
|
53
|
+
"cancelled",
|
|
54
|
+
"unknown",
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
party_name: {
|
|
58
|
+
type: "string",
|
|
59
|
+
description: "Filter by other party name",
|
|
60
|
+
},
|
|
61
|
+
limit: {
|
|
62
|
+
type: "number",
|
|
63
|
+
description: "Maximum results (default: 50, max: 100)",
|
|
64
|
+
},
|
|
65
|
+
offset: {
|
|
66
|
+
type: "number",
|
|
67
|
+
description: "Pagination offset (default: 0)",
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
executor: this.queryAgreements.bind(this),
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
definition: {
|
|
76
|
+
name: "pica_agreements_inspect",
|
|
77
|
+
description: "Get details for a specific agreement. Omit sections for everything. " +
|
|
78
|
+
"→ then: pica_agreements_update (modify), pica_agreements_link_work (attach work)",
|
|
79
|
+
inputSchema: {
|
|
80
|
+
type: "object",
|
|
81
|
+
properties: {
|
|
82
|
+
id: {
|
|
83
|
+
type: "string",
|
|
84
|
+
description: "Agreement ID",
|
|
85
|
+
},
|
|
86
|
+
sections: {
|
|
87
|
+
type: "array",
|
|
88
|
+
items: {
|
|
89
|
+
type: "string",
|
|
90
|
+
enum: ["basic", "works", "parties", "payments"],
|
|
91
|
+
},
|
|
92
|
+
description: "Which data sections to include. Omit for all sections.",
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
required: ["id"],
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
executor: this.inspectAgreement.bind(this),
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
definition: {
|
|
102
|
+
name: "pica_agreements_create",
|
|
103
|
+
description: "Create a new agreement. Requires title, type, and other party name.",
|
|
104
|
+
inputSchema: {
|
|
105
|
+
type: "object",
|
|
106
|
+
properties: {
|
|
107
|
+
title: {
|
|
108
|
+
type: "string",
|
|
109
|
+
description: "Agreement title",
|
|
110
|
+
},
|
|
111
|
+
agreement_type: {
|
|
112
|
+
type: "string",
|
|
113
|
+
description: "Type of agreement",
|
|
114
|
+
enum: [...AGREEMENT_TYPE_ENUM],
|
|
115
|
+
},
|
|
116
|
+
other_party_name: {
|
|
117
|
+
type: "string",
|
|
118
|
+
description: "Name of the other party (label, publisher, etc.)",
|
|
119
|
+
},
|
|
120
|
+
status: {
|
|
121
|
+
type: "string",
|
|
122
|
+
description: "Initial status (default: draft)",
|
|
123
|
+
enum: [
|
|
124
|
+
"draft",
|
|
125
|
+
"pending_signature",
|
|
126
|
+
"partially_signed",
|
|
127
|
+
"fully_executed",
|
|
128
|
+
"active",
|
|
129
|
+
"completed",
|
|
130
|
+
"terminated",
|
|
131
|
+
"expired",
|
|
132
|
+
"cancelled",
|
|
133
|
+
],
|
|
134
|
+
},
|
|
135
|
+
other_party_type: {
|
|
136
|
+
type: "string",
|
|
137
|
+
description: "Type of the other party (e.g., label, publisher, distributor)",
|
|
138
|
+
},
|
|
139
|
+
signing_date: {
|
|
140
|
+
type: "string",
|
|
141
|
+
description: "Date the agreement was signed (ISO 8601)",
|
|
142
|
+
},
|
|
143
|
+
start_date: {
|
|
144
|
+
type: "string",
|
|
145
|
+
description: "Start date of the agreement term (ISO 8601)",
|
|
146
|
+
},
|
|
147
|
+
end_date: {
|
|
148
|
+
type: "string",
|
|
149
|
+
description: "End date of the agreement term (ISO 8601)",
|
|
150
|
+
},
|
|
151
|
+
description: {
|
|
152
|
+
type: "string",
|
|
153
|
+
description: "Description of the agreement",
|
|
154
|
+
},
|
|
155
|
+
notes: {
|
|
156
|
+
type: "string",
|
|
157
|
+
description: "Internal notes",
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
required: ["title", "agreement_type", "other_party_name"],
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
executor: this.createAgreement.bind(this),
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
definition: {
|
|
167
|
+
name: "pica_agreements_update",
|
|
168
|
+
description: "Update an existing agreement. Status changes trigger notifications.",
|
|
169
|
+
inputSchema: {
|
|
170
|
+
type: "object",
|
|
171
|
+
properties: {
|
|
172
|
+
id: {
|
|
173
|
+
type: "string",
|
|
174
|
+
description: "Agreement ID",
|
|
175
|
+
},
|
|
176
|
+
title: {
|
|
177
|
+
type: "string",
|
|
178
|
+
description: "Updated title",
|
|
179
|
+
},
|
|
180
|
+
status: {
|
|
181
|
+
type: "string",
|
|
182
|
+
description: "Updated status",
|
|
183
|
+
enum: [
|
|
184
|
+
"draft",
|
|
185
|
+
"pending_signature",
|
|
186
|
+
"partially_signed",
|
|
187
|
+
"fully_executed",
|
|
188
|
+
"active",
|
|
189
|
+
"completed",
|
|
190
|
+
"terminated",
|
|
191
|
+
"expired",
|
|
192
|
+
"cancelled",
|
|
193
|
+
],
|
|
194
|
+
},
|
|
195
|
+
other_party_name: {
|
|
196
|
+
type: "string",
|
|
197
|
+
description: "Updated other party name",
|
|
198
|
+
},
|
|
199
|
+
signing_date: {
|
|
200
|
+
type: "string",
|
|
201
|
+
description: "Updated signing date (ISO 8601)",
|
|
202
|
+
},
|
|
203
|
+
start_date: {
|
|
204
|
+
type: "string",
|
|
205
|
+
description: "Updated start date (ISO 8601)",
|
|
206
|
+
},
|
|
207
|
+
end_date: {
|
|
208
|
+
type: "string",
|
|
209
|
+
description: "Updated end date (ISO 8601)",
|
|
210
|
+
},
|
|
211
|
+
description: {
|
|
212
|
+
type: "string",
|
|
213
|
+
description: "Updated description",
|
|
214
|
+
},
|
|
215
|
+
notes: {
|
|
216
|
+
type: "string",
|
|
217
|
+
description: "Updated internal notes",
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
required: ["id"],
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
executor: this.updateAgreement.bind(this),
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
definition: {
|
|
227
|
+
name: "pica_agreements_delete",
|
|
228
|
+
description: "Delete an agreement",
|
|
229
|
+
inputSchema: {
|
|
230
|
+
type: "object",
|
|
231
|
+
properties: {
|
|
232
|
+
id: {
|
|
233
|
+
type: "string",
|
|
234
|
+
description: "Agreement ID",
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
required: ["id"],
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
executor: this.deleteAgreement.bind(this),
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
definition: {
|
|
244
|
+
name: "pica_agreements_link_work",
|
|
245
|
+
description: "Link a work to an agreement. Optionally set a royalty split percentage.",
|
|
246
|
+
inputSchema: {
|
|
247
|
+
type: "object",
|
|
248
|
+
properties: {
|
|
249
|
+
agreement_id: {
|
|
250
|
+
type: "string",
|
|
251
|
+
description: "Agreement ID",
|
|
252
|
+
},
|
|
253
|
+
work_id: {
|
|
254
|
+
type: "string",
|
|
255
|
+
description: "Work ID to link",
|
|
256
|
+
},
|
|
257
|
+
royalty_split_percentage: {
|
|
258
|
+
type: "number",
|
|
259
|
+
description: "Royalty split percentage for this work (0-100)",
|
|
260
|
+
},
|
|
261
|
+
notes: {
|
|
262
|
+
type: "string",
|
|
263
|
+
description: "Notes about this work's inclusion in the agreement",
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
required: ["agreement_id", "work_id"],
|
|
267
|
+
},
|
|
268
|
+
},
|
|
269
|
+
executor: this.linkWork.bind(this),
|
|
270
|
+
},
|
|
271
|
+
];
|
|
272
|
+
}
|
|
273
|
+
async queryAgreements(args) {
|
|
274
|
+
const agreements = await this.pica.agreements.list({
|
|
275
|
+
query: args.query,
|
|
276
|
+
agreement_type: args.agreement_type,
|
|
277
|
+
status: args.status,
|
|
278
|
+
party_name: args.party_name,
|
|
279
|
+
includeWorkCounts: true,
|
|
280
|
+
limit: args.limit,
|
|
281
|
+
offset: args.offset,
|
|
282
|
+
});
|
|
283
|
+
return formatList(agreements, { total: agreements.length });
|
|
284
|
+
}
|
|
285
|
+
async inspectAgreement(args) {
|
|
286
|
+
const sections = args.sections;
|
|
287
|
+
const includeAll = !sections || sections.length === 0;
|
|
288
|
+
const needsBasic = includeAll ||
|
|
289
|
+
sections.includes("basic") ||
|
|
290
|
+
sections.includes("parties") ||
|
|
291
|
+
sections.includes("payments");
|
|
292
|
+
const needsWorks = includeAll || sections.includes("works");
|
|
293
|
+
// Fetch data in parallel where possible
|
|
294
|
+
const [fullResult, works] = await Promise.all([
|
|
295
|
+
needsBasic ? this.pica.agreements.get(args.id) : null,
|
|
296
|
+
needsWorks ? this.pica.agreements.getWorks(args.id) : null,
|
|
297
|
+
]);
|
|
298
|
+
const result = {};
|
|
299
|
+
if (includeAll || sections.includes("basic")) {
|
|
300
|
+
result.agreement = fullResult.agreement;
|
|
301
|
+
result.signatureStatus = fullResult.signatureStatus;
|
|
302
|
+
}
|
|
303
|
+
if (includeAll || sections.includes("works")) {
|
|
304
|
+
result.linkedWorks = works;
|
|
305
|
+
}
|
|
306
|
+
if (includeAll || sections.includes("parties")) {
|
|
307
|
+
// Parties are part of the agreement object
|
|
308
|
+
const agreement = fullResult.agreement;
|
|
309
|
+
result.parties = {
|
|
310
|
+
other_party_name: agreement.other_party_name,
|
|
311
|
+
other_party_type: agreement.other_party_type,
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
if (includeAll || sections.includes("payments")) {
|
|
315
|
+
// Payment info is part of the agreement object
|
|
316
|
+
const agreement = fullResult.agreement;
|
|
317
|
+
result.payments = {
|
|
318
|
+
royalty_rate: agreement.royalty_rate,
|
|
319
|
+
advance_amount: agreement.advance_amount,
|
|
320
|
+
payment_terms: agreement.payment_terms,
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
return formatSuccess("Agreement details", result);
|
|
324
|
+
}
|
|
325
|
+
async createAgreement(args) {
|
|
326
|
+
const agreement = await this.pica.agreements.create(args);
|
|
327
|
+
// Auto-notify other party if person_id provided
|
|
328
|
+
let notifySummary = "";
|
|
329
|
+
if (args.other_party_person_id) {
|
|
330
|
+
const results = await notifyParties(this.pica, [
|
|
331
|
+
{
|
|
332
|
+
person_id: args.other_party_person_id,
|
|
333
|
+
message: `a new ${args.agreement_type || "agreement"} has been created: "${args.title || "untitled"}" — please review`,
|
|
334
|
+
work_id: args.work_id,
|
|
335
|
+
notification_type: "agreement_created",
|
|
336
|
+
},
|
|
337
|
+
]);
|
|
338
|
+
notifySummary = summarizeNotifications(results);
|
|
339
|
+
}
|
|
340
|
+
const msg = notifySummary
|
|
341
|
+
? `Agreement created. ${notifySummary}`
|
|
342
|
+
: "Agreement created";
|
|
343
|
+
return formatSuccess(msg, agreement);
|
|
344
|
+
}
|
|
345
|
+
async updateAgreement(args) {
|
|
346
|
+
const { id, ...updates } = args;
|
|
347
|
+
const agreement = await this.pica.agreements.update(id, updates);
|
|
348
|
+
return formatSuccess("Agreement updated", agreement);
|
|
349
|
+
}
|
|
350
|
+
async deleteAgreement(args) {
|
|
351
|
+
await this.pica.agreements.delete(args.id);
|
|
352
|
+
return formatSuccess(`Agreement ${args.id} deleted`);
|
|
353
|
+
}
|
|
354
|
+
async linkWork(args) {
|
|
355
|
+
const link = await this.pica.agreements.linkWork(args.agreement_id, {
|
|
356
|
+
work_id: args.work_id,
|
|
357
|
+
royalty_split_percentage: args.royalty_split_percentage,
|
|
358
|
+
notes: args.notes,
|
|
359
|
+
});
|
|
360
|
+
return formatSuccess("Work linked to agreement", link);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
//# sourceMappingURL=agreements.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agreements.js","sourceRoot":"","sources":["../../src/tools/agreements.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAQ7D,OAAO,EAAgB,UAAU,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE5E,MAAM,mBAAmB,GAAG;IAC1B,kBAAkB;IAClB,eAAe;IACf,kBAAkB;IAClB,YAAY;IACZ,iBAAiB;IACjB,aAAa;IACb,QAAQ;IACR,OAAO;IACP,gBAAgB;IAChB,eAAe;IACf,YAAY;IACZ,cAAc;CACN,CAAC;AAEX,MAAM,OAAO,eAAe;IAClB,IAAI,CAAa;IAEzB,YAAY,IAAgB;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,QAAQ;QACN,OAAO;YACL;gBACE,UAA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AAC,CAAC;QACH,OAAO,aAAa,CAAC,0BAA0B,EAAE,IAAI,CAAC,CAAC;IACzD,CAAC;CACF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Analytics & Reporting Tools — carbon footprint, provenance, catalog diligence
|
|
3
|
+
*/
|
|
4
|
+
import { PicaClient } from "@withpica/mcp-sdk";
|
|
5
|
+
import { ToolDefinition, ToolExecutor } from "./index.js";
|
|
6
|
+
export declare class AnalyticsTools {
|
|
7
|
+
private pica;
|
|
8
|
+
constructor(pica: PicaClient);
|
|
9
|
+
getTools(): Array<{
|
|
10
|
+
definition: ToolDefinition;
|
|
11
|
+
executor: ToolExecutor;
|
|
12
|
+
}>;
|
|
13
|
+
private carbonSummary;
|
|
14
|
+
private carbonLive;
|
|
15
|
+
private provenanceStats;
|
|
16
|
+
private provenanceWork;
|
|
17
|
+
private provenanceCertificate;
|
|
18
|
+
private catalogDiligence;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=analytics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../../src/tools/analytics.ts"],"names":[],"mappings":"AAEA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,YAAY,EAAc,MAAM,YAAY,CAAC;AAGtE,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;YAkG3D,aAAa;YAKb,UAAU;YAKV,eAAe;YAOf,cAAc;YAKd,qBAAqB;YAYrB,gBAAgB;CAM/B"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
// Copyright (c) 2024-2026 Withpica Ltd. All rights reserved.
|
|
2
|
+
import { formatAsText, formatSuccess } from "@withpica/mcp-utils";
|
|
3
|
+
export class AnalyticsTools {
|
|
4
|
+
pica;
|
|
5
|
+
constructor(pica) {
|
|
6
|
+
this.pica = pica;
|
|
7
|
+
}
|
|
8
|
+
getTools() {
|
|
9
|
+
return [
|
|
10
|
+
// --- Carbon footprint ---
|
|
11
|
+
{
|
|
12
|
+
definition: {
|
|
13
|
+
name: "pica_carbon_footprint",
|
|
14
|
+
description: "Get the carbon footprint summary for your catalog — " +
|
|
15
|
+
"streaming, physical distribution, and production emissions.",
|
|
16
|
+
inputSchema: {
|
|
17
|
+
type: "object",
|
|
18
|
+
properties: {},
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
executor: this.carbonSummary.bind(this),
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
definition: {
|
|
25
|
+
name: "pica_carbon_live",
|
|
26
|
+
description: "Get live/real-time carbon metrics for ongoing streaming and distribution activity.",
|
|
27
|
+
inputSchema: {
|
|
28
|
+
type: "object",
|
|
29
|
+
properties: {},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
executor: this.carbonLive.bind(this),
|
|
33
|
+
},
|
|
34
|
+
// --- Provenance ---
|
|
35
|
+
{
|
|
36
|
+
definition: {
|
|
37
|
+
name: "pica_provenance_stats",
|
|
38
|
+
description: "Get provenance statistics — how many works have chain-of-title records, " +
|
|
39
|
+
"attestation coverage, and verification status.",
|
|
40
|
+
inputSchema: {
|
|
41
|
+
type: "object",
|
|
42
|
+
properties: {},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
executor: this.provenanceStats.bind(this),
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
definition: {
|
|
49
|
+
name: "pica_provenance_work",
|
|
50
|
+
description: "Get the full provenance chain for a specific work — " +
|
|
51
|
+
"creation history, ownership transfers, attestations, and verification entries.",
|
|
52
|
+
inputSchema: {
|
|
53
|
+
type: "object",
|
|
54
|
+
properties: {
|
|
55
|
+
work_id: {
|
|
56
|
+
type: "string",
|
|
57
|
+
description: "The work ID to get provenance for",
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
required: ["work_id"],
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
executor: this.provenanceWork.bind(this),
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
definition: {
|
|
67
|
+
name: "pica_provenance_certificate",
|
|
68
|
+
description: "Generate a provenance certificate for a work — " +
|
|
69
|
+
"a downloadable chain-of-title document with attestation details.",
|
|
70
|
+
inputSchema: {
|
|
71
|
+
type: "object",
|
|
72
|
+
properties: {
|
|
73
|
+
work_id: {
|
|
74
|
+
type: "string",
|
|
75
|
+
description: "The work ID to generate a certificate for",
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
required: ["work_id"],
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
executor: this.provenanceCertificate.bind(this),
|
|
82
|
+
},
|
|
83
|
+
// --- Catalog diligence ---
|
|
84
|
+
{
|
|
85
|
+
definition: {
|
|
86
|
+
name: "pica_catalog_diligence",
|
|
87
|
+
description: "Generate a technical due diligence report for the catalog — " +
|
|
88
|
+
"ownership clarity, registration coverage, identifier completeness, " +
|
|
89
|
+
"and readiness for lending, licensing, or acquisition.",
|
|
90
|
+
inputSchema: {
|
|
91
|
+
type: "object",
|
|
92
|
+
properties: {},
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
executor: this.catalogDiligence.bind(this),
|
|
96
|
+
},
|
|
97
|
+
];
|
|
98
|
+
}
|
|
99
|
+
async carbonSummary(_args) {
|
|
100
|
+
const result = await this.pica.analytics.carbonSummary();
|
|
101
|
+
return formatSuccess("Carbon footprint summary", result);
|
|
102
|
+
}
|
|
103
|
+
async carbonLive(_args) {
|
|
104
|
+
const result = await this.pica.analytics.carbonLive();
|
|
105
|
+
return formatSuccess("Live carbon metrics", result);
|
|
106
|
+
}
|
|
107
|
+
async provenanceStats(_args) {
|
|
108
|
+
const result = await this.pica.analytics.provenanceStats();
|
|
109
|
+
return formatAsText(result);
|
|
110
|
+
}
|
|
111
|
+
async provenanceWork(args) {
|
|
112
|
+
const result = await this.pica.analytics.provenanceWork(args.work_id);
|
|
113
|
+
return formatAsText(result);
|
|
114
|
+
}
|
|
115
|
+
async provenanceCertificate(args) {
|
|
116
|
+
const result = await this.pica.analytics.provenanceCertificate(args.work_id);
|
|
117
|
+
return formatSuccess(`Provenance certificate generated for work ${args.work_id}`, result);
|
|
118
|
+
}
|
|
119
|
+
async catalogDiligence(_args) {
|
|
120
|
+
const result = await this.pica.analytics.catalogDiligence();
|
|
121
|
+
return formatSuccess("Catalog diligence report", result);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=analytics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analytics.js","sourceRoot":"","sources":["../../src/tools/analytics.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,2BAA2B;YAC3B;gBACE,UAAU,EAAE;oBACV,IAAI,EAAE,uBAAuB;oBAC7B,WAAW,EACT,sDAAsD;wBACtD,6DAA6D;oBAC/D,WAAW,EAAE;wBACX,IAAI,EAAE,QAAQ;wBACd,UAAU,EAAE,EAAE;qBACf;iBACF;gBACD,QAAQ,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC;aACxC;YACD;gBACE,UAAU,EAAE;oBACV,IAAI,EAAE,kBAAkB;oBACxB,WAAW,EACT,oFAAoF;oBACtF,WAAW,EAAE;wBACX,IAAI,EAAE,QAAQ;wBACd,UAAU,EAAE,EAAE;qBACf;iBACF;gBACD,QAAQ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,CAAC,gBAAgB,EAAE,CAAC;QAC5D,OAAO,aAAa,CAAC,0BAA0B,EAAE,MAAM,CAAC,CAAC;IAC3D,CAAC;CACF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP App Tools — tools with _meta.ui for interactive iframe rendering.
|
|
3
|
+
*
|
|
4
|
+
* ADR-152: scope reduced to two generic cards (pica_upload, pica_download).
|
|
5
|
+
* Previous harness cards (pica_briefing, pica_asset_register) removed in 2a.1.
|
|
6
|
+
*/
|
|
7
|
+
import { PicaClient } from "@withpica/mcp-sdk";
|
|
8
|
+
import { ToolDefinition, ToolExecutor } from "./index.js";
|
|
9
|
+
export declare class AppTools {
|
|
10
|
+
private pica;
|
|
11
|
+
private exportTools;
|
|
12
|
+
constructor(pica: PicaClient);
|
|
13
|
+
getTools(): Array<{
|
|
14
|
+
definition: ToolDefinition;
|
|
15
|
+
executor: ToolExecutor;
|
|
16
|
+
}>;
|
|
17
|
+
private carPreview;
|
|
18
|
+
private upload;
|
|
19
|
+
private download;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=app-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-tools.d.ts","sourceRoot":"","sources":["../../src/tools/app-tools.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,YAAY,EAAc,MAAM,YAAY,CAAC;AAYtE,qBAAa,QAAQ;IACnB,OAAO,CAAC,IAAI,CAAa;IACzB,OAAO,CAAC,WAAW,CAAc;gBAErB,IAAI,EAAE,UAAU;IAK5B,QAAQ,IAAI,KAAK,CAAC;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,QAAQ,EAAE,YAAY,CAAA;KAAE,CAAC;YAqI3D,UAAU;YAuEV,MAAM;YAqBN,QAAQ;CA8BvB"}
|