@withpica/mcp-server
Version:
MCP Server for withPICA — enables AI assistants to interact with your withPICA music catalog
100 lines • 5.1 kB
JavaScript
// Copyright (c) 2025-2026 Withpica Ltd. All rights reserved.
import { formatSuccess, withBillingGate } from "@withpica/mcp-utils";
import { WORK_TYPE_VALUES } from "./catalog-enums.js";
export class RegisterTools {
pica;
constructor(pica) {
this.pica = pica;
}
getTools() {
return [
{
definition: {
name: "pica_register_set",
scope: "write:catalog",
audiences: ["stdio", "http", "public"],
tier: "write",
description: "Use when the user asks: 'register this set', 'register my Ableton session', " +
"'save this track as a work', 'register what I just made'. Registers a captured " +
"studio/DAW session in one step — creates a work, a linked master recording, and a " +
"100% org-owned master ownership split in a single call (the one-call equivalent of " +
"pica_works_create + pica_recordings_create + pica_recording_splits_create). " +
"title is the work + recording title; artist_name is the master's display artist " +
"(pass primary_artist_id when you already resolved the person). work_type defaults " +
"to 'song'. If a work with the same title + artist already exists the call fails " +
"with the existing work id, so you can add a version or complete it instead.",
workflows: "infrastructure",
vernacular_kind: "creator-entry",
inputSchema: {
type: "object",
properties: {
title: {
type: "string",
description: "Title of the work and its master recording.",
},
artist_name: {
type: "string",
description: "Display artist for the master recording (free text; the server resolves it to a person when unambiguous).",
},
work_type: {
type: "string",
enum: [...WORK_TYPE_VALUES],
description: "Work type. Defaults to 'song'.",
},
key: {
type: "string",
description: "Optional musical key snapshot (e.g. 'A minor').",
},
notes: {
type: "string",
description: "Optional freetext notes captured with the work.",
},
metadata: {
type: "object",
description: "Optional captured session snapshot stored on the work (e.g. tempo, plugin list).",
},
primary_artist_id: {
type: "string",
description: "Optional UUID of the resolved primary artist person, when known.",
},
},
required: ["title", "artist_name"],
},
annotations: {
title: "register a captured set",
destructiveHint: false,
idempotentHint: false,
},
},
executor: withBillingGate(this.pica, "register set", this.set.bind(this)),
},
];
}
async set(args) {
const data = await this.pica.register.set({
title: args.title,
artist_name: args.artist_name,
work_type: args.work_type,
key: args.key,
notes: args.notes,
metadata: args.metadata,
primary_artist_id: args.primary_artist_id,
});
let line;
if (data.template_application === "applied") {
line = ` Your registration template was applied (definition of done met).`;
}
else if (data.template_application === "partial") {
line = ` ⚠️ Your registration template was only PARTIALLY applied — ${(data.unmet_reasons ?? []).join("; ")}. Fix in /inspect before treating this as done.`;
}
else {
line =
data.master_ownership === "created"
? " 100% master ownership recorded."
: " (master ownership write was skipped — set it in /inspect.)";
}
return formatSuccess(`Registered "${args.title}" — work + master recording created.${line} ` +
`Review at https://withpica.com/inspect/works/${data.work_id}`, data);
}
}
//# sourceMappingURL=register.js.map