@withpica/mcp-server 2.11.0 → 2.22.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.
Files changed (82) hide show
  1. package/CHANGELOG.md +617 -1
  2. package/dist/config.d.ts +9 -9
  3. package/dist/index.d.ts +1 -1
  4. package/dist/prompts/index.d.ts +66 -34
  5. package/dist/prompts/index.d.ts.map +1 -1
  6. package/dist/prompts/index.js +320 -607
  7. package/dist/prompts/index.js.map +1 -1
  8. package/dist/resources/index.d.ts +53 -53
  9. package/dist/server.d.ts +49 -49
  10. package/dist/tools/agreement-types.d.ts.map +1 -1
  11. package/dist/tools/agreement-types.js +14 -129
  12. package/dist/tools/agreement-types.js.map +1 -1
  13. package/dist/tools/agreements.d.ts.map +1 -1
  14. package/dist/tools/agreements.js +11 -109
  15. package/dist/tools/agreements.js.map +1 -1
  16. package/dist/tools/assets.d.ts.map +1 -1
  17. package/dist/tools/assets.js +17 -257
  18. package/dist/tools/assets.js.map +1 -1
  19. package/dist/tools/bulk.d.ts +7 -1
  20. package/dist/tools/bulk.d.ts.map +1 -1
  21. package/dist/tools/bulk.js +24 -2
  22. package/dist/tools/bulk.js.map +1 -1
  23. package/dist/tools/credits.d.ts.map +1 -1
  24. package/dist/tools/credits.js +27 -13
  25. package/dist/tools/credits.js.map +1 -1
  26. package/dist/tools/discovery.d.ts.map +1 -1
  27. package/dist/tools/discovery.js +8 -0
  28. package/dist/tools/discovery.js.map +1 -1
  29. package/dist/tools/enrichment.d.ts +47 -0
  30. package/dist/tools/enrichment.d.ts.map +1 -1
  31. package/dist/tools/enrichment.js +416 -19
  32. package/dist/tools/enrichment.js.map +1 -1
  33. package/dist/tools/index.d.ts +88 -72
  34. package/dist/tools/labels.d.ts +20 -0
  35. package/dist/tools/labels.d.ts.map +1 -0
  36. package/dist/tools/labels.js +47 -0
  37. package/dist/tools/labels.js.map +1 -0
  38. package/dist/tools/metadata.d.ts.map +1 -1
  39. package/dist/tools/metadata.js +37 -0
  40. package/dist/tools/metadata.js.map +1 -1
  41. package/dist/tools/multimedia.d.ts.map +1 -1
  42. package/dist/tools/multimedia.js +86 -11
  43. package/dist/tools/multimedia.js.map +1 -1
  44. package/dist/tools/notes.d.ts.map +1 -1
  45. package/dist/tools/notes.js +4 -1
  46. package/dist/tools/notes.js.map +1 -1
  47. package/dist/tools/people.d.ts +38 -38
  48. package/dist/tools/projects.d.ts +1 -0
  49. package/dist/tools/projects.d.ts.map +1 -1
  50. package/dist/tools/projects.js +188 -17
  51. package/dist/tools/projects.js.map +1 -1
  52. package/dist/tools/publishers.d.ts +15 -1
  53. package/dist/tools/publishers.d.ts.map +1 -1
  54. package/dist/tools/publishers.js +43 -9
  55. package/dist/tools/publishers.js.map +1 -1
  56. package/dist/tools/recordings.d.ts +30 -30
  57. package/dist/tools/recovery-hints.d.ts.map +1 -1
  58. package/dist/tools/recovery-hints.js +49 -0
  59. package/dist/tools/recovery-hints.js.map +1 -1
  60. package/dist/tools/releases.d.ts +14 -1
  61. package/dist/tools/releases.d.ts.map +1 -1
  62. package/dist/tools/releases.js +247 -36
  63. package/dist/tools/releases.js.map +1 -1
  64. package/dist/tools/search.d.ts +20 -20
  65. package/dist/tools/sessions.d.ts.map +1 -1
  66. package/dist/tools/sessions.js +42 -8
  67. package/dist/tools/sessions.js.map +1 -1
  68. package/dist/tools/settings.d.ts +1 -0
  69. package/dist/tools/settings.d.ts.map +1 -1
  70. package/dist/tools/settings.js +51 -1
  71. package/dist/tools/settings.js.map +1 -1
  72. package/dist/tools/share-links.d.ts.map +1 -1
  73. package/dist/tools/share-links.js +19 -53
  74. package/dist/tools/share-links.js.map +1 -1
  75. package/dist/tools/split-sheets.d.ts.map +1 -1
  76. package/dist/tools/split-sheets.js +3 -42
  77. package/dist/tools/split-sheets.js.map +1 -1
  78. package/dist/tools/team.d.ts.map +1 -1
  79. package/dist/tools/team.js +9 -4
  80. package/dist/tools/team.js.map +1 -1
  81. package/dist/tools/works.d.ts +38 -38
  82. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../src/tools/discovery.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAc,MAAM,YAAY,CAAC;AAgS3E,qBAAa,cAAc;IAEvB,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,UAAU;gBAJV,aAAa,EAAE,CACrB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KACtB,OAAO,CAAC,GAAG,CAAC,EACT,UAAU,EAAE,CAClB,IAAI,EAAE,MAAM,KAEV;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,QAAQ,EAAE,YAAY,CAAC;QAAC,QAAQ,CAAC,EAAE,GAAG,CAAA;KAAE,GACtE,SAAS;IAGf,QAAQ,IAAI,KAAK,CAAC;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,QAAQ,EAAE,YAAY,CAAA;KAAE,CAAC;IAQzE,OAAO,CAAC,iBAAiB;IAqDzB,OAAO,CAAC,oBAAoB;IAuH5B,OAAO,CAAC,eAAe;IAoCvB,OAAO,CAAC,gBAAgB;CAiHzB"}
