@withpica/mcp-sdk 3.19.0 → 3.21.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/index.js CHANGED
@@ -420,6 +420,13 @@ class WorksResource extends BaseResource {
420
420
  async delete(id) {
421
421
  return this.request("DELETE", `/admin/works/${id}`);
422
422
  }
423
+ /**
424
+ * @deprecated `works` has no `is_verified` column, so PATCH /admin/works/[id]
425
+ * refuses this body (VALIDATION_ERROR "unknown field 'is_verified'") on every
426
+ * call. PICA keeps no work-level verified flag; the MCP tool
427
+ * `pica_works_verify` no longer calls this. Kept only so the published SDK's
428
+ * surface does not break; remove at the next major.
429
+ */
423
430
  async verify(id) {
424
431
  return this.request("PATCH", `/admin/works/${id}`, {
425
432
  is_verified: true,
@@ -882,6 +889,8 @@ class AudioFilesResource extends BaseResource {
882
889
  const queryParams = new URLSearchParams();
883
890
  if (params?.work_id)
884
891
  queryParams.set("work_id", params.work_id);
892
+ if (params?.work_ids && params.work_ids.length > 0)
893
+ queryParams.set("work_ids", params.work_ids.join(","));
885
894
  if (params?.file_type)
886
895
  queryParams.set("file_type", params.file_type);
887
896
  if (params?.unprocessed)
@@ -942,6 +951,15 @@ class AudioFilesResource extends BaseResource {
942
951
  async update(id, body) {
943
952
  return this.request("PATCH", `/admin/audio-files/${id}`, body);
944
953
  }
954
+ /**
955
+ * Per-file metadata patches for up to 200 files in one request (ops issue
956
+ * 5c53049a). Returns one lean result per item — `updated`, `would_update`
957
+ * (dry run) or `failed` with a reason — never the rows. Wraps
958
+ * POST /admin/audio-files/bulk-update.
959
+ */
960
+ async bulkUpdate(items, params) {
961
+ return this.request("POST", "/admin/audio-files/bulk-update", { items, ...(params?.dry_run ? { dry_run: true } : {}) });
962
+ }
945
963
  async analyze(id, options) {
946
964
  return this.request("POST", `/admin/audio-files/${id}/analyze`, options);
947
965
  }
@@ -1631,6 +1649,11 @@ class EnrichmentResource extends BaseResource {
1631
1649
  * `artist_title_to_youtube` recording-create), a uniqueness check
1632
1650
  * runs instead; conflicts return `{ status: 'create_conflict' }` and
1633
1651
  * cannot be forced.
1652
+ *
1653
+ * File-type questions (`entity_type: 'audio_file'`) take the owner's own
1654
+ * answer: `file_type` (master / version / instrumental / demo / stem) and,
1655
+ * for a stem, an optional `stem_label`. A refused answer is a 400 with
1656
+ * `code: 'INVALID_FILE_TYPE_ANSWER'`.
1634
1657
  */
1635
1658
  async applyEnrichmentProposal(proposalId, options) {
1636
1659
  return this.request("POST", `/admin/enrichment-proposals/${proposalId}/apply`, options ?? {});
@@ -1743,6 +1766,43 @@ class HealthResource extends BaseResource {
1743
1766
  async getLowScoreWorks() {
1744
1767
  return this.request("GET", "/admin/quality/completeness/low-score");
1745
1768
  }
1769
+ /**
1770
+ * One page of works below a completeness threshold, with the route's
1771
+ * `meta` (true `total` below the threshold, `has_more`). Backs
1772
+ * `pica_works_query {health_filter: "low_completeness"}` — the bare
1773
+ * `getLowScoreWorks()` above sends no limit/offset, so the tool used to
1774
+ * ignore both (ops issue 314325eb).
1775
+ */
1776
+ async getLowScoreWorksPage(params) {
1777
+ const qp = new URLSearchParams();
1778
+ if (params.limit !== undefined)
1779
+ qp.set("limit", String(params.limit));
1780
+ if (params.offset !== undefined)
1781
+ qp.set("offset", String(params.offset));
1782
+ if (params.threshold !== undefined)
1783
+ qp.set("threshold", String(params.threshold));
1784
+ const qs = qp.toString();
1785
+ const env = await this.requestWithEnvelope("GET", `/admin/quality/completeness/low-score${qs ? `?${qs}` : ""}`);
1786
+ return { data: Array.isArray(env.data) ? env.data : [], meta: env.meta };
1787
+ }
1788
+ /**
1789
+ * One page of the cross-org reconciliation scan, with the route's `meta`
1790
+ * (`scanned`, `candidates_total`, `next_offset`). `offset`/`limit` page the
1791
+ * candidate works, not the returned rows — see the route. Backs
1792
+ * `pica_works_query {health_filter: "needs_attention"}`.
1793
+ */
1794
+ async getWorksHealthPage(params) {
1795
+ const qp = new URLSearchParams();
1796
+ if (params.limit !== undefined)
1797
+ qp.set("limit", String(params.limit));
1798
+ if (params.offset !== undefined)
1799
+ qp.set("offset", String(params.offset));
1800
+ if (params.unreconciledOnly)
1801
+ qp.set("unreconciledOnly", "true");
1802
+ const qs = qp.toString();
1803
+ const env = await this.requestWithEnvelope("GET", `/admin/quality/works-health${qs ? `?${qs}` : ""}`);
1804
+ return { data: Array.isArray(env.data) ? env.data : [], meta: env.meta };
1805
+ }
1746
1806
  async getWorkCompleteness(workId) {
1747
1807
  return this.request("GET", `/admin/quality/completeness/${workId}`);
1748
1808
  }
@@ -3584,6 +3644,30 @@ class WorkForHireResource extends BaseResource {
3584
3644
  await this.request("DELETE", `/admin/work-for-hire/${id}`);
3585
3645
  }
3586
3646
  }
3647
+ /**
3648
+ * ADR-321 Phase 2 — programmable rights. `propose` only proposes: the route
3649
+ * never activates a rule on an API key, and each party confirms by email.
3650
+ */
3651
+ class RightsResource extends BaseResource {
3652
+ /**
3653
+ * POST /admin/works/{id}/rights/propose. Body is one of
3654
+ * `{ rule: "song" }`, `{ rule: "master", recording_id }` or
3655
+ * `{ rule: "share", side?, recording_id?, subject_person_id, kind,
3656
+ * parties: [{ person_id, share_bp }], effective_from, effective_to? }`.
3657
+ * A refusal is a 422 carrying `details.reasons`.
3658
+ */
3659
+ async propose(workId, body) {
3660
+ return this.request("POST", `/admin/works/${encodeURIComponent(workId)}/rights/propose`, body);
3661
+ }
3662
+ /** GET /admin/rights/rules/{id} — one rule's status and confirmations. */
3663
+ async status(ruleId) {
3664
+ return this.request("GET", `/admin/rights/rules/${encodeURIComponent(ruleId)}`);
3665
+ }
3666
+ /** GET /admin/works/{id}/rights — every rule on a song, history, holds. */
3667
+ async inspect(workId) {
3668
+ return this.request("GET", `/admin/works/${encodeURIComponent(workId)}/rights`);
3669
+ }
3670
+ }
3587
3671
  class RoyaltiesResource extends BaseResource {
3588
3672
  async payments(params) {
3589
3673
  const qp = new URLSearchParams();
@@ -3630,6 +3714,26 @@ class RoyaltiesResource extends BaseResource {
3630
3714
  const qs = qp.toString();
3631
3715
  return this.request("GET", `/admin/royalties/gaps${qs ? `?${qs}` : ""}`);
3632
3716
  }
3717
+ /**
3718
+ * ADR-321 Phase 0 — what in one song's record is likely holding up its
3719
+ * society income. `state` is "clear" only when every area was checked;
3720
+ * `unchecked` lists areas that could not be.
3721
+ */
3722
+ async blockers(workId) {
3723
+ return this.request("GET", `/admin/works/${encodeURIComponent(workId)}/money-blockers`);
3724
+ }
3725
+ /** ADR-321 Phase 0 — the catalogue roll-up: summary + songs not clear, paged. */
3726
+ async blockersCatalogue(params) {
3727
+ const qp = new URLSearchParams();
3728
+ if (params?.code)
3729
+ qp.set("code", params.code);
3730
+ if (params?.limit !== undefined)
3731
+ qp.set("limit", String(params.limit));
3732
+ if (params?.offset !== undefined)
3733
+ qp.set("offset", String(params.offset));
3734
+ const qs = qp.toString();
3735
+ return this.request("GET", `/admin/money-blockers${qs ? `?${qs}` : ""}`);
3736
+ }
3633
3737
  async stats() {
3634
3738
  return this.request("GET", "/admin/royalties/stats");
3635
3739
  }
@@ -4057,6 +4161,8 @@ export class PicaClient {
4057
4161
  producerAgreements;
4058
4162
  workForHire;
4059
4163
  royalties;
4164
+ /** ADR-321 Phase 2 — programmable rights (propose / status / inspect). */
4165
+ rights;
4060
4166
  statements;
4061
4167
  /** ADR-319 — saved catalog selections. */
4062
4168
  selections;
@@ -4173,6 +4279,7 @@ export class PicaClient {
4173
4279
  this.producerAgreements = new ProducerAgreementsResource(baseUrl, config.apiKey, debug);
4174
4280
  this.workForHire = new WorkForHireResource(baseUrl, config.apiKey, debug);
4175
4281
  this.royalties = new RoyaltiesResource(baseUrl, config.apiKey, debug);
4282
+ this.rights = new RightsResource(baseUrl, config.apiKey, debug);
4176
4283
  this.statements = new StatementsResource(baseUrl, config.apiKey, debug);
4177
4284
  this.selections = new SelectionsResource(baseUrl, config.apiKey, debug);
4178
4285
  this.shareLinks = new ShareLinksResource(baseUrl, config.apiKey, debug);