@withpica/mcp-server 1.3.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/.claude/settings.local.json +5 -0
- package/CHANGELOG.md +1850 -0
- package/README.md +304 -0
- 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/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/release.d.ts +2 -0
- package/dist/apps/release.d.ts.map +1 -0
- package/dist/apps/release.js +69 -0
- package/dist/apps/release.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 +14 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +73 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +35 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts/index.d.ts +86 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +645 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/resources/agent-guide.d.ts +15 -0
- package/dist/resources/agent-guide.d.ts.map +1 -0
- package/dist/resources/agent-guide.js +284 -0
- package/dist/resources/agent-guide.js.map +1 -0
- package/dist/resources/index.d.ts +66 -0
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/resources/index.js +510 -0
- package/dist/resources/index.js.map +1 -0
- 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/resources/required-schemas.generated.d.ts +455 -0
- package/dist/resources/required-schemas.generated.d.ts.map +1 -0
- package/dist/resources/required-schemas.generated.js +1041 -0
- package/dist/resources/required-schemas.generated.js.map +1 -0
- package/dist/resources/required-schemas.source.d.ts +53 -0
- package/dist/resources/required-schemas.source.d.ts.map +1 -0
- package/dist/resources/required-schemas.source.js +493 -0
- package/dist/resources/required-schemas.source.js.map +1 -0
- package/dist/resources/welcome.d.ts +14 -0
- package/dist/resources/welcome.d.ts.map +1 -0
- package/dist/resources/welcome.js +26 -0
- package/dist/resources/welcome.js.map +1 -0
- package/dist/server-instructions.d.ts +60 -0
- package/dist/server-instructions.d.ts.map +1 -0
- package/dist/server-instructions.js +93 -0
- package/dist/server-instructions.js.map +1 -0
- package/dist/server.d.ts +52 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +334 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/access-simulate.d.ts +23 -0
- package/dist/tools/access-simulate.d.ts.map +1 -0
- package/dist/tools/access-simulate.js +162 -0
- package/dist/tools/access-simulate.js.map +1 -0
- package/dist/tools/agent-identity.d.ts +36 -0
- package/dist/tools/agent-identity.d.ts.map +1 -0
- package/dist/tools/agent-identity.js +274 -0
- package/dist/tools/agent-identity.js.map +1 -0
- 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 +281 -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 +282 -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 +130 -0
- package/dist/tools/analytics.js.map +1 -0
- package/dist/tools/app-tools.d.ts +15 -0
- package/dist/tools/app-tools.d.ts.map +1 -0
- package/dist/tools/app-tools.js +388 -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 +454 -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 +409 -0
- package/dist/tools/audio-files.js.map +1 -0
- package/dist/tools/audit.d.ts +19 -0
- package/dist/tools/audit.d.ts.map +1 -0
- package/dist/tools/audit.js +58 -0
- package/dist/tools/audit.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 +212 -0
- package/dist/tools/auth.js.map +1 -0
- package/dist/tools/bulk.d.ts +22 -0
- package/dist/tools/bulk.d.ts.map +1 -0
- package/dist/tools/bulk.js +164 -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 +68 -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 +381 -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 +80 -0
- package/dist/tools/comparisons.js.map +1 -0
- package/dist/tools/credits.d.ts +39 -0
- package/dist/tools/credits.d.ts.map +1 -0
- package/dist/tools/credits.js +541 -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 +281 -0
- package/dist/tools/custody.js.map +1 -0
- package/dist/tools/dashboard.d.ts +22 -0
- package/dist/tools/dashboard.d.ts.map +1 -0
- package/dist/tools/dashboard.js +258 -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 +107 -0
- package/dist/tools/directory.js.map +1 -0
- package/dist/tools/discovery.d.ts +49 -0
- package/dist/tools/discovery.d.ts.map +1 -0
- package/dist/tools/discovery.js +851 -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 +62 -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 +37 -0
- package/dist/tools/documents.js.map +1 -0
- package/dist/tools/duplicates.d.ts +25 -0
- package/dist/tools/duplicates.d.ts.map +1 -0
- package/dist/tools/duplicates.js +108 -0
- package/dist/tools/duplicates.js.map +1 -0
- package/dist/tools/enrichment.d.ts +56 -0
- package/dist/tools/enrichment.d.ts.map +1 -0
- package/dist/tools/enrichment.js +616 -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 +184 -0
- package/dist/tools/exports.js.map +1 -0
- package/dist/tools/feedback.d.ts +22 -0
- package/dist/tools/feedback.d.ts.map +1 -0
- package/dist/tools/feedback.js +100 -0
- package/dist/tools/feedback.js.map +1 -0
- package/dist/tools/forbidden-keywords.d.ts +62 -0
- package/dist/tools/forbidden-keywords.d.ts.map +1 -0
- package/dist/tools/forbidden-keywords.js +99 -0
- package/dist/tools/forbidden-keywords.js.map +1 -0
- package/dist/tools/gap-hints.d.ts +53 -0
- package/dist/tools/gap-hints.d.ts.map +1 -0
- package/dist/tools/gap-hints.js +245 -0
- package/dist/tools/gap-hints.js.map +1 -0
- package/dist/tools/groups.d.ts +29 -0
- package/dist/tools/groups.d.ts.map +1 -0
- package/dist/tools/groups.js +186 -0
- package/dist/tools/groups.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 +206 -0
- package/dist/tools/import-documents.js.map +1 -0
- package/dist/tools/import.d.ts +31 -0
- package/dist/tools/import.d.ts.map +1 -0
- package/dist/tools/import.js +610 -0
- package/dist/tools/import.js.map +1 -0
- package/dist/tools/index.d.ts +293 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +1182 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/integrations.d.ts +19 -0
- package/dist/tools/integrations.d.ts.map +1 -0
- package/dist/tools/integrations.js +120 -0
- package/dist/tools/integrations.js.map +1 -0
- package/dist/tools/labels.d.ts +20 -0
- package/dist/tools/labels.d.ts.map +1 -0
- package/dist/tools/labels.js +48 -0
- package/dist/tools/labels.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 +436 -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 +120 -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 +1532 -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 +371 -0
- package/dist/tools/multimedia.js.map +1 -0
- package/dist/tools/my-reported-issues.d.ts +32 -0
- package/dist/tools/my-reported-issues.d.ts.map +1 -0
- package/dist/tools/my-reported-issues.js +123 -0
- package/dist/tools/my-reported-issues.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 +115 -0
- package/dist/tools/notes.js.map +1 -0
- package/dist/tools/notifications.d.ts +28 -0
- package/dist/tools/notifications.d.ts.map +1 -0
- package/dist/tools/notifications.js +417 -0
- package/dist/tools/notifications.js.map +1 -0
- package/dist/tools/onboarding.d.ts +24 -0
- package/dist/tools/onboarding.d.ts.map +1 -0
- package/dist/tools/onboarding.js +81 -0
- package/dist/tools/onboarding.js.map +1 -0
- package/dist/tools/people.d.ts +254 -0
- package/dist/tools/people.d.ts.map +1 -0
- package/dist/tools/people.js +481 -0
- package/dist/tools/people.js.map +1 -0
- package/dist/tools/projects.d.ts +20 -0
- package/dist/tools/projects.d.ts.map +1 -0
- package/dist/tools/projects.js +316 -0
- package/dist/tools/projects.js.map +1 -0
- package/dist/tools/public-filter.d.ts +43 -0
- package/dist/tools/public-filter.d.ts.map +1 -0
- package/dist/tools/public-filter.js +356 -0
- package/dist/tools/public-filter.js.map +1 -0
- package/dist/tools/publishers.d.ts +30 -0
- package/dist/tools/publishers.d.ts.map +1 -0
- package/dist/tools/publishers.js +105 -0
- package/dist/tools/publishers.js.map +1 -0
- package/dist/tools/purchases.d.ts +27 -0
- package/dist/tools/purchases.d.ts.map +1 -0
- package/dist/tools/purchases.js +9 -0
- package/dist/tools/purchases.js.map +1 -0
- package/dist/tools/recording-attribution-hints.d.ts +24 -0
- package/dist/tools/recording-attribution-hints.d.ts.map +1 -0
- package/dist/tools/recording-attribution-hints.js +27 -0
- package/dist/tools/recording-attribution-hints.js.map +1 -0
- package/dist/tools/recordings.d.ts +96 -0
- package/dist/tools/recordings.d.ts.map +1 -0
- package/dist/tools/recordings.js +564 -0
- package/dist/tools/recordings.js.map +1 -0
- package/dist/tools/recovery-hints.d.ts +40 -0
- package/dist/tools/recovery-hints.d.ts.map +1 -0
- package/dist/tools/recovery-hints.js +827 -0
- package/dist/tools/recovery-hints.js.map +1 -0
- package/dist/tools/release-rich.d.ts +31 -0
- package/dist/tools/release-rich.d.ts.map +1 -0
- package/dist/tools/release-rich.js +245 -0
- package/dist/tools/release-rich.js.map +1 -0
- package/dist/tools/releases.d.ts +36 -0
- package/dist/tools/releases.d.ts.map +1 -0
- package/dist/tools/releases.js +649 -0
- package/dist/tools/releases.js.map +1 -0
- package/dist/tools/report-issue.d.ts +21 -0
- package/dist/tools/report-issue.d.ts.map +1 -0
- package/dist/tools/report-issue.js +101 -0
- package/dist/tools/report-issue.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 +262 -0
- package/dist/tools/royalties.js.map +1 -0
- package/dist/tools/search.d.ts +30 -0
- package/dist/tools/search.d.ts.map +1 -0
- package/dist/tools/search.js +115 -0
- package/dist/tools/search.js.map +1 -0
- package/dist/tools/send.d.ts +17 -0
- package/dist/tools/send.d.ts.map +1 -0
- package/dist/tools/send.js +188 -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 +153 -0
- package/dist/tools/sessions.js.map +1 -0
- package/dist/tools/settings.d.ts +23 -0
- package/dist/tools/settings.d.ts.map +1 -0
- package/dist/tools/settings.js +365 -0
- package/dist/tools/settings.js.map +1 -0
- package/dist/tools/share-links.d.ts +22 -0
- package/dist/tools/share-links.d.ts.map +1 -0
- package/dist/tools/share-links.js +188 -0
- package/dist/tools/share-links.js.map +1 -0
- package/dist/tools/signup.d.ts +26 -0
- package/dist/tools/signup.d.ts.map +1 -0
- package/dist/tools/signup.js +266 -0
- package/dist/tools/signup.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 +309 -0
- package/dist/tools/split-sheets.js.map +1 -0
- package/dist/tools/storage-config.d.ts +13 -0
- package/dist/tools/storage-config.d.ts.map +1 -0
- package/dist/tools/storage-config.js +245 -0
- package/dist/tools/storage-config.js.map +1 -0
- package/dist/tools/subscription.d.ts +60 -0
- package/dist/tools/subscription.d.ts.map +1 -0
- package/dist/tools/subscription.js +440 -0
- package/dist/tools/subscription.js.map +1 -0
- package/dist/tools/sync-placements.d.ts +31 -0
- package/dist/tools/sync-placements.d.ts.map +1 -0
- package/dist/tools/sync-placements.js +431 -0
- package/dist/tools/sync-placements.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 +144 -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 +144 -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 +165 -0
- package/dist/tools/uploads.js.map +1 -0
- package/dist/tools/works.d.ts +71 -0
- package/dist/tools/works.d.ts.map +1 -0
- package/dist/tools/works.js +694 -0
- package/dist/tools/works.js.map +1 -0
- package/package.json +54 -0
- package/scripts/build-required-schemas.ts +233 -0
- package/scripts/bundle-apps.ts +61 -0
- package/scripts/refresh-schema-mirror.ts +182 -0
- package/server.json +20 -0
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
// Copyright (c) 2024-2026 Withpica Ltd. All rights reserved.
|
|
2
|
+
/**
|
|
3
|
+
* Signup Tools — `pica_signup_start` (ADR-211 Phase 1).
|
|
4
|
+
*
|
|
5
|
+
* The single MCP-discoverable signup verb. Available unauthenticated on
|
|
6
|
+
* BOTH transports (stdio binary's lobby + HTTP `/api/mcp` anonymous mode)
|
|
7
|
+
* per ADR-211 § Primitive A (amended 2026-04-30 to expose alongside
|
|
8
|
+
* `pica_sign_in` / `pica_sign_out` rather than replace them in Phase 1).
|
|
9
|
+
*
|
|
10
|
+
* Mints nothing locally — every invocation calls the public backend
|
|
11
|
+
* endpoint `POST /api/public/onboarding/signup-start`. The signing secret
|
|
12
|
+
* (`ONBOARDING_TOKEN_SECRET`) lives only on the backend; customer-
|
|
13
|
+
* distributed `npx @withpica/mcp-server` binaries can never see it. Same
|
|
14
|
+
* pattern that `pica_sign_in` (auth.ts) uses to call the public
|
|
15
|
+
* `/api/public/mcp-auth/authorize` magic-link endpoint.
|
|
16
|
+
*
|
|
17
|
+
* Returns the JWT-bound URL via:
|
|
18
|
+
* - `resource_link` (universal floor — every MCP client can render this)
|
|
19
|
+
* - capability-gated `elicitation/create url` (mode: "url"; for clients
|
|
20
|
+
* advertising `capabilities.elicitation.url`, server-issued consent
|
|
21
|
+
* prompt to open the link in-line). See ADR-200 + `pica_upload`.
|
|
22
|
+
*
|
|
23
|
+
* Construction takes the API base URL + transport + optional DCR
|
|
24
|
+
* client_id. The stdio binary stamps `transport: "stdio"`; the HTTP
|
|
25
|
+
* carve-out in `app/api/mcp/route.ts` stamps `transport: "http"` and
|
|
26
|
+
* passes `client_id` from the OAuth-protected-resource discovery context
|
|
27
|
+
* when one is present.
|
|
28
|
+
*/
|
|
29
|
+
import { randomUUID } from "node:crypto";
|
|
30
|
+
import { clientSupportsUrlElicitation } from "@withpica/mcp-utils";
|
|
31
|
+
const EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
32
|
+
export class SignupTools {
|
|
33
|
+
apiUrl;
|
|
34
|
+
transport;
|
|
35
|
+
clientId;
|
|
36
|
+
constructor(config) {
|
|
37
|
+
if (!config.apiUrl) {
|
|
38
|
+
throw new Error("SignupTools requires apiUrl");
|
|
39
|
+
}
|
|
40
|
+
if (config.transport !== "stdio" && config.transport !== "http") {
|
|
41
|
+
throw new Error(`SignupTools.transport must be "stdio" or "http" (got: ${config.transport})`);
|
|
42
|
+
}
|
|
43
|
+
if (config.transport === "stdio" && config.clientId) {
|
|
44
|
+
// stdio has no DCR client identifier. Constructor enforces the
|
|
45
|
+
// invariant locally so the public endpoint never sees a confused
|
|
46
|
+
// pairing in the first place.
|
|
47
|
+
throw new Error("clientId must be null for stdio transport");
|
|
48
|
+
}
|
|
49
|
+
this.apiUrl = config.apiUrl.replace(/\/+$/, "");
|
|
50
|
+
this.transport = config.transport;
|
|
51
|
+
this.clientId = config.clientId ?? null;
|
|
52
|
+
}
|
|
53
|
+
getTools() {
|
|
54
|
+
return [
|
|
55
|
+
{
|
|
56
|
+
definition: {
|
|
57
|
+
name: "pica_signup_start",
|
|
58
|
+
description: "Sign up for withPICA from inside the agent, without leaving the chat. " +
|
|
59
|
+
"Use this when the user wants to create a new withPICA account / catalog " +
|
|
60
|
+
"and you're talking to them through an unauthenticated MCP connection " +
|
|
61
|
+
"(stdio without an API key, or HTTP without a Bearer token). The tool " +
|
|
62
|
+
"mints a single-use signup link valid for 15 minutes — surface the URL " +
|
|
63
|
+
"to the user as a clickable resource_link. The link opens a page that " +
|
|
64
|
+
"verifies their email by magic-link, creates their organisation, starts " +
|
|
65
|
+
"the 14-day free trial, and (for stdio) shows a connection key to paste " +
|
|
66
|
+
"into Claude Desktop's MCP config or (for HTTP) resumes the OAuth flow. " +
|
|
67
|
+
"For existing users, prefer pica_sign_in.",
|
|
68
|
+
workflows: "infrastructure",
|
|
69
|
+
inputSchema: {
|
|
70
|
+
type: "object",
|
|
71
|
+
properties: {
|
|
72
|
+
email: {
|
|
73
|
+
type: "string",
|
|
74
|
+
description: "The user's email address. The signup link is sent to this " +
|
|
75
|
+
"inbox; the user clicks it to verify ownership before any " +
|
|
76
|
+
"account is created. Required.",
|
|
77
|
+
},
|
|
78
|
+
org_name: {
|
|
79
|
+
type: "string",
|
|
80
|
+
description: "Optional human name for the user's catalog/organisation. " +
|
|
81
|
+
"Defaults to '<email-localpart>'s catalog' if omitted. " +
|
|
82
|
+
"Editable later in settings.",
|
|
83
|
+
},
|
|
84
|
+
purpose: {
|
|
85
|
+
type: "string",
|
|
86
|
+
description: "Optional free-text — what the user is trying to do with " +
|
|
87
|
+
"PICA, captured for product analytics (e.g. 'managing my " +
|
|
88
|
+
"first album credits', 'exporting royalty statements'). " +
|
|
89
|
+
"Not surfaced to the user.",
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
required: ["email"],
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
executor: this.signupStart.bind(this),
|
|
96
|
+
},
|
|
97
|
+
];
|
|
98
|
+
}
|
|
99
|
+
async signupStart(args, ctx) {
|
|
100
|
+
const email = typeof args.email === "string" ? args.email.trim().toLowerCase() : "";
|
|
101
|
+
if (!email || !EMAIL_REGEX.test(email)) {
|
|
102
|
+
return {
|
|
103
|
+
content: [
|
|
104
|
+
{
|
|
105
|
+
type: "text",
|
|
106
|
+
text: "that doesn't look like an email address — please ask the user to confirm and try again.",
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
isError: true,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
const orgName = typeof args.org_name === "string" && args.org_name.trim().length > 0
|
|
113
|
+
? args.org_name.trim()
|
|
114
|
+
: undefined;
|
|
115
|
+
const purpose = typeof args.purpose === "string" && args.purpose.trim().length > 0
|
|
116
|
+
? args.purpose.trim()
|
|
117
|
+
: undefined;
|
|
118
|
+
// The public endpoint is unauthenticated — same fetch shape as
|
|
119
|
+
// pica_sign_in's call to /api/public/mcp-auth/authorize.
|
|
120
|
+
const endpoint = `${this.apiUrl}/public/onboarding/signup-start`;
|
|
121
|
+
let response;
|
|
122
|
+
try {
|
|
123
|
+
response = await fetch(endpoint, {
|
|
124
|
+
method: "POST",
|
|
125
|
+
headers: { "Content-Type": "application/json" },
|
|
126
|
+
body: JSON.stringify({
|
|
127
|
+
email,
|
|
128
|
+
...(orgName ? { org_name: orgName } : {}),
|
|
129
|
+
...(purpose ? { purpose } : {}),
|
|
130
|
+
transport: this.transport,
|
|
131
|
+
...(this.clientId ? { client_id: this.clientId } : {}),
|
|
132
|
+
}),
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
catch (err) {
|
|
136
|
+
const message = err instanceof Error ? err.message : "network error";
|
|
137
|
+
return {
|
|
138
|
+
content: [
|
|
139
|
+
{
|
|
140
|
+
type: "text",
|
|
141
|
+
text: `couldn't reach withPICA to mint your signup link (${message}). check your internet connection and try again.`,
|
|
142
|
+
},
|
|
143
|
+
],
|
|
144
|
+
isError: true,
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
if (response.status === 429) {
|
|
148
|
+
const retryAfter = response.headers.get("Retry-After") ?? "a few minutes";
|
|
149
|
+
return {
|
|
150
|
+
content: [
|
|
151
|
+
{
|
|
152
|
+
type: "text",
|
|
153
|
+
text: `too many signup attempts — please wait ${retryAfter} seconds before trying again. if the user just requested a link, ask them to check their inbox first.`,
|
|
154
|
+
},
|
|
155
|
+
],
|
|
156
|
+
isError: true,
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
if (!response.ok) {
|
|
160
|
+
let detail = "unknown error";
|
|
161
|
+
try {
|
|
162
|
+
const body = (await response.json());
|
|
163
|
+
if (typeof body.error === "string")
|
|
164
|
+
detail = body.error;
|
|
165
|
+
}
|
|
166
|
+
catch {
|
|
167
|
+
// body wasn't JSON — fall back to status text
|
|
168
|
+
detail = response.statusText || detail;
|
|
169
|
+
}
|
|
170
|
+
return {
|
|
171
|
+
content: [
|
|
172
|
+
{
|
|
173
|
+
type: "text",
|
|
174
|
+
text: `couldn't mint your signup link: ${detail}. please try again or report this if it keeps happening.`,
|
|
175
|
+
},
|
|
176
|
+
],
|
|
177
|
+
isError: true,
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
let body;
|
|
181
|
+
try {
|
|
182
|
+
body = (await response.json());
|
|
183
|
+
}
|
|
184
|
+
catch {
|
|
185
|
+
return {
|
|
186
|
+
content: [
|
|
187
|
+
{
|
|
188
|
+
type: "text",
|
|
189
|
+
text: "the signup endpoint returned a malformed response. please try again.",
|
|
190
|
+
},
|
|
191
|
+
],
|
|
192
|
+
isError: true,
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
if (!body.url || !body.expires_at) {
|
|
196
|
+
return {
|
|
197
|
+
content: [
|
|
198
|
+
{
|
|
199
|
+
type: "text",
|
|
200
|
+
text: "the signup endpoint returned an incomplete response. please try again.",
|
|
201
|
+
},
|
|
202
|
+
],
|
|
203
|
+
isError: true,
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
const url = body.url;
|
|
207
|
+
const expiresAt = body.expires_at;
|
|
208
|
+
const textSummary = `signup link minted for ${email}. surface this URL to the user — they should click it to verify ownership of the email, ` +
|
|
209
|
+
`pick an organisation name, and start their 14-day trial. the link expires at ${expiresAt} (15 minutes from now). ` +
|
|
210
|
+
(this.transport === "stdio"
|
|
211
|
+
? "after they finish signup the page will show a connection key to paste into Claude Desktop's MCP config; they'll then need to reconnect the PICA MCP server."
|
|
212
|
+
: "after they finish signup the OAuth flow resumes automatically.");
|
|
213
|
+
const resourceLink = {
|
|
214
|
+
type: "resource_link",
|
|
215
|
+
uri: url,
|
|
216
|
+
name: "Sign up for withPICA",
|
|
217
|
+
description: "Open this link to verify your email, create your catalog, and start a 14-day trial.",
|
|
218
|
+
mimeType: "text/html",
|
|
219
|
+
};
|
|
220
|
+
const baseContent = [
|
|
221
|
+
{
|
|
222
|
+
type: "text",
|
|
223
|
+
text: JSON.stringify({
|
|
224
|
+
text_summary: textSummary,
|
|
225
|
+
signup_url: url,
|
|
226
|
+
expires_at: expiresAt,
|
|
227
|
+
surface: body.surface ?? "onboarding",
|
|
228
|
+
}),
|
|
229
|
+
},
|
|
230
|
+
resourceLink,
|
|
231
|
+
];
|
|
232
|
+
// Capability-gated `elicitation/create url` — clients advertising
|
|
233
|
+
// `capabilities.elicitation.url` get a server-issued consent prompt
|
|
234
|
+
// to open the link in-line. Without the gate, calling elicitInput
|
|
235
|
+
// against a non-supporter throws synchronously per
|
|
236
|
+
// `feedback_mcp_sdk_capability_gates_elicitation.md`.
|
|
237
|
+
if (clientSupportsUrlElicitation(ctx?.server)) {
|
|
238
|
+
try {
|
|
239
|
+
await ctx.server.elicitInput({
|
|
240
|
+
mode: "url",
|
|
241
|
+
url,
|
|
242
|
+
elicitationId: `pica-signup-${randomUUID()}`,
|
|
243
|
+
message: `Open this URL to finish signing up for withPICA. Expires at ${expiresAt}.`,
|
|
244
|
+
}, { timeout: 60_000 });
|
|
245
|
+
}
|
|
246
|
+
catch {
|
|
247
|
+
// user declined / cancelled / timed out — `resource_link` remains
|
|
248
|
+
// usable so we degrade silently rather than fail the tool.
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return {
|
|
252
|
+
content: baseContent,
|
|
253
|
+
structuredContent: {
|
|
254
|
+
kind: "pica.card.signup_start",
|
|
255
|
+
version: 1,
|
|
256
|
+
data: {
|
|
257
|
+
signup_url: url,
|
|
258
|
+
expires_at: expiresAt,
|
|
259
|
+
email,
|
|
260
|
+
transport: this.transport,
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
//# sourceMappingURL=signup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signup.js","sourceRoot":"","sources":["../../src/tools/signup.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAOzC,OAAO,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAwBnE,MAAM,WAAW,GAAG,4BAA4B,CAAC;AAEjD,MAAM,OAAO,WAAW;IACL,MAAM,CAAS;IACf,SAAS,CAAkB;IAC3B,QAAQ,CAAgB;IAEzC,YAAY,MAAyB;QACnC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YACnB,MAAM,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CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Split Sheets & Recording Splits Tools
|
|
3
|
+
* MCP tools for managing publishing split sheets and master recording ownership splits
|
|
4
|
+
*/
|
|
5
|
+
import { PicaClient } from "@withpica/mcp-sdk";
|
|
6
|
+
import { ToolDefinition, ToolExecutor } from "./index.js";
|
|
7
|
+
export declare class SplitSheetsTools {
|
|
8
|
+
private pica;
|
|
9
|
+
constructor(pica: PicaClient);
|
|
10
|
+
/**
|
|
11
|
+
* Get all split sheet and recording split tools
|
|
12
|
+
*/
|
|
13
|
+
getTools(): Array<{
|
|
14
|
+
definition: ToolDefinition;
|
|
15
|
+
executor: ToolExecutor;
|
|
16
|
+
}>;
|
|
17
|
+
private sendSplitSheet;
|
|
18
|
+
private listSplitSheets;
|
|
19
|
+
private generateSplitSheet;
|
|
20
|
+
private getSplitSheet;
|
|
21
|
+
private listRecordingSplits;
|
|
22
|
+
private createRecordingSplit;
|
|
23
|
+
private verifyRecordingSplit;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=split-sheets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"split-sheets.d.ts","sourceRoot":"","sources":["../../src/tools/split-sheets.ts"],"names":[],"mappings":"AAEA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EACL,cAAc,EACd,YAAY,EAGb,MAAM,YAAY,CAAC;AAUpB,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,IAAI,CAAa;gBAEb,IAAI,EAAE,UAAU;IAI5B;;OAEG;IACH,QAAQ,IAAI,KAAK,CAAC;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,QAAQ,EAAE,YAAY,CAAA;KAAE,CAAC;YA2K3D,cAAc;YAmGd,eAAe;YAWf,kBAAkB;YAOlB,aAAa;YAUb,mBAAmB;YAWnB,oBAAoB;YAuCpB,oBAAoB;CASnC"}
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
// Copyright (c) 2024-2026 Withpica Ltd. All rights reserved.
|
|
2
|
+
import { elicitBulkConfirmation, formatAsText, formatSuccess, formatStructuredList, RECORDING_SPLITS_WRITE_PROPERTIES, RECORDING_SPLITS_CREATE_REQUIRED, } from "@withpica/mcp-utils";
|
|
3
|
+
export class SplitSheetsTools {
|
|
4
|
+
pica;
|
|
5
|
+
constructor(pica) {
|
|
6
|
+
this.pica = pica;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Get all split sheet and recording split tools
|
|
10
|
+
*/
|
|
11
|
+
getTools() {
|
|
12
|
+
return [
|
|
13
|
+
{
|
|
14
|
+
definition: {
|
|
15
|
+
name: "pica_split_sheet_send",
|
|
16
|
+
description: "Send a split sheet to all credited writers on a work for review and signature. " +
|
|
17
|
+
"Notifies each writer via in-app notification, Telegram (if connected), and email. " +
|
|
18
|
+
"The split sheet must already be generated. Writers who are not PICA users get " +
|
|
19
|
+
"a collaboration invite email instead.",
|
|
20
|
+
workflows: ["split-sheet-required"],
|
|
21
|
+
inputSchema: {
|
|
22
|
+
type: "object",
|
|
23
|
+
properties: {
|
|
24
|
+
work_id: {
|
|
25
|
+
type: "string",
|
|
26
|
+
description: "The work ID the split sheet belongs to",
|
|
27
|
+
},
|
|
28
|
+
split_sheet_id: {
|
|
29
|
+
type: "string",
|
|
30
|
+
description: "The split sheet ID to send",
|
|
31
|
+
},
|
|
32
|
+
message: {
|
|
33
|
+
type: "string",
|
|
34
|
+
description: "Optional custom message to include (default: 'please review and sign the split sheet')",
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
required: ["work_id", "split_sheet_id"],
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
executor: this.sendSplitSheet.bind(this),
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
definition: {
|
|
44
|
+
name: "pica_split_sheet_list",
|
|
45
|
+
description: "List split sheets for a work. Split sheets document how publishing " +
|
|
46
|
+
"royalties are divided among writers and publishers for a composition.",
|
|
47
|
+
workflows: ["split-sheet-required"],
|
|
48
|
+
inputSchema: {
|
|
49
|
+
type: "object",
|
|
50
|
+
properties: {
|
|
51
|
+
work_id: {
|
|
52
|
+
type: "string",
|
|
53
|
+
description: "The work ID to list split sheets for",
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
required: ["work_id"],
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
executor: this.listSplitSheets.bind(this),
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
definition: {
|
|
63
|
+
name: "pica_split_sheet_generate",
|
|
64
|
+
description: "Generate a split sheet from a work's credits. This takes the existing " +
|
|
65
|
+
"writer credits on a work and creates a formal split sheet document. " +
|
|
66
|
+
"Credits must total 100% before generating.",
|
|
67
|
+
workflows: ["split-sheet-required"],
|
|
68
|
+
inputSchema: {
|
|
69
|
+
type: "object",
|
|
70
|
+
properties: {
|
|
71
|
+
work_id: {
|
|
72
|
+
type: "string",
|
|
73
|
+
description: "The work ID to generate a split sheet for",
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
required: ["work_id"],
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
executor: this.generateSplitSheet.bind(this),
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
definition: {
|
|
83
|
+
name: "pica_split_sheet_get",
|
|
84
|
+
description: "Get a specific split sheet with its full details including " +
|
|
85
|
+
"individual writer shares and signature status.",
|
|
86
|
+
workflows: ["split-sheet-required"],
|
|
87
|
+
inputSchema: {
|
|
88
|
+
type: "object",
|
|
89
|
+
properties: {
|
|
90
|
+
work_id: {
|
|
91
|
+
type: "string",
|
|
92
|
+
description: "The work ID the split sheet belongs to",
|
|
93
|
+
},
|
|
94
|
+
split_sheet_id: {
|
|
95
|
+
type: "string",
|
|
96
|
+
description: "The split sheet ID",
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
required: ["work_id", "split_sheet_id"],
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
executor: this.getSplitSheet.bind(this),
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
definition: {
|
|
106
|
+
name: "pica_recording_splits_list",
|
|
107
|
+
description: "List ownership splits for a recording. These represent master rights " +
|
|
108
|
+
"ownership — who owns what percentage of the recorded performance " +
|
|
109
|
+
"(as opposed to the underlying composition).",
|
|
110
|
+
workflows: ["recording-splits-required"],
|
|
111
|
+
inputSchema: {
|
|
112
|
+
type: "object",
|
|
113
|
+
properties: {
|
|
114
|
+
recording_id: {
|
|
115
|
+
type: "string",
|
|
116
|
+
description: "The recording ID to list splits for",
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
required: ["recording_id"],
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
executor: this.listRecordingSplits.bind(this),
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
definition: {
|
|
126
|
+
name: "pica_recording_splits_create",
|
|
127
|
+
description: "Set an ownership split on a recording. Assigns a percentage of master " +
|
|
128
|
+
"rights ownership to a person or entity for this recording.",
|
|
129
|
+
workflows: ["recording-splits-required"],
|
|
130
|
+
inputSchema: {
|
|
131
|
+
type: "object",
|
|
132
|
+
properties: {
|
|
133
|
+
...RECORDING_SPLITS_WRITE_PROPERTIES,
|
|
134
|
+
dry_run: {
|
|
135
|
+
type: "boolean",
|
|
136
|
+
description: "When true, returns { dry_run: true, would_affect, sample } without persisting the split. Use to preview what the row would look like before committing — split percentages on a recording can shift downstream payment and credit-gating outcomes.",
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
required: [...RECORDING_SPLITS_CREATE_REQUIRED],
|
|
140
|
+
},
|
|
141
|
+
previewMode: "dry_run",
|
|
142
|
+
},
|
|
143
|
+
executor: this.createRecordingSplit.bind(this),
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
definition: {
|
|
147
|
+
name: "pica_recording_splits_verify",
|
|
148
|
+
description: "Verify a recording split. Marks a specific ownership split as " +
|
|
149
|
+
"confirmed and agreed upon by the relevant parties.",
|
|
150
|
+
workflows: ["recording-splits-required"],
|
|
151
|
+
inputSchema: {
|
|
152
|
+
type: "object",
|
|
153
|
+
properties: {
|
|
154
|
+
recording_id: {
|
|
155
|
+
type: "string",
|
|
156
|
+
description: "The recording ID",
|
|
157
|
+
},
|
|
158
|
+
split_id: {
|
|
159
|
+
type: "string",
|
|
160
|
+
description: "The split ID to verify",
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
required: ["recording_id", "split_id"],
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
executor: this.verifyRecordingSplit.bind(this),
|
|
167
|
+
},
|
|
168
|
+
];
|
|
169
|
+
}
|
|
170
|
+
// ── Send Split Sheet ─────────────────────────────────────────────────
|
|
171
|
+
async sendSplitSheet(args) {
|
|
172
|
+
// 1. Verify split sheet exists
|
|
173
|
+
const sheet = await this.pica.splitSheets.get(args.work_id, args.split_sheet_id);
|
|
174
|
+
if (!sheet) {
|
|
175
|
+
return formatAsText({
|
|
176
|
+
sent: false,
|
|
177
|
+
error: "Split sheet not found",
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
// 2. Get all credits on this work to find writers
|
|
181
|
+
const creditsResult = await this.pica.credits.listForWork(args.work_id);
|
|
182
|
+
const writers = Array.isArray(creditsResult)
|
|
183
|
+
? creditsResult
|
|
184
|
+
: creditsResult?.data || [];
|
|
185
|
+
if (writers.length === 0) {
|
|
186
|
+
return formatAsText({
|
|
187
|
+
sent: false,
|
|
188
|
+
error: "No credits found on this work. Add writers before sending the split sheet.",
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
// 3. Notify each writer
|
|
192
|
+
const message = args.message?.trim() ||
|
|
193
|
+
"please review and sign the split sheet for this work";
|
|
194
|
+
const results = [];
|
|
195
|
+
for (const credit of writers) {
|
|
196
|
+
if (!credit.person_id)
|
|
197
|
+
continue;
|
|
198
|
+
try {
|
|
199
|
+
const result = await this.pica.notifications.sendToPerson({
|
|
200
|
+
person_id: credit.person_id,
|
|
201
|
+
message: `${message} — your share: ${credit.splits ?? "?"}%`,
|
|
202
|
+
work_id: args.work_id,
|
|
203
|
+
notification_type: "split_sheet_review",
|
|
204
|
+
});
|
|
205
|
+
const data = result.data || result;
|
|
206
|
+
results.push({
|
|
207
|
+
person_id: credit.person_id,
|
|
208
|
+
name: data.person_name || credit.person_name || "Unknown",
|
|
209
|
+
delivered: data.delivered,
|
|
210
|
+
channels: data.channels,
|
|
211
|
+
reason: data.reason,
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
catch {
|
|
215
|
+
results.push({
|
|
216
|
+
person_id: credit.person_id,
|
|
217
|
+
name: credit.person_name || "Unknown",
|
|
218
|
+
delivered: false,
|
|
219
|
+
reason: "notification_failed",
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
const delivered = results.filter((r) => r.delivered);
|
|
224
|
+
const notPicaUsers = results.filter((r) => r.reason === "not_a_pica_user");
|
|
225
|
+
const failed = results.filter((r) => !r.delivered && r.reason !== "not_a_pica_user");
|
|
226
|
+
const summary = [
|
|
227
|
+
`Split sheet sent to ${delivered.length}/${results.length} writers`,
|
|
228
|
+
delivered.length > 0
|
|
229
|
+
? `Delivered: ${delivered.map((r) => r.name).join(", ")}`
|
|
230
|
+
: null,
|
|
231
|
+
notPicaUsers.length > 0
|
|
232
|
+
? `Not PICA users (use pica_collaborators_invite): ${notPicaUsers.map((r) => r.name).join(", ")}`
|
|
233
|
+
: null,
|
|
234
|
+
failed.length > 0
|
|
235
|
+
? `Failed: ${failed.map((r) => r.name).join(", ")}`
|
|
236
|
+
: null,
|
|
237
|
+
]
|
|
238
|
+
.filter(Boolean)
|
|
239
|
+
.join(". ");
|
|
240
|
+
return formatSuccess(summary, {
|
|
241
|
+
split_sheet_id: args.split_sheet_id,
|
|
242
|
+
work_id: args.work_id,
|
|
243
|
+
results,
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
// ── Split Sheet Methods ──────────────────────────────────────────────
|
|
247
|
+
async listSplitSheets(args) {
|
|
248
|
+
const sheets = await this.pica.splitSheets.listForWork(args.work_id);
|
|
249
|
+
const data = Array.isArray(sheets) ? sheets : (sheets?.data ?? [sheets]);
|
|
250
|
+
return formatStructuredList(data, "split_sheet", {
|
|
251
|
+
work_id: args.work_id,
|
|
252
|
+
total: data.length,
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
async generateSplitSheet(args) {
|
|
256
|
+
const sheet = await this.pica.splitSheets.generate(args.work_id);
|
|
257
|
+
return formatSuccess("Split sheet generated successfully", sheet);
|
|
258
|
+
}
|
|
259
|
+
async getSplitSheet(args) {
|
|
260
|
+
const sheet = await this.pica.splitSheets.get(args.work_id, args.split_sheet_id);
|
|
261
|
+
return formatAsText(sheet);
|
|
262
|
+
}
|
|
263
|
+
// ── Recording Split Methods ──────────────────────────────────────────
|
|
264
|
+
async listRecordingSplits(args) {
|
|
265
|
+
const splits = await this.pica.recordingSplits.list(args.recording_id);
|
|
266
|
+
const data = Array.isArray(splits) ? splits : (splits?.data ?? [splits]);
|
|
267
|
+
return formatStructuredList(data, "recording_split", {
|
|
268
|
+
recording_id: args.recording_id,
|
|
269
|
+
total: data.length,
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
async createRecordingSplit(args, ctx) {
|
|
273
|
+
const { recording_id, dry_run, ...data } = args;
|
|
274
|
+
// ADR-199 Stream 5b — dry_run preview before mutation. Validation
|
|
275
|
+
// would otherwise be enforced by the route, but for a single-row
|
|
276
|
+
// create the dry_run echo of what would land is the most useful
|
|
277
|
+
// preview shape (no separate would_affect / target_count needed —
|
|
278
|
+
// the operation creates exactly one row).
|
|
279
|
+
if (dry_run === true) {
|
|
280
|
+
return formatSuccess(`Dry run — would create a recording split on ${recording_id}`, {
|
|
281
|
+
dry_run: true,
|
|
282
|
+
would_affect: [recording_id],
|
|
283
|
+
sample: { recording_id, ...data },
|
|
284
|
+
target_count: 1,
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
// ADR-200 Phase 1 — Class D form-confirmation gate. Recording
|
|
288
|
+
// splits drive royalty payouts; agent-issued writes need explicit
|
|
289
|
+
// user confirmation when the client supports the form primitive.
|
|
290
|
+
const role = data.role ?? "owner";
|
|
291
|
+
const percentage = data.percentage;
|
|
292
|
+
const gate = await elicitBulkConfirmation({
|
|
293
|
+
server: ctx?.server,
|
|
294
|
+
args,
|
|
295
|
+
action: "Create recording split",
|
|
296
|
+
impactSummary: `${role} ${percentage != null ? percentage + "%" : "split"} on recording ${recording_id}`,
|
|
297
|
+
warning: "Recording splits drive master royalty payouts and downstream credit gating. Confirm the percentage is correct before proceeding.",
|
|
298
|
+
});
|
|
299
|
+
if (gate.kind === "abort")
|
|
300
|
+
return gate.result;
|
|
301
|
+
const split = await this.pica.recordingSplits.create(recording_id, data);
|
|
302
|
+
return formatSuccess("Recording split created successfully", split);
|
|
303
|
+
}
|
|
304
|
+
async verifyRecordingSplit(args) {
|
|
305
|
+
const result = await this.pica.recordingSplits.verify(args.recording_id, args.split_id);
|
|
306
|
+
return formatSuccess("Recording split verified successfully", result);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
//# sourceMappingURL=split-sheets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"split-sheets.js","sourceRoot":"","sources":["../../src/tools/split-sheets.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAc7D,OAAO,EACL,sBAAsB,EACtB,YAAY,EACZ,aAAa,EACb,oBAAoB,EACpB,iCAAiC,EACjC,gCAAgC,GACjC,MAAM,qBAAqB,CAAC;AAE7B,MAAM,OAAO,gBAAgB;IACnB,IAAI,CAAa;IAEzB,YAAY,IAAgB;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED;;OAEG;IACH,QAAQ;QACN,OAAO;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B;YAChC,aAAa,EAAE,GAAG,IAAI,IAAI,UAAU,IAAI,IAAI,CAAC,CAAC,CAAC,UAAU,GAAG,GAAG,CAAC,CAAC,CAAC,OAAO,iBAAiB,YAAY,EAAE;YACxG,OAAO,EACL,kIAAkI;SACrI,CAAC,CAAC;QACH,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO;YAAE,OAAO,IAAI,CAAC,MAAoB,CAAC;QAC5D,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;QACzE,OAAO,aAAa,CAAC,sCAAsC,EAAE,KAAK,CAAC,CAAC;IACtE,CAAC;IAEO,KAAK,CAAC,oBAAoB,CAChC,IAAyB;QAEzB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,CACnD,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,QAAQ,CACd,CAAC;QACF,OAAO,aAAa,CAAC,uCAAuC,EAAE,MAAM,CAAC,CAAC;IACxE,CAAC;CACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PicaClient } from "@withpica/mcp-sdk";
|
|
2
|
+
import { ToolDefinition, ToolExecutor } from "./index.js";
|
|
3
|
+
export declare class StorageConfigTools {
|
|
4
|
+
private pica;
|
|
5
|
+
constructor(pica: PicaClient);
|
|
6
|
+
getTools(): Array<{
|
|
7
|
+
definition: ToolDefinition;
|
|
8
|
+
executor: ToolExecutor;
|
|
9
|
+
}>;
|
|
10
|
+
private configureStart;
|
|
11
|
+
private disconnect;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=storage-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage-config.d.ts","sourceRoot":"","sources":["../../src/tools/storage-config.ts"],"names":[],"mappings":"AA0BA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EACL,cAAc,EACd,YAAY,EAGb,MAAM,YAAY,CAAC;AAiBpB,qBAAa,kBAAkB;IAC7B,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;YA6E3D,cAAc;YA4Hd,UAAU;CAgDzB"}
|