@withpica/mcp-server 2.11.0 → 2.23.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 (96) hide show
  1. package/CHANGELOG.md +639 -1
  2. package/dist/config.d.ts.map +1 -1
  3. package/dist/config.js +3 -2
  4. package/dist/config.js.map +1 -1
  5. package/dist/prompts/index.d.ts +48 -16
  6. package/dist/prompts/index.d.ts.map +1 -1
  7. package/dist/prompts/index.js +320 -607
  8. package/dist/prompts/index.js.map +1 -1
  9. package/dist/tools/agreement-types.d.ts.map +1 -1
  10. package/dist/tools/agreement-types.js +14 -129
  11. package/dist/tools/agreement-types.js.map +1 -1
  12. package/dist/tools/agreements.d.ts.map +1 -1
  13. package/dist/tools/agreements.js +11 -109
  14. package/dist/tools/agreements.js.map +1 -1
  15. package/dist/tools/assets.d.ts.map +1 -1
  16. package/dist/tools/assets.js +17 -257
  17. package/dist/tools/assets.js.map +1 -1
  18. package/dist/tools/audit.d.ts +19 -0
  19. package/dist/tools/audit.d.ts.map +1 -0
  20. package/dist/tools/audit.js +57 -0
  21. package/dist/tools/audit.js.map +1 -0
  22. package/dist/tools/bulk.d.ts +7 -1
  23. package/dist/tools/bulk.d.ts.map +1 -1
  24. package/dist/tools/bulk.js +24 -2
  25. package/dist/tools/bulk.js.map +1 -1
  26. package/dist/tools/credits.d.ts.map +1 -1
  27. package/dist/tools/credits.js +27 -13
  28. package/dist/tools/credits.js.map +1 -1
  29. package/dist/tools/discovery.d.ts.map +1 -1
  30. package/dist/tools/discovery.js +25 -0
  31. package/dist/tools/discovery.js.map +1 -1
  32. package/dist/tools/enrichment.d.ts +47 -0
  33. package/dist/tools/enrichment.d.ts.map +1 -1
  34. package/dist/tools/enrichment.js +416 -19
  35. package/dist/tools/enrichment.js.map +1 -1
  36. package/dist/tools/index.d.ts.map +1 -1
  37. package/dist/tools/index.js +17 -0
  38. package/dist/tools/index.js.map +1 -1
  39. package/dist/tools/labels.d.ts +20 -0
  40. package/dist/tools/labels.d.ts.map +1 -0
  41. package/dist/tools/labels.js +47 -0
  42. package/dist/tools/labels.js.map +1 -0
  43. package/dist/tools/metadata.d.ts.map +1 -1
  44. package/dist/tools/metadata.js +93 -0
  45. package/dist/tools/metadata.js.map +1 -1
  46. package/dist/tools/multimedia.d.ts.map +1 -1
  47. package/dist/tools/multimedia.js +86 -11
  48. package/dist/tools/multimedia.js.map +1 -1
  49. package/dist/tools/notes.d.ts.map +1 -1
  50. package/dist/tools/notes.js +4 -1
  51. package/dist/tools/notes.js.map +1 -1
  52. package/dist/tools/people.d.ts +228 -4
  53. package/dist/tools/people.d.ts.map +1 -1
  54. package/dist/tools/people.js +238 -262
  55. package/dist/tools/people.js.map +1 -1
  56. package/dist/tools/projects.d.ts +1 -0
  57. package/dist/tools/projects.d.ts.map +1 -1
  58. package/dist/tools/projects.js +188 -17
  59. package/dist/tools/projects.js.map +1 -1
  60. package/dist/tools/publishers.d.ts +15 -1
  61. package/dist/tools/publishers.d.ts.map +1 -1
  62. package/dist/tools/publishers.js +43 -9
  63. package/dist/tools/publishers.js.map +1 -1
  64. package/dist/tools/recordings.d.ts +53 -2
  65. package/dist/tools/recordings.d.ts.map +1 -1
  66. package/dist/tools/recordings.js +185 -122
  67. package/dist/tools/recordings.js.map +1 -1
  68. package/dist/tools/recovery-hints.d.ts.map +1 -1
  69. package/dist/tools/recovery-hints.js +49 -0
  70. package/dist/tools/recovery-hints.js.map +1 -1
  71. package/dist/tools/releases.d.ts +19 -1
  72. package/dist/tools/releases.d.ts.map +1 -1
  73. package/dist/tools/releases.js +538 -32
  74. package/dist/tools/releases.js.map +1 -1
  75. package/dist/tools/sessions.d.ts.map +1 -1
  76. package/dist/tools/sessions.js +42 -8
  77. package/dist/tools/sessions.js.map +1 -1
  78. package/dist/tools/settings.d.ts +4 -0
  79. package/dist/tools/settings.d.ts.map +1 -1
  80. package/dist/tools/settings.js +155 -1
  81. package/dist/tools/settings.js.map +1 -1
  82. package/dist/tools/share-links.d.ts.map +1 -1
  83. package/dist/tools/share-links.js +19 -53
  84. package/dist/tools/share-links.js.map +1 -1
  85. package/dist/tools/split-sheets.d.ts.map +1 -1
  86. package/dist/tools/split-sheets.js +3 -42
  87. package/dist/tools/split-sheets.js.map +1 -1
  88. package/dist/tools/team.d.ts.map +1 -1
  89. package/dist/tools/team.js +9 -4
  90. package/dist/tools/team.js.map +1 -1
  91. package/dist/tools/works.d.ts +27 -1
  92. package/dist/tools/works.d.ts.map +1 -1
  93. package/dist/tools/works.js +119 -219
  94. package/dist/tools/works.js.map +1 -1
  95. package/package.json +3 -2
  96. package/server.json +2 -2