1
+ {"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../src/tools/discovery.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAc,MAAM,YAAY,CAAC;AAwS3E,qBAAa,cAAc;IAEvB,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,UAAU;gBAJV,aAAa,EAAE,CACrB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KACtB,OAAO,CAAC,GAAG,CAAC,EACT,UAAU,EAAE,CAClB,IAAI,EAAE,MAAM,KAEV;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,QAAQ,EAAE,YAAY,CAAC;QAAC,QAAQ,CAAC,EAAE,GAAG,CAAA;KAAE,GACtE,SAAS;IAGf,QAAQ,IAAI,KAAK,CAAC;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,QAAQ,EAAE,YAAY,CAAA;KAAE,CAAC;IAQzE,OAAO,CAAC,iBAAiB;IAqDzB,OAAO,CAAC,oBAAoB;IAuH5B,OAAO,CAAC,eAAe;IAoCvB,OAAO,CAAC,gBAAgB;CAiHzB"}
@@ -199,6 +199,14 @@ const CATEGORIES = {
199
199
  enrichment: {
200
200
  description: "enrich your catalog metadata from external sources",
201
201
  tools: [
202
+ // ADR-179: outcome-shaped resolvers — prefer these over the seven
203
+ // per-source tools below. The per-source tools are deprecated and
204
+ // will disappear in the next @withpica/mcp-server minor; they're
205
+ // still listed so layered discovery can surface the migration
206
+ // path via pica_tool_details.
207
+ "pica_resolve_work",
208
+ "pica_resolve_person",
209
+ "pica_resolve_recording",
202
210
  "pica_enrichment_candidates",
203
211
  "pica_enrichment_compare",
204
212
  "pica_enrich_work_mlc",
@@ -1 +1 @@
1
- {"version":3,"file":"discovery.js","sourceRoot":"","sources":["../../src/tools/discovery.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAa7D,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,cAAc,GAAG,QAAQ,CAAC;AAQhC;;;;GAIG;AACH,MAAM,UAAU,GAAuC;IACrD,KAAK,EAAE;QACL,WAAW,EAAE,2BAA2B;QACxC,KAAK,EAAE;YACL,kBAAkB;YAClB,oBAAoB;YACpB,mBAAmB;YACnB,mBAAmB;YACnB,mBAAmB;YACnB,wBAAwB;YACxB,wBAAwB;YACxB,mBAAmB;SACpB;QACD,UAAU,EAAE,EAAE;KACf;IACD,MAAM,EAAE;QACN,WAAW,EAAE,+BAA+B;QAC5C,KAAK,EAAE;YACL,mBAAmB;YACnB,q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,CACF;6BACF;yBACF;wBACD,OAAO,EAAE,IAAI;qBACd,CAAC;gBACJ,CAAC;gBAED,IAAI,CAAC;oBACH,OAAO,MAAM,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;gBACtD,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACb,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;oBACjE,OAAO;wBACL,OAAO,EAAE;4BACP;gCACE,IAAI,EAAE,MAAM;gCACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB;oCACE,UAAU,EAAE,iBAAiB;oCAC7B,IAAI,EAAE,QAAQ;oCACd,OAAO;oCACP,cAAc,EAAE,KAAK;iCACtB,EACD,IAAI,EACJ,CAAC,CACF;6BACF;yBACF;wBACD,OAAO,EAAE,IAAI;qBACd,CAAC;gBACJ,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF"}
1
+ {"version":3,"file":"discovery.js","sourceRoot":"","sources":["../../src/tools/discovery.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAa7D,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,cAAc,GAAG,QAAQ,CAAC;AAQhC;;;;GAIG;AACH,MAAM,UAAU,GAAuC;IACrD,KAAK,EAAE;QACL,WAAW,EAAE,2BAA2B;QACxC,KAAK,EAAE;YACL,kBAAkB;YAClB,oBAAoB;YACpB,mBAAmB;YACnB,mBAAmB;YACnB,mBAAmB;YACnB,wBAAwB;YACxB,wBAAwB;YACxB,mBAAmB;SACpB;QACD,UAAU,EAAE,EAAE;KACf;IACD,MAAM,EAAE;QACN,WAAW,EAAE,+BAA+B;QAC5C,KAAK,EAAE;YACL,mBAAmB;YACnB,qBAAqB;YACrB,o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C1B,IAAI,EAAE,QAAQ;oCACd,OAAO,EACL,gGAAgG;oCAClG,cAAc,EAAE,KAAK;iCACtB,EACD,IAAI,EACJ,CAAC,CACF;6BACF;yBACF;wBACD,OAAO,EAAE,IAAI;qBACd,CAAC;gBACJ,CAAC;gBAED,IAAI,CAAC;oBACH,OAAO,MAAM,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;gBACtD,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACb,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;oBACjE,OAAO;wBACL,OAAO,EAAE;4BACP;gCACE,IAAI,EAAE,MAAM;gCACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB;oCACE,UAAU,EAAE,iBAAiB;oCAC7B,IAAI,EAAE,QAAQ;oCACd,OAAO;oCACP,cAAc,EAAE,KAAK;iCACtB,EACD,IAAI,EACJ,CAAC,CACF;6BACF;yBACF;wBACD,OAAO,EAAE,IAAI;qBACd,CAAC;gBACJ,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF"}
@@ -11,6 +11,42 @@ export declare class EnrichmentTools {
11
11
  executor: ToolExecutor;
12
12
  }>;
13
13
  private enrichmentCandidates;
14
+ /**
15
+ * ADR-179 `pica_resolve_work` executor — fan a work out across
16
+ * eligible enrichment sources and return the structured receipt.
17
+ *
18
+ * `isError` is set only when every source that ran errored. Empty
19
+ * applied[] + empty proposals[] + empty errors[] is a valid result
20
+ * (e.g. work has no trigger identifiers) and surfaces as a
21
+ * non-error response with a human-readable note.
22
+ */
23
+ private resolveWork;
24
+ /**
25
+ * ADR-179 Phase 3 `pica_resolve_recording` executor — fan a recording
26
+ * out across eligible platform sources and return the structured
27
+ * receipt. Same isError semantics as resolveWork / resolvePerson.
28
+ */
29
+ private resolveRecording;
30
+ /**
31
+ * ADR-179 Phase 2 `pica_resolve_person` executor — fan a person out
32
+ * across eligible identity-graph sources and return the structured
33
+ * receipt. Mirrors `resolveWork`'s isError semantics: partial failure
34
+ * is a non-error; isError only flips when every source that actually
35
+ * ran errored.
36
+ */
37
+ private resolvePerson;
38
+ /**
39
+ * ADR-179 deprecation path for the five per-source work enrichment
40
+ * tools. The tool definitions stay registered (so `tools/list`
41
+ * responses still surface them) but every call returns a structured
42
+ * TOOL_DEPRECATED error pointing at `pica_resolve_work`. This is the
43
+ * one-minor-version window described in ADR-179 Decision 2 —
44
+ * downstream clients with hardcoded names get a typed error and a
45
+ * suggested replacement call, not silent removal.
46
+ *
47
+ * Removal is scheduled for the next `@withpica/mcp-server` minor after
48
+ * Phase 4's publish; see the ADR's Phase 4 entry.
49
+ */
14
50
  private enrichWorkMlc;
15
51
  private enrichWorkMusicBrainz;
16
52
  private enrichWorkDiscogs;
@@ -22,5 +58,16 @@ export declare class EnrichmentTools {
22
58
  private listEnrichmentProposals;
23
59
  private applyEnrichmentProposal;
24
60
  private rejectEnrichmentProposal;
61
+ /**
62
+ * ADR-178: pica_enrichment_propose.
63
+ *
64
+ * Delegates to PicaClient.enrichment.proposeAgentResearch(). Errors
65
+ * surface from the SDK as `ApiError` with the raw JSON response in
66
+ * the message. We extract the service-layer error code (MISSING_SOURCE,
67
+ * DUPLICATE_SUPPRESSED, etc.) from the parsed body and surface it
68
+ * in structuredContent so the agent can reason about the failure
69
+ * without parsing free-text.
70
+ */
71
+ private proposeAgentResearch;
25
72
  }
26
73
  //# sourceMappingURL=enrichment.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"enrichment.d.ts","sourceRoot":"","sources":["../../src/tools/enrichment.ts"],"names":[],"mappings":"AAEA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,YAAY,EAAc,MAAM,YAAY,CAAC;AAKtE,qBAAa,eAAe;IAC1B,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;YA8U3D,oBAAoB;YAOpB,aAAa;YAKb,qBAAqB;YASrB,iBAAiB;YAOjB,iBAAiB;YAuBjB,iBAAiB;YAOjB,cAAc;YAQd,gBAAgB;YAUhB,aAAa;YASb,uBAAuB;YAcvB,uBAAuB;YAiBvB,wBAAwB;CAYvC"}
1
+ {"version":3,"file":"enrichment.d.ts","sourceRoot":"","sources":["../../src/tools/enrichment.ts"],"names":[],"mappings":"AAEA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,YAAY,EAAc,MAAM,YAAY,CAAC;AAItE,qBAAa,eAAe;IAC1B,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;YAglB3D,oBAAoB;IAOlC;;;;;;;;OAQG;YACW,WAAW;IAkCzB;;;;OAIG;YACW,gBAAgB;IAgC9B;;;;;;OAMG;YACW,aAAa;IA4B3B;;;;;;;;;;;OAWG;YACW,aAAa;YAQb,qBAAqB;YAUrB,iBAAiB;YAUjB,iBAAiB;YAUjB,iBAAiB;YAUjB,cAAc;YAQd,gBAAgB;YAUhB,aAAa;YASb,uBAAuB;YAcvB,uBAAuB;YAiBvB,wBAAwB;IAatC;;;;;;;;;OASG;YACW,oBAAoB;CA2CnC"}
@@ -1,7 +1,6 @@
1
1
  // Copyright (c) 2024-2026 Withpica Ltd. All rights reserved.
2
2
  import { formatAsText, formatSuccess } from "@withpica/mcp-utils";
3
3
  import { withCreditGate, withBillingGate } from "@withpica/mcp-utils";
4
- import { formatEnrichmentResult } from "@withpica/mcp-utils";
5
4
  export class EnrichmentTools {
6
5
  pica;
7
6
  constructor(pica) {
@@ -9,6 +8,127 @@ export class EnrichmentTools {
9
8
  }
10
9
  getTools() {
11
10
  return [
11
+ // ============================================================
12
+ // ADR-179: outcome-shaped resolver (replaces 5 per-source tools)
13
+ // ============================================================
14
+ {
15
+ definition: {
16
+ name: "pica_resolve_recording",
17
+ description: "Resolve a recording against every eligible external source in one call — Spotify, YouTube, MusicBrainz, Discogs. " +
18
+ "First recording-side enrichment tool in the MCP (ADR-179 Phase 3). Returns a structured receipt: " +
19
+ "`applied[]` (identifier-matched Tier A writes), `proposals[]` (Tier B fuzzy matches — reserved for future cascade rules), " +
20
+ "`errors[]` (per-source failures with retry hints). Partial failure is not an error — isError is set only when EVERY " +
21
+ "eligible source errored. " +
22
+ "Spotify adapter fetches Spotify track metadata (triggered by spotify_track_uri / spotify_track_id on the recording) " +
23
+ "and writes preview_url, duration_ms, isrc, and the URL set to NULL columns only — non-destructive. " +
24
+ "YouTube adapter fetches video metadata (triggered by youtube_video_id) and wires the ADR-166 classifyVersion() heuristic " +
25
+ "to populate version_type when it\'s NULL (satisfies the recordings.version_type CHECK constraint). An existing version_type " +
26
+ "is never overwritten. " +
27
+ "MusicBrainz + Discogs sources are stubs for now. " +
28
+ "Costs 1 pica credit per call. " +
29
+ "→ then: pica_recordings_inspect (see what changed)",
30
+ inputSchema: {
31
+ type: "object",
32
+ properties: {
33
+ recording_id: {
34
+ type: "string",
35
+ description: "The recording ID to resolve",
36
+ },
37
+ sources: {
38
+ type: "array",
39
+ items: {
40
+ type: "string",
41
+ enum: ["spotify", "youtube", "musicbrainz", "discogs"],
42
+ },
43
+ description: "Optional whitelist of sources to run. Omit to fan out to every eligible source.",
44
+ },
45
+ include_fuzzy: {
46
+ type: "boolean",
47
+ description: "Default true. Set false to skip Tier B fuzzy-match rules.",
48
+ },
49
+ },
50
+ required: ["recording_id"],
51
+ },
52
+ },
53
+ executor: withBillingGate(this.pica, "Recording resolver", withCreditGate(this.pica, "external_resolver_call", "Recording resolver", this.resolveRecording.bind(this))),
54
+ },
55
+ {
56
+ definition: {
57
+ name: "pica_resolve_person",
58
+ description: "Resolve a person against every eligible identity-graph source in one call — ISNI, MusicBrainz, Wikidata (downstream of both). " +
59
+ "Replaces the two pica_people_enrich_* tools. Returns a structured receipt: " +
60
+ "`applied[]` (identifier-matched Tier A writes — wikidata_id, awards, biography), " +
61
+ "`proposals[]` (fuzzy Tier B matches filed to the review queue), " +
62
+ "`errors[]` (per-source failures with retry hints). Partial failure is not an error — isError is set only when EVERY " +
63
+ "eligible source errored. " +
64
+ "Sources list is optional; omit to fan out to every source whose trigger identifiers are present on the person. " +
65
+ "Narrow to a single source with e.g. `sources: ['isni']` to reproduce the old per-source tool's behaviour. " +
66
+ "Set `include_fuzzy: false` to skip Tier B rules entirely (identifier-only pass, no review proposals queued). " +
67
+ "Costs 1 pica credit per call. " +
68
+ "→ then: pica_enrichment_proposals_list (review fuzzy matches), pica_people_inspect (see what changed), pica_enrichment_proposal_apply (accept a proposal)",
69
+ inputSchema: {
70
+ type: "object",
71
+ properties: {
72
+ person_id: {
73
+ type: "string",
74
+ description: "The person ID to resolve",
75
+ },
76
+ sources: {
77
+ type: "array",
78
+ items: {
79
+ type: "string",
80
+ enum: ["isni", "musicbrainz"],
81
+ },
82
+ description: "Optional whitelist of sources to run. Omit to fan out to every eligible source.",
83
+ },
84
+ include_fuzzy: {
85
+ type: "boolean",
86
+ description: "Default true. Set false to skip Tier B fuzzy-match rules (no review proposals queued).",
87
+ },
88
+ },
89
+ required: ["person_id"],
90
+ },
91
+ },
92
+ executor: withBillingGate(this.pica, "Person resolver", withCreditGate(this.pica, "external_resolver_call", "Person resolver", this.resolvePerson.bind(this))),
93
+ },
94
+ {
95
+ definition: {
96
+ name: "pica_resolve_work",
97
+ description: "Resolve a work against every eligible external source in one call — MLC, Spotify, YouTube, MusicBrainz, Discogs. " +
98
+ "Replaces the five pica_enrich_work_* tools. Returns a structured receipt: " +
99
+ "`applied[]` (identifier-matched Tier A writes), `proposals[]` (fuzzy Tier B matches filed to the review queue), " +
100
+ "`errors[]` (per-source failures with retry hints). Partial failure is not an error — isError is set only when EVERY " +
101
+ "eligible source errored. " +
102
+ "Sources list is optional; omit to fan out to every source whose trigger identifiers are present on the work. " +
103
+ "Narrow to a single source with e.g. `sources: ['spotify']` to reproduce the old per-source tool's behaviour. " +
104
+ "Set `include_fuzzy: false` to skip Tier B rules entirely (identifier-only pass, no review proposals queued). " +
105
+ "Costs 1 pica credit per call. " +
106
+ "→ then: pica_enrichment_proposals_list (review fuzzy matches), pica_works_inspect (see what changed), pica_enrichment_proposal_apply (accept a proposal)",
107
+ inputSchema: {
108
+ type: "object",
109
+ properties: {
110
+ work_id: {
111
+ type: "string",
112
+ description: "The work ID to resolve",
113
+ },
114
+ sources: {
115
+ type: "array",
116
+ items: {
117
+ type: "string",
118
+ enum: ["mlc", "spotify", "youtube", "musicbrainz", "discogs"],
119
+ },
120
+ description: "Optional whitelist of sources to run. Omit to fan out to every eligible source.",
121
+ },
122
+ include_fuzzy: {
123
+ type: "boolean",
124
+ description: "Default true. Set false to skip Tier B fuzzy-match rules (no review proposals queued).",
125
+ },
126
+ },
127
+ required: ["work_id"],
128
+ },
129
+ },
130
+ executor: withBillingGate(this.pica, "Work resolver", withCreditGate(this.pica, "external_resolver_call", "Work resolver", this.resolveWork.bind(this))),
131
+ },
12
132
  {
13
133
  definition: {
14
134
  name: "pica_enrichment_candidates",
@@ -277,39 +397,209 @@ export class EnrichmentTools {
277
397
  },
278
398
  executor: withBillingGate(this.pica, "Enrichment proposal reject", this.rejectEnrichmentProposal.bind(this)),
279
399
  },
400
+ // ============================================================
401
+ // ADR-178: Agent-proposed enrichment from open-web research
402
+ // ============================================================
403
+ {
404
+ definition: {
405
+ name: "pica_enrichment_propose",
406
+ description: "File an enrichment proposal sourced from open-web research (ADR-178). " +
407
+ "Use when you've found a fact about a work, recording, or person " +
408
+ "from an external site (Audiomack, Songdata, MusicBrainz page, " +
409
+ "label portal, artist bio, etc.) and want PICA to hold it pending " +
410
+ "review. Every proposed field MUST cite at least one source URL — " +
411
+ "unsourced claims are rejected. The server hard-codes source and " +
412
+ "rule_id to 'agent_research'; you do not set them. " +
413
+ "IN-SESSION APPROVAL IS THE CANONICAL FLOW: if the user is in " +
414
+ "this chat, ask for their approval directly, then call " +
415
+ "pica_enrichment_proposal_apply after their confirmation. Do not " +
416
+ "wait for the dashboard. The proposal row is the receipt, not " +
417
+ "the workflow. " +
418
+ "→ then: pica_enrichment_proposal_apply (apply after user approves), " +
419
+ "pica_enrichment_proposal_reject (dismiss if user disagrees)",
420
+ inputSchema: {
421
+ type: "object",
422
+ properties: {
423
+ entity_type: {
424
+ type: "string",
425
+ enum: ["work", "person", "recording"],
426
+ description: "What kind of entity this proposal anchors on",
427
+ },
428
+ entity_id: {
429
+ type: "string",
430
+ description: "The entity id in the caller's org",
431
+ },
432
+ proposed_fields: {
433
+ type: "object",
434
+ description: "The fields to propose writing. Every key here must appear in at least one sources[].fields array — otherwise MISSING_SOURCE is returned. Example: { tempo_bpm: 110, musical_key: 'D minor' }",
435
+ additionalProperties: true,
436
+ },
437
+ sources: {
438
+ type: "array",
439
+ description: "Per-field URL citations. Each entry names the fields it sources. One URL can cite multiple fields; one field can be cited by multiple URLs.",
440
+ items: {
441
+ type: "object",
442
+ properties: {
443
+ url: {
444
+ type: "string",
445
+ description: "The URL the fact was retrieved from",
446
+ },
447
+ fields: {
448
+ type: "array",
449
+ items: { type: "string" },
450
+ description: "Which proposed_fields keys this URL sources (non-empty)",
451
+ },
452
+ accessed_at: {
453
+ type: "string",
454
+ description: "ISO 8601 timestamp of when you accessed the URL",
455
+ },
456
+ },
457
+ required: ["url", "fields", "accessed_at"],
458
+ },
459
+ },
460
+ confidence: {
461
+ type: "number",
462
+ description: "Self-reported confidence 0..1 (optional). Surface cross-source agreement, match uncertainty, or source quality here.",
463
+ },
464
+ rationale: {
465
+ type: "string",
466
+ description: "Freeform explanation of how the facts were cross-referenced. Shown on the review surface alongside the sources.",
467
+ },
468
+ proposal_action: {
469
+ type: "string",
470
+ enum: ["update", "create"],
471
+ description: "Defaults to 'update'. 'create' reserved for a future phase where agents propose new entities; not currently exercised by any rule.",
472
+ },
473
+ },
474
+ required: [
475
+ "entity_type",
476
+ "entity_id",
477
+ "proposed_fields",
478
+ "sources",
479
+ ],
480
+ },
481
+ },
482
+ executor: withBillingGate(this.pica, "Enrichment agent-research propose", withCreditGate(this.pica, "enrichment_propose", "Enrichment agent-research propose", this.proposeAgentResearch.bind(this))),
483
+ },
280
484
  ];
281
485
  }
282
486
  async enrichmentCandidates(_args) {
283
487
  const result = await this.pica.enrichment.getCandidates();
284
488
  return formatAsText(result);
285
489
  }
490
+ /**
491
+ * ADR-179 `pica_resolve_work` executor — fan a work out across
492
+ * eligible enrichment sources and return the structured receipt.
493
+ *
494
+ * `isError` is set only when every source that ran errored. Empty
495
+ * applied[] + empty proposals[] + empty errors[] is a valid result
496
+ * (e.g. work has no trigger identifiers) and surfaces as a
497
+ * non-error response with a human-readable note.
498
+ */
499
+ async resolveWork(args) {
500
+ const workId = args.work_id;
501
+ const sources = args.sources;
502
+ const includeFuzzy = typeof args.include_fuzzy === "boolean" ? args.include_fuzzy : undefined;
503
+ const result = await this.pica.enrichment.resolveWork(workId, {
504
+ sources,
505
+ includeFuzzy,
506
+ });
507
+ // isError semantics per ADR-179 Decision 1: partial failure is not
508
+ // an error. Only when every source that actually ran errored do we
509
+ // flip the flag.
510
+ const ranCount = result.sources_run.length;
511
+ const errorCount = result.errors.length;
512
+ const allErrored = ranCount > 0 && errorCount >= ranCount;
513
+ const summary = `resolve work ${workId} — ` +
514
+ `${result.applied.length} applied, ` +
515
+ `${result.proposals.length} proposals, ` +
516
+ `${errorCount} errors (ran: ${result.sources_run.join(", ") || "none"})`;
517
+ return {
518
+ content: [{ type: "text", text: summary }],
519
+ structuredContent: result,
520
+ isError: allErrored,
521
+ };
522
+ }
523
+ /**
524
+ * ADR-179 Phase 3 `pica_resolve_recording` executor — fan a recording
525
+ * out across eligible platform sources and return the structured
526
+ * receipt. Same isError semantics as resolveWork / resolvePerson.
527
+ */
528
+ async resolveRecording(args) {
529
+ const recordingId = args.recording_id;
530
+ const sources = args.sources;
531
+ const includeFuzzy = typeof args.include_fuzzy === "boolean" ? args.include_fuzzy : undefined;
532
+ const result = await this.pica.enrichment.resolveRecording(recordingId, {
533
+ sources,
534
+ includeFuzzy,
535
+ });
536
+ const ranCount = result.sources_run.length;
537
+ const errorCount = result.errors.length;
538
+ const allErrored = ranCount > 0 && errorCount >= ranCount;
539
+ const summary = `resolve recording ${recordingId} — ` +
540
+ `${result.applied.length} applied, ` +
541
+ `${result.proposals.length} proposals, ` +
542
+ `${errorCount} errors (ran: ${result.sources_run.join(", ") || "none"})`;
543
+ return {
544
+ content: [{ type: "text", text: summary }],
545
+ structuredContent: result,
546
+ isError: allErrored,
547
+ };
548
+ }
549
+ /**
550
+ * ADR-179 Phase 2 `pica_resolve_person` executor — fan a person out
551
+ * across eligible identity-graph sources and return the structured
552
+ * receipt. Mirrors `resolveWork`'s isError semantics: partial failure
553
+ * is a non-error; isError only flips when every source that actually
554
+ * ran errored.
555
+ */
556
+ async resolvePerson(args) {
557
+ const personId = args.person_id;
558
+ const sources = args.sources;
559
+ const includeFuzzy = typeof args.include_fuzzy === "boolean" ? args.include_fuzzy : undefined;
560
+ const result = await this.pica.enrichment.resolvePerson(personId, {
561
+ sources,
562
+ includeFuzzy,
563
+ });
564
+ const ranCount = result.sources_run.length;
565
+ const errorCount = result.errors.length;
566
+ const allErrored = ranCount > 0 && errorCount >= ranCount;
567
+ const summary = `resolve person ${personId} — ` +
568
+ `${result.applied.length} applied, ` +
569
+ `${result.proposals.length} proposals, ` +
570
+ `${errorCount} errors (ran: ${result.sources_run.join(", ") || "none"})`;
571
+ return {
572
+ content: [{ type: "text", text: summary }],
573
+ structuredContent: result,
574
+ isError: allErrored,
575
+ };
576
+ }
577
+ /**
578
+ * ADR-179 deprecation path for the five per-source work enrichment
579
+ * tools. The tool definitions stay registered (so `tools/list`
580
+ * responses still surface them) but every call returns a structured
581
+ * TOOL_DEPRECATED error pointing at `pica_resolve_work`. This is the
582
+ * one-minor-version window described in ADR-179 Decision 2 —
583
+ * downstream clients with hardcoded names get a typed error and a
584
+ * suggested replacement call, not silent removal.
585
+ *
586
+ * Removal is scheduled for the next `@withpica/mcp-server` minor after
587
+ * Phase 4's publish; see the ADR's Phase 4 entry.
588
+ */
286
589
  async enrichWorkMlc(args) {
287
- const result = await this.pica.enrichment.enrichWorkMlc(args.work_id);
288
- return formatEnrichmentResult("work", args.work_id, "MLC", result);
590
+ return buildDeprecationResponse("pica_enrich_work_mlc", "mlc", args.work_id);
289
591
  }
290
592
  async enrichWorkMusicBrainz(args) {
291
- const result = await this.pica.enrichment.enrichWorkMusicBrainz(args.work_id);
292
- return formatEnrichmentResult("work", args.work_id, "MusicBrainz", result);
593
+ return buildDeprecationResponse("pica_enrich_work_musicbrainz", "musicbrainz", args.work_id);
293
594
  }
294
595
  async enrichWorkDiscogs(args) {
295
- const result = await this.pica.enrichment.enrichWorkDiscogs(args.work_id);
296
- return formatEnrichmentResult("work", args.work_id, "Discogs", result);
596
+ return buildDeprecationResponse("pica_enrich_work_discogs", "discogs", args.work_id);
297
597
  }
298
598
  async enrichWorkSpotify(args) {
299
- const workId = args.work_id;
300
- const spotifyUrl = args.spotify_url;
301
- // If spotify_url provided, link it to the work first, then enrich
302
- if (spotifyUrl) {
303
- const result = await this.pica.enrichment.linkAndEnrichSpotify(workId, spotifyUrl);
304
- return formatSuccess(`Linked Spotify track and enriched work ${workId}`, result);
305
- }
306
- // work_id only — enrich from already-linked Spotify data
307
- const result = await this.pica.enrichment.enrichWorkSpotify(workId);
308
- return formatEnrichmentResult("work", workId, "Spotify", result);
599
+ return buildDeprecationResponse("pica_enrich_work_spotify", "spotify", args.work_id);
309
600
  }
310
601
  async enrichWorkYouTube(args) {
311
- const result = await this.pica.enrichment.enrichWorkYouTube(args.work_id);
312
- return formatEnrichmentResult("work", args.work_id, "YouTube", result);
602
+ return buildDeprecationResponse("pica_enrich_work_youtube", "youtube", args.work_id);
313
603
  }
314
604
  async runWorkCascade(args) {
315
605
  const result = await this.pica.enrichment.runWorkCascade(args.work_id);
@@ -352,5 +642,112 @@ export class EnrichmentTools {
352
642
  });
353
643
  return formatSuccess(`Enrichment proposal ${proposalId} rejected`, result);
354
644
  }
645
+ /**
646
+ * ADR-178: pica_enrichment_propose.
647
+ *
648
+ * Delegates to PicaClient.enrichment.proposeAgentResearch(). Errors
649
+ * surface from the SDK as `ApiError` with the raw JSON response in
650
+ * the message. We extract the service-layer error code (MISSING_SOURCE,
651
+ * DUPLICATE_SUPPRESSED, etc.) from the parsed body and surface it
652
+ * in structuredContent so the agent can reason about the failure
653
+ * without parsing free-text.
654
+ */
655
+ async proposeAgentResearch(args) {
656
+ try {
657
+ const result = await this.pica.enrichment.proposeAgentResearch({
658
+ entity_type: args.entity_type,
659
+ entity_id: args.entity_id,
660
+ proposed_fields: args.proposed_fields,
661
+ sources: args.sources,
662
+ confidence_score: args.confidence ?? null,
663
+ rationale: args.rationale,
664
+ proposal_action: args.proposal_action,
665
+ });
666
+ return formatSuccess(`Enrichment proposal ${result.proposal_id} filed (pending review)`, result);
667
+ }
668
+ catch (err) {
669
+ const parsed = extractApiErrorBody(err);
670
+ const code = parsed?.code ??
671
+ (err instanceof Error && err.message.includes("409")
672
+ ? "DUPLICATE_SUPPRESSED"
673
+ : "REQUEST_FAILED");
674
+ const humanMessage = parsed?.error ?? (err instanceof Error ? err.message : "unknown error");
675
+ return {
676
+ content: [
677
+ {
678
+ type: "text",
679
+ text: `enrichment_propose failed — ${code}: ${humanMessage}`,
680
+ },
681
+ ],
682
+ structuredContent: {
683
+ code,
684
+ error: humanMessage,
685
+ details: parsed?.details ?? null,
686
+ },
687
+ isError: true,
688
+ };
689
+ }
690
+ }
691
+ }
692
+ /**
693
+ * Extract a structured error body from an SDK thrown error. The SDK's
694
+ * ApiError wraps the response body text in the message as
695
+ * "API request failed: {status} {body}". We pull the trailing JSON
696
+ * object out and parse it. Returns null on anything we can't parse —
697
+ * the caller falls back to the raw message.
698
+ */
699
+ function extractApiErrorBody(err) {
700
+ if (!(err instanceof Error))
701
+ return null;
702
+ const match = err.message.match(/\{[\s\S]*\}/);
703
+ if (!match)
704
+ return null;
705
+ try {
706
+ return JSON.parse(match[0]);
707
+ }
708
+ catch {
709
+ return null;
710
+ }
711
+ }
712
+ /**
713
+ * ADR-179 deprecation envelope. Returned by the five per-source work
714
+ * enrichment executors that have been folded into `pica_resolve_work`.
715
+ *
716
+ * Shape carries:
717
+ * - `code`: "TOOL_DEPRECATED" (stable identifier for clients)
718
+ * - `jsonrpc_code`: -32070 (MCP-level error code per ADR-179)
719
+ * - `replacement`: tool name the agent should call instead
720
+ * - `suggested_call`: a concrete `{ tool, args }` payload the agent
721
+ * can execute via `pica_execute` without further thought
722
+ *
723
+ * The text `content[0]` is agent-readable; `structuredContent` is the
724
+ * machine-parseable version for clients that branch on error codes.
725
+ */
726
+ function buildDeprecationResponse(deprecatedTool, source, workId) {
727
+ const suggested_call = {
728
+ tool: "pica_resolve_work",
729
+ args: {
730
+ work_id: workId ?? "<work_id>",
731
+ sources: [source],
732
+ },
733
+ };
734
+ return {
735
+ content: [
736
+ {
737
+ type: "text",
738
+ text: `TOOL_DEPRECATED: ${deprecatedTool} is deprecated. ` +
739
+ `Use pica_resolve_work(sources: ["${source}"]) instead. ` +
740
+ `This tool will be removed in the next @withpica/mcp-server minor version.`,
741
+ },
742
+ ],
743
+ structuredContent: {
744
+ code: "TOOL_DEPRECATED",
745
+ jsonrpc_code: -32070,
746
+ deprecated_tool: deprecatedTool,
747
+ replacement: "pica_resolve_work",
748
+ suggested_call,
749
+ },
750
+ isError: true,
751
+ };
355
752
  }
356
753
  //# sourceMappingURL=enrichment.js.map