UNPKG

@withpica/mcp-server

Version:

MCP Server for withPICA — enables AI assistants to interact with your withPICA music catalog

88 lines • 4.31 kB
/** * Credits Tools - MCP tools for managing work credits (collaborators and splits) * * Per ADR-213 (2026-04-30) this module also hosts pica_recording_credits_update * — the first-party recording-side write tool that closes the work/recording * credit-write asymmetry. It writes to the `recording_credits` table (NOT the * trade-secret enrichment-cascade-fed `credits` table; see * .claude/rules/ip-protection.md). Roles use the 16-entry RECORDING_CREDIT_ROLES * enum defined inline below; the canonical source is * lib/services/recording-credits.ts. */ import { PicaClient } from "@withpica/mcp-sdk"; import { ToolDefinition, ToolExecutor } from "./index.js"; export declare class CreditsTools { private pica; constructor(pica: PicaClient); getTools(): Array<{ definition: ToolDefinition; executor: ToolExecutor; }>; private sendForAttestation; private listCredits; private updateCredits; /** * ADR-213 Primitive B — pica_recording_credits_update * * Writes a single first-party recording credit to the recording_credits * table via POST /admin/recordings/{recording_id}/credits. * * Validates role against RECORDING_CREDIT_ROLES (16 entries) before the * round trip so we get a structured error rather than a generic 400 from * the route. credited_name is required (NOT NULL on the table); the route * also validates this but we surface it earlier. * * On success, includes a notification to the credited person if person_id * is set, mirroring the work-side updateCredits notification flow. */ private updateRecordingCredits; /** * ADR-264 WS4 prerequisite — the bulk path of pica_recording_credits_update * (reached when args.credits is an array). It was also the executor of the * standalone pica_recording_credits_bulk_update tool until mcp-server 2.99.0 * removed that name. * * Thin wrapper over POST /admin/recording-credits/bulk via * RecordingCreditsResource.bulkUpdate. The route + service own validation * (role enum, org scoping of release/recordings/people, caps, in-batch * dedup) and return per-row created / skipped_existing results; the * executor only pre-checks the target shape so agents get a crisp message * without a round-trip. */ private bulkUpdateRecordingCredits; /** * ADR-232 — pica_credit_add executor. * * Discriminates by entity_type. Works route through CreditsResource.atomicAdd * (POST /admin/works/[id]/credits/atomic-add → service-layer createWorkCredit * which classifies role → work_collaborators (composition) or recording_credits * (master) / recording_splits (owner)). Recordings * route through RecordingCreditsResource.atomicAdd (POST /admin/recordings/[id]/credits). * Both return AtomicCreditResult with credit_id. */ /** * pica_credit_update — in-place edit of one credit (2026-09-11). * * Closes two ops issues with one verb. `pica_credits_update` is replace-all, * so an agent changing one writer's share had to re-list every work and * re-send the whole array — nine reads plus nine writes for one split, with * a publisher row one forgotten re-list from being dropped (bff0af25). And nothing * edited a recording credit BY ITS ID — beyond the natural-key upsert a * change meant remove-then-re-add, losing id and attestation (17f27449). Agents ALREADY reach for this name: * `pica_credit_update` was the TOOL_NOT_FOUND miss in ops issue 167bb804, * six times across three orgs. */ private creditUpdate; private creditAdd; /** * ADR-232 — pica_credit_remove executor. Atomic DELETE with constant-time * existence semantics. ADR-252: work credits route directly to * work_collaborators (composition) / recording_credits (master) via * atomicRemove — `work_credits` is DROPPED. The recording credits endpoint * answers 403 INSUFFICIENT_SCOPE on a 0-row delete for EVERY caller as of * 2026-08-24; the `?atomic=1` the SDK still appends no longer selects a * behaviour and is accepted-and-ignored for one release. */ private creditRemove; } //# sourceMappingURL=credits.d.ts.map