@withpica/mcp-server 2.103.0 → 2.104.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +46 -0
- package/README.md +8 -4
- package/dist/lib/changelog.generated.d.ts +2 -2
- package/dist/lib/changelog.generated.d.ts.map +1 -1
- package/dist/lib/changelog.generated.js +2 -2
- package/dist/lib/changelog.generated.js.map +1 -1
- package/dist/resources/index.d.ts.map +1 -1
- package/dist/resources/index.js +23 -1
- package/dist/resources/index.js.map +1 -1
- package/dist/resources/required-schemas.generated.d.ts +77 -0
- package/dist/resources/required-schemas.generated.d.ts.map +1 -1
- package/dist/resources/required-schemas.generated.js +114 -0
- package/dist/resources/required-schemas.generated.js.map +1 -1
- package/dist/resources/required-schemas.source.d.ts.map +1 -1
- package/dist/resources/required-schemas.source.js +85 -0
- package/dist/resources/required-schemas.source.js.map +1 -1
- package/dist/server-instructions.d.ts +2 -2
- package/dist/server-instructions.d.ts.map +1 -1
- package/dist/server-instructions.js +2 -0
- package/dist/server-instructions.js.map +1 -1
- package/dist/skills/skills.generated.d.ts.map +1 -1
- package/dist/skills/skills.generated.js +25 -3
- package/dist/skills/skills.generated.js.map +1 -1
- package/dist/tools/catalogue-argument.d.ts +76 -0
- package/dist/tools/catalogue-argument.d.ts.map +1 -0
- package/dist/tools/catalogue-argument.js +114 -0
- package/dist/tools/catalogue-argument.js.map +1 -0
- package/dist/tools/custody.d.ts +2 -2
- package/dist/tools/custody.d.ts.map +1 -1
- package/dist/tools/custody.js +22 -20
- package/dist/tools/custody.js.map +1 -1
- package/dist/tools/dashboard.d.ts.map +1 -1
- package/dist/tools/dashboard.js +7 -4
- package/dist/tools/dashboard.js.map +1 -1
- package/dist/tools/discovery.d.ts.map +1 -1
- package/dist/tools/discovery.js +25 -2
- package/dist/tools/discovery.js.map +1 -1
- package/dist/tools/duplicates.d.ts +15 -2
- package/dist/tools/duplicates.d.ts.map +1 -1
- package/dist/tools/duplicates.js +109 -10
- package/dist/tools/duplicates.js.map +1 -1
- package/dist/tools/enrichment.d.ts.map +1 -1
- package/dist/tools/enrichment.js +6 -1
- package/dist/tools/enrichment.js.map +1 -1
- package/dist/tools/handovers.d.ts +42 -0
- package/dist/tools/handovers.d.ts.map +1 -0
- package/dist/tools/handovers.js +302 -0
- package/dist/tools/handovers.js.map +1 -0
- package/dist/tools/index.d.ts +6 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +78 -1
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/metadata.d.ts.map +1 -1
- package/dist/tools/metadata.js +80 -0
- package/dist/tools/metadata.js.map +1 -1
- package/dist/tools/recordings.d.ts.map +1 -1
- package/dist/tools/recordings.js +10 -2
- package/dist/tools/recordings.js.map +1 -1
- package/dist/tools/recovery-hints.d.ts.map +1 -1
- package/dist/tools/recovery-hints.js +116 -0
- package/dist/tools/recovery-hints.js.map +1 -1
- package/dist/tools/relationship-change.d.ts +16 -0
- package/dist/tools/relationship-change.d.ts.map +1 -0
- package/dist/tools/relationship-change.js +60 -0
- package/dist/tools/relationship-change.js.map +1 -0
- package/dist/tools/relationship-copy.d.ts +99 -0
- package/dist/tools/relationship-copy.d.ts.map +1 -0
- package/dist/tools/relationship-copy.js +213 -0
- package/dist/tools/relationship-copy.js.map +1 -0
- package/dist/tools/relationship-scope.d.ts +104 -0
- package/dist/tools/relationship-scope.d.ts.map +1 -0
- package/dist/tools/relationship-scope.js +106 -0
- package/dist/tools/relationship-scope.js.map +1 -0
- package/dist/tools/relationships.d.ts +64 -0
- package/dist/tools/relationships.d.ts.map +1 -0
- package/dist/tools/relationships.js +1062 -0
- package/dist/tools/relationships.js.map +1 -0
- package/dist/tools/settings.d.ts.map +1 -1
- package/dist/tools/settings.js +4 -1
- package/dist/tools/settings.js.map +1 -1
- package/dist/tools/works.d.ts +11 -0
- package/dist/tools/works.d.ts.map +1 -1
- package/dist/tools/works.js +63 -3
- package/dist/tools/works.js.map +1 -1
- package/package.json +3 -3
- package/scripts/build-required-schemas.ts +6 -4
- package/server.json +2 -2
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
// Copyright (c) 2025-2026 Withpica Ltd. All rights reserved.
|
|
2
|
+
/**
|
|
3
|
+
* ADR-333 D5 — building a catalogue for a client and handing it over, for
|
|
4
|
+
* assistants (plan #2808 §10).
|
|
5
|
+
*
|
|
6
|
+
* Organisation side: pica_handover_create, pica_handover_send. Client side:
|
|
7
|
+
* pica_handover_answer, which only says where to answer.
|
|
8
|
+
*
|
|
9
|
+
* Each organisation-side tool calls one /api/admin/handovers route, which
|
|
10
|
+
* holds no rules of its own: lib/services/catalogue-handovers.ts decides
|
|
11
|
+
* every step and refuses with a code and a plain sentence, passed on as is.
|
|
12
|
+
*
|
|
13
|
+
* Sending emails a client and offers them a catalogue, so it is the person's
|
|
14
|
+
* own decision (plan §10, "sending needs a human confirm"):
|
|
15
|
+
* - from a connected app or agent grant, pica_handover_send is
|
|
16
|
+
* `approvalMode: "human"`: the MCP route stages an approval, and on
|
|
17
|
+
* approval lib/services/handover-approvals.ts sends through the service,
|
|
18
|
+
* never this file;
|
|
19
|
+
* - from a credential the route refuses as HUMAN_CONFIRMATION_REQUIRED, the
|
|
20
|
+
* tool gives the screen to send it on.
|
|
21
|
+
*
|
|
22
|
+
* Accepting ownership is a person's own act (Orchestrator ruling 2026-10-12,
|
|
23
|
+
* option A): the client's routes take a signed-in session only, and no key
|
|
24
|
+
* reads them. pica_handover_answer therefore reads nothing and changes
|
|
25
|
+
* nothing; it gives the screen where the person answers.
|
|
26
|
+
*/
|
|
27
|
+
import { ApiError } from "@withpica/mcp-sdk";
|
|
28
|
+
import { formatSuccess } from "@withpica/mcp-utils";
|
|
29
|
+
import { typedError } from "./error-envelope.js";
|
|
30
|
+
import { parseApiErrorBody } from "./api-error-body.js";
|
|
31
|
+
import { webOrigin } from "./relationships.js";
|
|
32
|
+
import { HANDOVERS_PATH, NEW_HANDOVER_PATH, handoverPath, } from "./relationship-copy.js";
|
|
33
|
+
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
34
|
+
const EMAIL = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
35
|
+
const NAME_MAX = 200;
|
|
36
|
+
const EMAIL_MAX = 320;
|
|
37
|
+
/** The relationship the organisation keeps once the client accepts. */
|
|
38
|
+
export const HANDOVER_KEPT_TYPES = [
|
|
39
|
+
"administrator",
|
|
40
|
+
"representative",
|
|
41
|
+
"viewer",
|
|
42
|
+
];
|
|
43
|
+
const HANDOVER_ID = {
|
|
44
|
+
type: "string",
|
|
45
|
+
format: "uuid",
|
|
46
|
+
description: "The hand-over's id (handover_id from pica_handover_create, or from the hand-over's link).",
|
|
47
|
+
};
|
|
48
|
+
function invalid(fields) {
|
|
49
|
+
return typedError("VALIDATION_ERROR", Object.values(fields).join(" "), {
|
|
50
|
+
fields,
|
|
51
|
+
nothing_written: true,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function text(args, key, max, what) {
|
|
55
|
+
const v = args[key];
|
|
56
|
+
if (typeof v !== "string" || v.trim().length === 0 || v.length > max)
|
|
57
|
+
return invalid({
|
|
58
|
+
[key]: `${key} is required: ${what}, at most ${max} characters.`,
|
|
59
|
+
});
|
|
60
|
+
return v.trim();
|
|
61
|
+
}
|
|
62
|
+
function isResult(v) {
|
|
63
|
+
return typeof v === "object" && v !== null && "content" in v;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* A refusal from a hand-over route, as a typed result: the service's code
|
|
67
|
+
* and sentence as they are. HUMAN_CONFIRMATION_REQUIRED becomes the screen
|
|
68
|
+
* to do it on. A network failure or a 5xx is rethrown to the registry.
|
|
69
|
+
*/
|
|
70
|
+
function refusal(err, origin, screen) {
|
|
71
|
+
if (!(err instanceof ApiError) || err.status >= 500 || err.status === 0)
|
|
72
|
+
throw err;
|
|
73
|
+
const body = parseApiErrorBody(err);
|
|
74
|
+
const code = (body.code ?? `HTTP_${err.status}`).toUpperCase();
|
|
75
|
+
const message = body.message ?? "PICA refused this.";
|
|
76
|
+
if (code === "HUMAN_CONFIRMATION_REQUIRED") {
|
|
77
|
+
const url = `${origin}${screen.path}`;
|
|
78
|
+
return typedError(code, `Nothing was done: ${screen.doing} needs the person to confirm it themselves in PICA. Give them this link: ${url}`, { screen_url: url, nothing_written: true, retry_safe: false });
|
|
79
|
+
}
|
|
80
|
+
return typedError(code, message, {
|
|
81
|
+
nothing_written: true,
|
|
82
|
+
retry_safe: code === "RATE_LIMITED",
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
export class HandoverTools {
|
|
86
|
+
pica;
|
|
87
|
+
origin;
|
|
88
|
+
constructor(pica, apiUrl) {
|
|
89
|
+
this.pica = pica;
|
|
90
|
+
this.origin = webOrigin(apiUrl);
|
|
91
|
+
}
|
|
92
|
+
getTools() {
|
|
93
|
+
return [
|
|
94
|
+
{
|
|
95
|
+
definition: {
|
|
96
|
+
name: "pica_handover_create",
|
|
97
|
+
scope: "write:catalog",
|
|
98
|
+
audiences: ["stdio", "http", "public"],
|
|
99
|
+
tier: "write",
|
|
100
|
+
description: "Use when the user asks: 'set up a catalogue for my client', 'build Alice's catalogue so she can take it over', 'start a hand-over'. " +
|
|
101
|
+
"For an organisation that prepares a catalogue for a client who will own it. Creates the catalogue, with your organisation as its temporary builder; nothing is sent and nobody is emailed. " +
|
|
102
|
+
"While it is being prepared you can enter facts, but nothing can be published, agreed or signed in your organisation's favour. " +
|
|
103
|
+
"relationship_type is what your organisation keeps once the client accepts. " +
|
|
104
|
+
"To send again on a catalogue whose last hand-over was declined, expired or withdrawn, pass catalogue_org_id instead of catalogue_name. " +
|
|
105
|
+
"When it is ready, send it with pica_handover_send.",
|
|
106
|
+
workflows: "handover-required",
|
|
107
|
+
vernacular_kind: "specialist",
|
|
108
|
+
vernacular_reason: "Creates a catalogue owned by no one yet, for a named client; used by organisations that build catalogues for clients, by exact name.",
|
|
109
|
+
inputSchema: {
|
|
110
|
+
type: "object",
|
|
111
|
+
properties: {
|
|
112
|
+
catalogue_name: {
|
|
113
|
+
type: "string",
|
|
114
|
+
maxLength: NAME_MAX,
|
|
115
|
+
description: "The new catalogue's name, usually the client's name as they'd want to see it. Give this or catalogue_org_id, not both.",
|
|
116
|
+
},
|
|
117
|
+
catalogue_org_id: {
|
|
118
|
+
type: "string",
|
|
119
|
+
format: "uuid",
|
|
120
|
+
description: "Instead of catalogue_name: a catalogue your organisation built whose last hand-over was declined, expired or withdrawn, to send again.",
|
|
121
|
+
},
|
|
122
|
+
client_name: {
|
|
123
|
+
type: "string",
|
|
124
|
+
maxLength: NAME_MAX,
|
|
125
|
+
description: "The client's name.",
|
|
126
|
+
},
|
|
127
|
+
client_email: {
|
|
128
|
+
type: "string",
|
|
129
|
+
format: "email",
|
|
130
|
+
maxLength: EMAIL_MAX,
|
|
131
|
+
description: "The client's email. They accept by signing in to PICA with this address, once it is confirmed.",
|
|
132
|
+
},
|
|
133
|
+
relationship_type: {
|
|
134
|
+
type: "string",
|
|
135
|
+
enum: [...HANDOVER_KEPT_TYPES],
|
|
136
|
+
description: "What your organisation keeps once they accept. administrator: keeps the details up to date and registers songs; split and custody changes need the owner's yes. representative: sees the catalogue and suggests changes the owner approves. viewer: sees it, nothing more.",
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
required: ["client_name", "client_email", "relationship_type"],
|
|
140
|
+
},
|
|
141
|
+
requiredOneOf: [["catalogue_name", "catalogue_org_id"]],
|
|
142
|
+
},
|
|
143
|
+
executor: this.create.bind(this),
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
definition: {
|
|
147
|
+
name: "pica_handover_send",
|
|
148
|
+
scope: "write:catalog",
|
|
149
|
+
audiences: ["stdio", "http", "public"],
|
|
150
|
+
tier: "write",
|
|
151
|
+
approvalMode: "human",
|
|
152
|
+
description: "Send a catalogue your organisation prepared to its client, who then has 60 days to accept and become its owner. " +
|
|
153
|
+
"It emails the client at the address given to pica_handover_create. You can withdraw it on screen until they answer. " +
|
|
154
|
+
"Pass handover_id, and expected_version if you have it; if the hand-over changed since, nothing is sent. " +
|
|
155
|
+
"From a connected app this asks the person to approve first; otherwise, when PICA needs the person to confirm, it gives the link to send it on screen.",
|
|
156
|
+
workflows: "handover-required",
|
|
157
|
+
vernacular_kind: "specialist",
|
|
158
|
+
vernacular_reason: "Emails a client and offers them ownership of a catalogue; the organisation's own decision, invoked by exact name.",
|
|
159
|
+
inputSchema: {
|
|
160
|
+
type: "object",
|
|
161
|
+
properties: {
|
|
162
|
+
handover_id: HANDOVER_ID,
|
|
163
|
+
expected_version: {
|
|
164
|
+
type: "integer",
|
|
165
|
+
minimum: 1,
|
|
166
|
+
description: "Optional. The hand-over's version as you last read it. If it changed since, nothing is sent.",
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
required: ["handover_id"],
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
executor: this.send.bind(this),
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
definition: {
|
|
176
|
+
name: "pica_handover_answer",
|
|
177
|
+
scope: "read:catalog",
|
|
178
|
+
audiences: ["stdio", "http", "public"],
|
|
179
|
+
tier: "read",
|
|
180
|
+
description: "Use when the user asks: 'someone prepared a catalogue for me, how do I take it over?', 'I got an email to accept my catalogue', 'how do I accept my catalogue?'. " +
|
|
181
|
+
"Shows where to accept a catalogue prepared for you. It does not accept or decline, and it reads nothing. " +
|
|
182
|
+
"Accepting ownership is the person's own act: they sign in with the address it was sent to, keep or remove each item that names the organisation that built it, then accept or decline. " +
|
|
183
|
+
"Give handover_id from the email's link to point at that one; without it, the link lists everything waiting for them. " +
|
|
184
|
+
"For an organisation preparing one, use pica_handover_create.",
|
|
185
|
+
workflows: "handover-required",
|
|
186
|
+
vernacular_kind: "creator-entry",
|
|
187
|
+
inputSchema: {
|
|
188
|
+
type: "object",
|
|
189
|
+
properties: {
|
|
190
|
+
handover_id: {
|
|
191
|
+
...HANDOVER_ID,
|
|
192
|
+
description: "Optional. The hand-over's id, from the link in the email they received.",
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
required: [],
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
executor: this.answer.bind(this),
|
|
199
|
+
},
|
|
200
|
+
];
|
|
201
|
+
}
|
|
202
|
+
async create(args) {
|
|
203
|
+
const named = args.catalogue_name !== undefined;
|
|
204
|
+
const reissue = args.catalogue_org_id !== undefined;
|
|
205
|
+
if (named === reissue)
|
|
206
|
+
return invalid({
|
|
207
|
+
catalogue_name: "Give catalogue_name for a new catalogue, or catalogue_org_id to send one again; not both.",
|
|
208
|
+
});
|
|
209
|
+
let catalogue;
|
|
210
|
+
if (reissue) {
|
|
211
|
+
if (typeof args.catalogue_org_id !== "string" ||
|
|
212
|
+
!UUID.test(args.catalogue_org_id))
|
|
213
|
+
return invalid({
|
|
214
|
+
catalogue_org_id: "catalogue_org_id must be a catalogue's id.",
|
|
215
|
+
});
|
|
216
|
+
catalogue = { catalogue_org_id: args.catalogue_org_id };
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
const name = text(args, "catalogue_name", NAME_MAX, "the catalogue's name");
|
|
220
|
+
if (isResult(name))
|
|
221
|
+
return name;
|
|
222
|
+
catalogue = { catalogue_name: name };
|
|
223
|
+
}
|
|
224
|
+
const clientName = text(args, "client_name", NAME_MAX, "the client's name");
|
|
225
|
+
if (isResult(clientName))
|
|
226
|
+
return clientName;
|
|
227
|
+
const clientEmail = text(args, "client_email", EMAIL_MAX, "the client's email");
|
|
228
|
+
if (isResult(clientEmail))
|
|
229
|
+
return clientEmail;
|
|
230
|
+
if (!EMAIL.test(clientEmail))
|
|
231
|
+
return invalid({ client_email: "client_email is not an email address." });
|
|
232
|
+
const type = args.relationship_type;
|
|
233
|
+
if (!HANDOVER_KEPT_TYPES.includes(type))
|
|
234
|
+
return invalid({
|
|
235
|
+
relationship_type: `relationship_type must be one of: ${HANDOVER_KEPT_TYPES.join(", ")}.`,
|
|
236
|
+
});
|
|
237
|
+
let created;
|
|
238
|
+
try {
|
|
239
|
+
created = await this.pica.handovers.create({
|
|
240
|
+
...catalogue,
|
|
241
|
+
client_name: clientName,
|
|
242
|
+
client_email: clientEmail,
|
|
243
|
+
relationship_type: type,
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
catch (err) {
|
|
247
|
+
return refusal(err, this.origin, {
|
|
248
|
+
path: NEW_HANDOVER_PATH,
|
|
249
|
+
doing: "preparing a catalogue for a client",
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
const url = `${this.origin}${handoverPath(created.handover_id)}`;
|
|
253
|
+
return formatSuccess(`Prepared a catalogue for ${clientName}. Nothing has been sent. When it's ready, send it with pica_handover_send; the person can also review and send it here: ${url}`, {
|
|
254
|
+
handover_id: created.handover_id,
|
|
255
|
+
catalogue_org_id: created.catalogue_org_id,
|
|
256
|
+
status: "building",
|
|
257
|
+
screen_url: url,
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
async send(args) {
|
|
261
|
+
const id = args.handover_id;
|
|
262
|
+
if (typeof id !== "string" || !UUID.test(id))
|
|
263
|
+
return invalid({
|
|
264
|
+
handover_id: "handover_id must be a hand-over's id.",
|
|
265
|
+
});
|
|
266
|
+
const v = args.expected_version;
|
|
267
|
+
if (v !== undefined &&
|
|
268
|
+
(typeof v !== "number" || !Number.isInteger(v) || v < 1))
|
|
269
|
+
return invalid({
|
|
270
|
+
expected_version: "expected_version must be a whole number from 1.",
|
|
271
|
+
});
|
|
272
|
+
let sent;
|
|
273
|
+
try {
|
|
274
|
+
sent = await this.pica.handovers.send(id, v === undefined ? {} : { expected_version: v });
|
|
275
|
+
}
|
|
276
|
+
catch (err) {
|
|
277
|
+
return refusal(err, this.origin, {
|
|
278
|
+
path: handoverPath(id),
|
|
279
|
+
doing: "sending a hand-over",
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
const url = `${this.origin}${handoverPath(id)}`;
|
|
283
|
+
return formatSuccess(`Sent to ${sent.client_name}. They have until ${sent.expires_at?.slice(0, 10) ?? "the deadline"} to accept. Withdraw it here until they answer: ${url}`, {
|
|
284
|
+
handover_id: sent.handover_id,
|
|
285
|
+
status: sent.status,
|
|
286
|
+
sent_at: sent.sent_at,
|
|
287
|
+
expires_at: sent.expires_at,
|
|
288
|
+
version: sent.version,
|
|
289
|
+
screen_url: url,
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
async answer(args) {
|
|
293
|
+
const id = args.handover_id;
|
|
294
|
+
if (id !== undefined && (typeof id !== "string" || !UUID.test(id)))
|
|
295
|
+
return invalid({
|
|
296
|
+
handover_id: "handover_id must be the id from the hand-over's link.",
|
|
297
|
+
});
|
|
298
|
+
const url = `${this.origin}${id ? handoverPath(id) : HANDOVERS_PATH}`;
|
|
299
|
+
return formatSuccess(`Nothing was accepted or declined: that's done by the person, signed in to PICA with the address it was sent to. Give them this link: ${url}`, { screen_url: url, nothing_written: true });
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
//# sourceMappingURL=handovers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handovers.js","sourceRoot":"","sources":["../../src/tools/handovers.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,QAAQ,EAAmB,MAAM,mBAAmB,CAAC;AAE9D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,YAAY,GACb,MAAM,wBAAwB,CAAC;AAEhC,MAAM,IAAI,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EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,EAAY,CAAC,CAAC,CAAC,CAAC,cAAc,EAAE,CAAC;QAChF,OAAO,aAAa,CAClB,wIAAwI,GAAG,EAAE,EAC7I,EAAE,UAAU,EAAE,GAAG,EAAE,eAAe,EAAE,IAAI,EAAE,CAC3C,CAAC;IACJ,CAAC;CACF"}
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -46,7 +46,7 @@ export interface NextStepHint {
|
|
|
46
46
|
* Optional in W1; W4 flips it to required after W2's resource registry
|
|
47
47
|
* lands so every tool is forced to declare its workflow at compile time.
|
|
48
48
|
*/
|
|
49
|
-
export type WorkflowTag = "work-required" | "recording-required" | "work-credits-required" | "recording-credits-required" | "person-required" | "audio-upload-required" | "enrichment-resolve-required" | "agreement-required" | "multimedia-required" | "export-required" | "claim-required" | "session-required" | "split-sheet-required" | "recording-splits-required" | "sync-placement-required" | "infrastructure";
|
|
49
|
+
export type WorkflowTag = "work-required" | "recording-required" | "work-credits-required" | "recording-credits-required" | "person-required" | "audio-upload-required" | "enrichment-resolve-required" | "agreement-required" | "multimedia-required" | "export-required" | "claim-required" | "session-required" | "split-sheet-required" | "recording-splits-required" | "sync-placement-required" | "relationship-required" | "handover-required" | "infrastructure";
|
|
50
50
|
/**
|
|
51
51
|
* ADR-226 Decision 2 — vernacular intent posture for every tool.
|
|
52
52
|
*
|
|
@@ -606,6 +606,11 @@ export declare class ToolRegistry {
|
|
|
606
606
|
* mutable state that would race between concurrent requests.
|
|
607
607
|
*/
|
|
608
608
|
executeTool(name: string, args: Record<string, any>, ctx?: ToolExecutorContext): Promise<any>;
|
|
609
|
+
/**
|
|
610
|
+
* `executeTool` after the catalogue is settled. `args` are the arguments as
|
|
611
|
+
* called (gates, tokens, audit); `executorArgs` are what the tool receives.
|
|
612
|
+
*/
|
|
613
|
+
private executeToolInCatalogue;
|
|
609
614
|
}
|
|
610
615
|
export {};
|
|
611
616
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAEA;;;GAGG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACxE,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAEA;;;GAGG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACxE,OAAO,EACL,UAAU,EAGX,MAAM,mBAAmB,CAAC;AAmG3B,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAW5C,OAAO,EACL,cAAc,EACd,KAAK,aAAa,IAAI,iBAAiB,EACxC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAShD,iFAAiF;AACjF,MAAM,WAAW,aAAc,SAAQ,iBAAiB;IACtD,4EAA4E;IAC5E,WAAW,CAAC,EAAE,KAAK,EAAE,CAAC;CACvB;AACD,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAIL,KAAK,YAAY,EAElB,MAAM,qBAAqB,CAAC;AAE7B;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,0EAA0E;IAC1E,IAAI,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,MAAM,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,IAAI,EAAE,YAAY,GAAG,YAAY,GAAG,oBAAoB,CAAC;CAC1D;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,WAAW,GACnB,eAAe,GACf,oBAAoB,GACpB,uBAAuB,GACvB,4BAA4B,GAC5B,iBAAiB,GACjB,uBAAuB,GACvB,6BAA6B,GAC7B,oBAAoB,GACpB,qBAAqB,GACrB,iBAAiB,GACjB,gBAAgB,GAChB,kBAAkB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;IAY1B;;;;;;;;;;;;;;;;OAgBG;IACH,OAAO,CAAC,kBAAkB,CAqDxB;IAEF;;;;;;;;;;;;;;;;OAgBG;IACH,OAAO,CAAC,iBAAiB;IAuBzB;;;;;;OAMG;YACW,kBAAkB;IAmChC;;;;;;OAMG;IACG,WAAW,CACf,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACzB,GAAG,CAAC,EAAE,mBAAmB,GACxB,OAAO,CAAC,GAAG,CAAC;IAyCf;;;OAGG;YACW,sBAAsB;CA+TrC"}
|
package/dist/tools/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
// Copyright (c) 2025-2026 Withpica Ltd. All rights reserved.
|
|
2
|
+
import { currentCatalogue, runInCatalogue, } from "@withpica/mcp-sdk";
|
|
3
|
+
import { CATALOGUE_ARG, CATALOGUE_PROPERTY, catalogueRefusal, settleCatalogueAnswer, takesCatalogue, } from "./catalogue-argument.js";
|
|
2
4
|
import { WorksTools } from "./works.js";
|
|
3
5
|
import { PeopleTools } from "./people.js";
|
|
4
6
|
import { ApprovalsTools } from "./approvals.js";
|
|
@@ -56,6 +58,8 @@ import { MyRecentQuestionsTools } from "./my-recent-questions.js";
|
|
|
56
58
|
import { AgentIdentityTools } from "./agent-identity.js";
|
|
57
59
|
import { RoyaltiesTools } from "./royalties.js";
|
|
58
60
|
import { RightsTools } from "./rights.js";
|
|
61
|
+
import { RelationshipTools } from "./relationships.js";
|
|
62
|
+
import { HandoverTools } from "./handovers.js";
|
|
59
63
|
import { StatementsTools } from "./statements.js";
|
|
60
64
|
import { SelectionsTools } from "./selections.js";
|
|
61
65
|
import { ShareLinksTools } from "./share-links.js";
|
|
@@ -963,6 +967,34 @@ export class ToolRegistry {
|
|
|
963
967
|
syncFitTools.getTools().forEach((tool) => {
|
|
964
968
|
this.tools.set(tool.definition.name, tool);
|
|
965
969
|
});
|
|
970
|
+
// ADR-333 — who looks after whose catalogue (both sides).
|
|
971
|
+
const relationshipTools = new RelationshipTools(pica, this.config?.picaApiUrl);
|
|
972
|
+
relationshipTools.getTools().forEach((tool) => {
|
|
973
|
+
this.tools.set(tool.definition.name, tool);
|
|
974
|
+
});
|
|
975
|
+
// ADR-333 D5 — a catalogue built for a client, then handed over.
|
|
976
|
+
const handoverTools = new HandoverTools(pica, this.config?.picaApiUrl);
|
|
977
|
+
handoverTools.getTools().forEach((tool) => {
|
|
978
|
+
this.tools.set(tool.definition.name, tool);
|
|
979
|
+
});
|
|
980
|
+
// ADR-333 D7 — every tool that acts on a catalogue's own records takes an
|
|
981
|
+
// optional `catalogue` (./catalogue-argument.ts). Added here, once, so
|
|
982
|
+
// tools/list, pica_tool_details and pica_execute all see the same schema,
|
|
983
|
+
// and before aliases are cloned so an alias carries it too.
|
|
984
|
+
for (const tool of this.tools.values()) {
|
|
985
|
+
if (!takesCatalogue(tool.definition))
|
|
986
|
+
continue;
|
|
987
|
+
tool.definition = {
|
|
988
|
+
...tool.definition,
|
|
989
|
+
inputSchema: {
|
|
990
|
+
...tool.definition.inputSchema,
|
|
991
|
+
properties: {
|
|
992
|
+
...tool.definition.inputSchema.properties,
|
|
993
|
+
[CATALOGUE_ARG]: CATALOGUE_PROPERTY,
|
|
994
|
+
},
|
|
995
|
+
},
|
|
996
|
+
};
|
|
997
|
+
}
|
|
966
998
|
// Discovery meta-tools — registered last so pica_tool_details can look up
|
|
967
999
|
// all tool definitions. Only active when discoveryMode is enabled.
|
|
968
1000
|
if (this.config?.discoveryMode) {
|
|
@@ -1585,6 +1617,13 @@ export class ToolRegistry {
|
|
|
1585
1617
|
const cacheKey = this.getSessionCacheKey();
|
|
1586
1618
|
if (!cacheKey)
|
|
1587
1619
|
return;
|
|
1620
|
+
// Not in a client's catalogue: the counts read (catalog/stats) does not
|
|
1621
|
+
// open through a relationship, so it would be refused, and that refusal
|
|
1622
|
+
// would be judged as part of the tool's own answer (settleCatalogueAnswer
|
|
1623
|
+
// reads every request the call made). The counts would be the caller's
|
|
1624
|
+
// own catalogue's anyway, not the client's.
|
|
1625
|
+
if (currentCatalogue() !== undefined)
|
|
1626
|
+
return;
|
|
1588
1627
|
try {
|
|
1589
1628
|
incrementSessionMutations(cacheKey);
|
|
1590
1629
|
const sessionState = await buildSessionState(cacheKey, this.fetchSessionCounts);
|
|
@@ -1611,6 +1650,44 @@ export class ToolRegistry {
|
|
|
1611
1650
|
* mutable state that would race between concurrent requests.
|
|
1612
1651
|
*/
|
|
1613
1652
|
async executeTool(name, args, ctx) {
|
|
1653
|
+
// ADR-333 D7 — a call naming a client catalogue runs entirely inside it:
|
|
1654
|
+
// the confirmation preview, the executor and the session-state read all
|
|
1655
|
+
// make their requests for that catalogue. The argument stays in the
|
|
1656
|
+
// confirmation token's arguments (so a token confirmed for one client
|
|
1657
|
+
// cannot be replayed for another) and in the audit row, but is removed
|
|
1658
|
+
// before the executor, which would otherwise send it on to the app.
|
|
1659
|
+
const catalogue = args?.[CATALOGUE_ARG];
|
|
1660
|
+
// pica_execute may carry the wrapped tool's arguments flat, `catalogue`
|
|
1661
|
+
// among them; it reaches this method again for the wrapped tool, which
|
|
1662
|
+
// is where the argument is checked and applied.
|
|
1663
|
+
if (catalogue === undefined || name === "pica_execute") {
|
|
1664
|
+
return this.executeToolInCatalogue(name, args, args, ctx);
|
|
1665
|
+
}
|
|
1666
|
+
const tool = this.tools.get(name);
|
|
1667
|
+
if (!tool) {
|
|
1668
|
+
throw new ToolExecutionError(`Tool not found: ${name}`);
|
|
1669
|
+
}
|
|
1670
|
+
const refusal = catalogueRefusal(tool.definition, catalogue);
|
|
1671
|
+
if (refusal) {
|
|
1672
|
+
return {
|
|
1673
|
+
content: [
|
|
1674
|
+
{
|
|
1675
|
+
type: "text",
|
|
1676
|
+
text: JSON.stringify({ error: "CATALOGUE_NOT_SUPPORTED", message: refusal }, null, 2),
|
|
1677
|
+
},
|
|
1678
|
+
],
|
|
1679
|
+
isError: true,
|
|
1680
|
+
};
|
|
1681
|
+
}
|
|
1682
|
+
const { [CATALOGUE_ARG]: _catalogue, ...executorArgs } = args;
|
|
1683
|
+
const { value, report } = await runInCatalogue(catalogue, () => this.executeToolInCatalogue(name, args, executorArgs, ctx));
|
|
1684
|
+
return settleCatalogueAnswer(name, value, report);
|
|
1685
|
+
}
|
|
1686
|
+
/**
|
|
1687
|
+
* `executeTool` after the catalogue is settled. `args` are the arguments as
|
|
1688
|
+
* called (gates, tokens, audit); `executorArgs` are what the tool receives.
|
|
1689
|
+
*/
|
|
1690
|
+
async executeToolInCatalogue(name, args, executorArgs, ctx) {
|
|
1614
1691
|
const startTime = Date.now();
|
|
1615
1692
|
const tool = this.tools.get(name);
|
|
1616
1693
|
if (!tool) {
|
|
@@ -1743,7 +1820,7 @@ export class ToolRegistry {
|
|
|
1743
1820
|
}
|
|
1744
1821
|
// ── Normal execution ──
|
|
1745
1822
|
try {
|
|
1746
|
-
const result = await tool.executor(
|
|
1823
|
+
const result = await tool.executor(executorArgs, ctx);
|
|
1747
1824
|
// Guard response size — envelope-aware (ops 41ff656c / 893e3e29): list
|
|
1748
1825
|
// responses over the 100KB cap get whole-item trimming + a real resume
|
|
1749
1826
|
// cursor (next_offset / recovery_hint) in both views; non-list shapes
|