@@ -40,26 +40,74 @@ export class ProjectsTools {
40
40
  {
41
41
  definition: {
42
42
  name: "pica_projects_create",
43
- description: "Create a new project to organise your worksalbums, EPs, compilations, or any collection.",
43
+ description: "Create a new project to organise collaborative workwriting camps, recording sessions, production/mixing/mastering milestones, retreats. " +
44
+ "To attach works to the project after creation, call POST /api/admin/projects/[id]/works — work_ids is not accepted here.",
44
45
  inputSchema: {
45
46
  type: "object",
46
47
  properties: {
47
48
  name: {
48
49
  type: "string",
49
- description: "Project name",
50
+ description: "Project name (required).",
50
51
  },
51
52
  project_type: {
52
53
  type: "string",
53
- description: "Type of project (e.g. album, ep, compilation, single, mixtape)",
54
+ description: "Type of project. Conventional values: writing_camp, recording_session, production, mixing, mastering, retreat, other. Defaults to writing_camp.",
54
55
  },
55
56
  description: {
56
57
  type: "string",
57
- description: "Optional project description",
58
+ description: "Optional project description.",
58
59
  },
59
- work_ids: {
60
- type: "array",
61
- items: { type: "string" },
62
- description: "Optional: work IDs to add to the project",
60
+ start_date: {
61
+ type: "string",
62
+ description: "Project start date (ISO YYYY-MM-DD). Used for scheduling and calendar display.",
63
+ },
64
+ end_date: {
65
+ type: "string",
66
+ description: "Project end date (ISO YYYY-MM-DD). Must be on or after start_date if both set.",
67
+ },
68
+ location_name: {
69
+ type: "string",
70
+ description: "Physical location name (e.g. 'Abbey Road Studio 2').",
71
+ },
72
+ location_address: {
73
+ type: "string",
74
+ description: "Street address of the location.",
75
+ },
76
+ location_url: {
77
+ type: "string",
78
+ description: "URL to a map or location page (e.g. Google Maps link).",
79
+ },
80
+ virtual_url: {
81
+ type: "string",
82
+ description: "Video-call / virtual-meeting URL for remote participation.",
83
+ },
84
+ is_open: {
85
+ type: "boolean",
86
+ description: "Whether the project is open for new participants to join via the invite code. Default: true.",
87
+ },
88
+ max_participants: {
89
+ type: "number",
90
+ description: "Maximum number of participants. Null / omitted = no cap.",
91
+ },
92
+ status: {
93
+ type: "string",
94
+ enum: [
95
+ "draft",
96
+ "scheduled",
97
+ "active",
98
+ "completed",
99
+ "cancelled",
100
+ ],
101
+ description: "Project status. Default: draft.",
102
+ },
103
+ generate_invite_code: {
104
+ type: "boolean",
105
+ description: "If true, the service generates a unique invite code on create so participants can join. Default: false.",
106
+ },
107
+ metadata: {
108
+ type: "object",
109
+ additionalProperties: true,
110
+ description: "Optional freeform jsonb metadata (e.g. { notes, tags }).",
63
111
  },
64
112
  },
65
113
  required: ["name"],
@@ -70,24 +118,68 @@ export class ProjectsTools {
70
118
  {
71
119
  definition: {
72
120
  name: "pica_projects_update",
73
- description: "Update project details name, type, description, or linked works.",
121
+ description: "Update project details. Any field from the Create schema can be updated. " +
122
+ "To attach or detach works from the project, call /api/admin/projects/[id]/works — work_ids is not accepted here.",
74
123
  inputSchema: {
75
124
  type: "object",
76
125
  properties: {
77
- id: { type: "string", description: "Project ID" },
78
- name: { type: "string", description: "Updated project name" },
126
+ id: { type: "string", description: "Project ID (required)." },
127
+ name: { type: "string", description: "Updated project name." },
79
128
  project_type: {
80
129
  type: "string",
81
- description: "Updated project type",
130
+ description: "Updated project type. Conventional values: writing_camp, recording_session, production, mixing, mastering, retreat, other.",
82
131
  },
83
132
  description: {
84
133
  type: "string",
85
- description: "Updated description",
134
+ description: "Updated description.",
86
135
  },
87
- work_ids: {
88
- type: "array",
89
- items: { type: "string" },
90
- description: "Updated list of work IDs",
136
+ start_date: {
137
+ type: "string",
138
+ description: "Updated start date (ISO YYYY-MM-DD).",
139
+ },
140
+ end_date: {
141
+ type: "string",
142
+ description: "Updated end date (ISO YYYY-MM-DD).",
143
+ },
144
+ location_name: {
145
+ type: "string",
146
+ description: "Updated location name.",
147
+ },
148
+ location_address: {
149
+ type: "string",
150
+ description: "Updated location address.",
151
+ },
152
+ location_url: {
153
+ type: "string",
154
+ description: "Updated location URL.",
155
+ },
156
+ virtual_url: {
157
+ type: "string",
158
+ description: "Updated virtual-meeting URL.",
159
+ },
160
+ is_open: {
161
+ type: "boolean",
162
+ description: "Whether the project is open for new participants.",
163
+ },
164
+ max_participants: {
165
+ type: "number",
166
+ description: "Updated participant cap.",
167
+ },
168
+ status: {
169
+ type: "string",
170
+ enum: [
171
+ "draft",
172
+ "scheduled",
173
+ "active",
174
+ "completed",
175
+ "cancelled",
176
+ ],
177
+ description: "Updated project status.",
178
+ },
179
+ metadata: {
180
+ type: "object",
181
+ additionalProperties: true,
182
+ description: "Updated freeform jsonb metadata.",
91
183
  },
92
184
  },
93
185
  required: ["id"],
@@ -109,6 +201,53 @@ export class ProjectsTools {
109
201
  },
110
202
  executor: this.deleteProject.bind(this),
111
203
  },
204
+ {
205
+ definition: {
206
+ name: "pica_projects_attach_works",
207
+ description: "Attach one or more works to a project via the `project_works` " +
208
+ "junction. Closes the ADR-174 Phase 2 item 7 gap where " +
209
+ "`pica_projects_create` / `_update` rejected `work_ids` with " +
210
+ "FIELD_NOT_WIRED. Each item is attached with an individual POST " +
211
+ "so partial failure is surfaced per-work in the result — " +
212
+ "already-linked works are reported as `skipped` (not a hard " +
213
+ "error), and other failures surface their admin-route error " +
214
+ "message in `failed[]`.",
215
+ inputSchema: {
216
+ type: "object",
217
+ properties: {
218
+ project_id: {
219
+ type: "string",
220
+ description: "Project UUID.",
221
+ },
222
+ works: {
223
+ type: "array",
224
+ description: "Works to attach. Each: { work_id (required), project_day (optional integer >= 1), notes (optional string) }.",
225
+ items: {
226
+ type: "object",
227
+ properties: {
228
+ work_id: {
229
+ type: "string",
230
+ description: "Work UUID to attach.",
231
+ },
232
+ project_day: {
233
+ type: "number",
234
+ description: "Optional day number within the project (1-indexed).",
235
+ },
236
+ notes: {
237
+ type: "string",
238
+ description: "Optional notes about this attachment.",
239
+ },
240
+ },
241
+ required: ["work_id"],
242
+ },
243
+ minItems: 1,
244
+ },
245
+ },
246
+ required: ["project_id", "works"],
247
+ },
248
+ },
249
+ executor: this.attachWorks.bind(this),
250
+ },
112
251
  ];
113
252
  }
114
253
  async listProjects(args) {
@@ -136,5 +275,37 @@ export class ProjectsTools {
136
275
  await this.pica.projects.delete(args.id);
137
276
  return formatSuccess(`Project ${args.id} deleted`);
138
277
  }
278
+ async attachWorks(args) {
279
+ const projectId = args.project_id;
280
+ const works = args.works ?? [];
281
+ const attached = [];
282
+ const skipped = [];
283
+ const failed = [];
284
+ for (const item of works) {
285
+ try {
286
+ const res = await this.pica.projects.attachWork(projectId, {
287
+ work_id: item.work_id,
288
+ project_day: item.project_day ?? null,
289
+ notes: item.notes ?? null,
290
+ });
291
+ attached.push({
292
+ work_id: item.work_id,
293
+ project_work_id: res?.data?.id ?? res?.id ?? "",
294
+ });
295
+ }
296
+ catch (err) {
297
+ const message = err?.message ?? (typeof err === "string" ? err : "unknown error");
298
+ if (/already linked/i.test(message)) {
299
+ skipped.push({ work_id: item.work_id, reason: "already_linked" });
300
+ }
301
+ else {
302
+ failed.push({ work_id: item.work_id, error: message });
303
+ }
304
+ }
305
+ }
306
+ return formatSuccess(`Attached ${attached.length}/${works.length} work(s) to project ${projectId}` +
307
+ (skipped.length ? ` — ${skipped.length} skipped` : "") +
308
+ (failed.length ? ` — ${failed.length} failed` : ""), { project_id: projectId, attached, skipped, failed });
309
+ }
139
310
  }
140
311
  //# sourceMappingURL=projects.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"projects.js","sourceRoot":"","sources":["../../src/tools/projects.ts"],"names":[],"mappings":"AAAA,6DAA6D;AA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AE,IAAI,CAAC,OAAO;oBACrB,eAAe,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,IAAI,GAAG,EAAE,EAAE,IAAI,EAAE;iBAChD,CAAC,CAAC;YACL,CAAC;YAAC,OAAO,GAAQ,EAAE,CAAC;gBAClB,MAAM,OAAO,GACX,GAAG,EAAE,OAAO,IAAI,CAAC,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC;gBACpE,IAAI,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;oBACpC,OAAO,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC,CAAC;gBACpE,CAAC;qBAAM,CAAC;oBACN,MAAM,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;gBACzD,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,aAAa,CAClB,YAAY,QAAQ,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM,uBAAuB,SAAS,EAAE;YAC3E,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,OAAO,CAAC,MAAM,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;YACtD,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,MAAM,CAAC,MAAM,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,EACrD,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,CACrD,CAAC;IACJ,CAAC;CACF"}
@@ -1,5 +1,19 @@
1
1
  /**
2
- * Publishers Tools - MCP tools for querying and creating publisher records
2
+ * Publishers Tools - MCP tools for querying and creating publisher records.
3
+ *
4
+ * ADR-174 Phase 2 item 22: `pica_publishers_create` is stdio-only (no
5
+ * mcp-server-business counterpart) so the schema lives inline rather than
6
+ * going through `@withpica/mcp-utils/write-schemas`. The route-layer
7
+ * allow-list at `lib/services/publishers-write-constants.ts` is the
8
+ * authoritative enforcement boundary; this schema is the agent-facing
9
+ * contract and surfaces the same shape so the tool advertises every
10
+ * writable column on `global_publishers`.
11
+ *
12
+ * Pre-slice the schema accepted `{ name, ipi }` and every other DB
13
+ * column was invisible to agents. Post-slice all 8 audit-row-22
14
+ * Add-candidates are exposed, and the `ipi → ipi_number` rename is
15
+ * explicit (the route returns a PHANTOM_FIELD error with a rename hint
16
+ * if `ipi` is still sent).
3
17
  */
4
18
  import { PicaClient } from "@withpica/mcp-sdk";
5
19
  import { ToolDefinition, ToolExecutor } from "./index.js";
@@ -1 +1 @@
1
- {"version":3,"file":"publishers.d.ts","sourceRoot":"","sources":["../../src/tools/publishers.ts"],"names":[],"mappings":"AAEA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,YAAY,EAAc,MAAM,YAAY,CAAC;AAGtE,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;YA8C3D,eAAe;YAaf,eAAe;CAS9B"}
1
+ {"version":3,"file":"publishers.d.ts","sourceRoot":"","sources":["../../src/tools/publishers.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,YAAY,EAAc,MAAM,YAAY,CAAC;AAGtE,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;YAwF3D,eAAe;YAaf,eAAe;CAQ9B"}
@@ -31,17 +31,54 @@ export class PublishersTools {
31
31
  {
32
32
  definition: {
33
33
  name: "pica_publishers_create",
34
- description: "Create a new publisher record. Check pica_publishers_query first to avoid duplicates.",
34
+ description: "Create (or fetch existing) publisher in the catalog-wide " +
35
+ "`global_publishers` table. Idempotent by ipi_number — if a " +
36
+ "publisher with the same IPI already exists, returns the existing " +
37
+ "row. Check `pica_publishers_query` first to avoid duplicates and " +
38
+ "to resolve parent_publisher_id.",
35
39
  inputSchema: {
36
40
  type: "object",
37
41
  properties: {
38
- name: { type: "string", description: "Publisher name" },
39
- ipi: {
42
+ name: { type: "string", description: "Publisher name." },
43
+ ipi_number: {
40
44
  type: "string",
41
- description: "Publisher IPI number (9-11 digits)",
45
+ description: "Publisher IPI number (9-11 digits; normalised to 11 with " +
46
+ "leading zero-padding). Required.",
47
+ },
48
+ legal_name: {
49
+ type: "string",
50
+ description: "Legal entity name (e.g. 'Example Publishing Ltd.') — optional.",
51
+ },
52
+ country: {
53
+ type: "string",
54
+ description: "ISO country code (e.g. 'GB', 'US').",
55
+ },
56
+ isni: {
57
+ type: "string",
58
+ description: "ISNI identifier (16-character alphanumeric) if the publisher has one.",
59
+ },
60
+ publisher_type: {
61
+ type: "string",
62
+ description: "Category label (e.g. 'major', 'indie', 'admin', 'self_published'). Freeform — no backend CHECK.",
63
+ },
64
+ wikidata_id: {
65
+ type: "string",
66
+ description: "Wikidata Q-number (e.g. 'Q123456').",
67
+ },
68
+ parent_publisher_id: {
69
+ type: "string",
70
+ description: "UUID of parent publisher for subsidiary/admin relationships. FK → global_publishers.id. Use `pica_publishers_query` to find the parent's ID before passing it here; the route returns FK_NOT_FOUND if the UUID does not exist.",
71
+ },
72
+ founded_date: {
73
+ type: "string",
74
+ description: "Founding date (YYYY-MM-DD).",
75
+ },
76
+ headquarters: {
77
+ type: "string",
78
+ description: "Freeform location (e.g. 'London, UK').",
42
79
  },
43
80
  },
44
- required: ["name"],
81
+ required: ["name", "ipi_number"],
45
82
  },
46
83
  },
47
84
  executor: this.createPublisher.bind(this),
@@ -59,10 +96,7 @@ export class PublishersTools {
59
96
  });
60
97
  }
61
98
  async createPublisher(args) {
62
- const result = await this.pica.publishers.create({
63
- name: args.name,
64
- ipi: args.ipi,
65
- });
99
+ const result = await this.pica.publishers.create(args);
66
100
  return formatSuccess("Publisher created", result);
67
101
  }
68
102
  }
@@ -1 +1 @@
1
- {"version":3,"file":"publishers.js","sourceRoot":"","sources":["../../src/tools/publishers.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAQ7D,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAE1E,MAAM,OAAO,eAAe;IAClB,IAAI,CAAa;IAEzB,YAAY,IAAgB;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,QAAQ;QACN,OAAO;YACL;gBACE,UAAU,EAAE;oBACV,IAAI,EAAE,uBAAuB;oBAC7B,WAAW,EACT,2EAA2E;wBAC3E,0DAA0D;oBAC5D,WAAW,EAAE;wBACX,IAAI,EAAE,QAAQ;wBACd,UAAU,EAAE;4BACV,KAAK,EAAE;gCACL,IAAI,EAAE,QAAQ;gCACd,WAAW,EAAE,iCAAiC;6BAC/C;4BACD,KAAK,EAAE;gCACL,IAAI,EAAE,QAAQ;gCACd,WAAW,EAAE,2BAA2B;6BACzC;yBACF;qBACF;iBACF;gBACD,QAAQ,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC;aAC1C;YACD;gBACE,UAAU,EAAE;oBACV,IAAI,EAAE,wBAAwB;oBAC9B,WAAW,EACT,uFAAuF;oBACzF,WAAW,EAAE;wBACX,IAAI,EAAE,QAAQ;wBACd,UAAU,EAAE;4BACV,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,gBA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BACD,mBAAmB,EAAE;gCACnB,IAAI,EAAE,QAAQ;gCACd,WAAW,EACT,gOAAgO;6BACnO;4BACD,YAAY,EAAE;gCACZ,IAAI,EAAE,QAAQ;gCACd,WAAW,EAAE,6BAA6B;6BAC3C;4BACD,YAAY,EAAE;gCACZ,IAAI,EAAE,QAAQ;gCACd,WAAW,EAAE,wCAAwC;6BACtD;yBACF;wBACD,QAAQ,EAAE,CAAC,MAAM,EAAE,YAAY,CAAC;qBACjC;iBACF;gBACD,QAAQ,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC;aAC1C;SACF,CAAC;IACJ,CAAC;IAEO,KAAK,CAAC,eAAe,CAC3B,IAA6B;QAE7B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;YAC7C,KAAK,EAAE,IAAI,CAAC,KAA2B;YACvC,KAAK,EAAG,IAAI,CAAC,KAAgB,IAAI,EAAE;SACpC,CAAC,CAAC;QACH,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,IAAI,IAAI,EAAE,CAAC;QACvE,OAAO,oBAAoB,CAAC,UAAU,EAAE,WAAW,EAAE;YACnD,KAAK,EAAE,UAAU,CAAC,MAAM;SACzB,CAAC,CAAC;IACL,CAAC;IAEO,KAAK,CAAC,eAAe,CAC3B,IAA6B;QAE7B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAC9C,IAA+B,CAChC,CAAC;QACF,OAAO,aAAa,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;IACpD,CAAC;CACF"}
@@ -1,12 +1,56 @@
1
1
  /**
2
- * Recordings Tools - MCP tools for managing recordings
2
+ * Recordings Tools MCP tools for managing recordings.
3
3
  *
4
4
  * ADR-149 Phase 5b: Consolidated to query+inspect pattern.
5
5
  * - pica_recordings_query replaces pica_recordings_list + pica_recordings_by_work
6
6
  * - pica_recordings_inspect replaces pica_recordings_get (with sections support)
7
+ *
8
+ * ADR-174 Phase 2 item 3 reconciliation: the write surface covers only
9
+ * real columns on `public.recordings`. Phantom fields previously
10
+ * accepted via `additionalProperties: true` are gone; agents that
11
+ * tried to set them silently dropped data on the way to Postgres.
12
+ *
13
+ * Two pre-flight surprises documented inline below:
14
+ *
15
+ * 1. `title` is a legacy alias for `recording_title`. The HTTP route
16
+ * translates before the service sees the payload (POST since the
17
+ * route was written, PATCH only since ADR-174). The tool keeps
18
+ * `title` as the input field name for caller ergonomics; the
19
+ * description marks the rename explicitly.
20
+ *
21
+ * 2. Duration lives in `duration_ms` on recordings (works carry
22
+ * `duration_seconds`). Agents conflating the two get a 400 with
23
+ * a redirect from the route allow-list.
24
+ *
25
+ * Add-candidates surfaced per the audit at
26
+ * docs/audits/2026-04-14-mcp-db-reconciliation.md §3:
27
+ * duration_ms, preview_url, album_art_url, spotify_url,
28
+ * spotify_track_uri, spotify_track_id, youtube_video_id, youtube_url,
29
+ * apple_music_url, deezer_track_id, mlc_recording_id, mlc_song_code,
30
+ * isrc_prefix.
31
+ *
32
+ * Most of these are populated by the enrichment cascade on streaming
33
+ * import; exposing them lets agents seed or override that data
34
+ * deliberately rather than discovering — surprised — that the field
35
+ * they thought they set was silently absent.
7
36
  */
8
37
  import { PicaClient } from "@withpica/mcp-sdk";
9
38
  import { ToolDefinition, ToolExecutor } from "./index.js";
39
+ /**
40
+ * Canonical write-schema for `recordings`. Every property must
41
+ * correspond to a real column on `public.recordings` (or be the
42
+ * documented `title` legacy alias) — verified against
43
+ * `lib/db/database.types.ts`. The HTTP route at
44
+ * `app/api/admin/recordings/route.ts` carries the same allow-list
45
+ * (plus the `recording_type` legacy alias for non-MCP callers); this
46
+ * list is the narrower MCP-agent contract.
47
+ *
48
+ * `version_type` is enum-restricted by the
49
+ * `recordings_version_type_check` CHECK constraint (ADR-166 Phase 1).
50
+ * Reflecting the enum here means agents see invalid values as schema
51
+ * errors at the tool surface, not as 500s round-tripped from Postgres.
52
+ */
53
+ declare const RECORDING_WRITE_PROPERTIES: Record<string, Record<string, unknown>>;
10
54
  export declare class RecordingsTools {
11
55
  private pica;
12
56
  constructor(pica: PicaClient);
@@ -26,7 +70,13 @@ export declare class RecordingsTools {
26
70
  */
27
71
  private inspectRecording;
28
72
  /**
29
- * Create recording
73
+ * Create recording.
74
+ *
75
+ * `version_type` defaults to 'master' (the DB-level default and the
76
+ * canonical ADR-166 value). Pre-ADR-174 the executor defaulted to
77
+ * 'original', which is not a valid version_type — every call without
78
+ * an explicit type tripped the recording-type CHECK constraint and
79
+ * surfaced as a 500 from the service.
30
80
  */
31
81
  private createRecording;
32
82
  /**
@@ -38,4 +88,5 @@ export declare class RecordingsTools {
38
88
  */
39
89
  private deleteRecording;
40
90
  }
91
+ export { RECORDING_WRITE_PROPERTIES };
41
92
  //# sourceMappingURL=recordings.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"recordings.d.ts","sourceRoot":"","sources":["../../src/tools/recordings.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,YAAY,EAAc,MAAM,YAAY,CAAC;AAOtE,qBAAa,eAAe;IAC1B,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;IAyOzE;;OAEG;YACW,eAAe;IAkC7B;;OAEG;YACW,gBAAgB;IA8F9B;;OAEG;YACW,eAAe;IAU7B;;OAEG;YACW,eAAe;IAW7B;;OAEG;YACW,eAAe;CAM9B"}
1
+ {"version":3,"file":"recordings.d.ts","sourceRoot":"","sources":["../../src/tools/recordings.ts"],"names":[],"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