@withpica/mcp-server 2.1.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 (226) hide show
  1. package/README.md +305 -0
  2. package/dist/config.d.ts +34 -0
  3. package/dist/config.d.ts.map +1 -0
  4. package/dist/config.js +33 -0
  5. package/dist/config.js.map +1 -0
  6. package/dist/index.d.ts +7 -0
  7. package/dist/index.d.ts.map +1 -0
  8. package/dist/index.js +34 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/pica-sdk.d.ts +1162 -0
  11. package/dist/pica-sdk.d.ts.map +1 -0
  12. package/dist/pica-sdk.js +1371 -0
  13. package/dist/pica-sdk.js.map +1 -0
  14. package/dist/prompts/index.d.ts +78 -0
  15. package/dist/prompts/index.d.ts.map +1 -0
  16. package/dist/prompts/index.js +513 -0
  17. package/dist/prompts/index.js.map +1 -0
  18. package/dist/resources/index.d.ts +64 -0
  19. package/dist/resources/index.d.ts.map +1 -0
  20. package/dist/resources/index.js +310 -0
  21. package/dist/resources/index.js.map +1 -0
  22. package/dist/resources/llms-primer.d.ts +2 -0
  23. package/dist/resources/llms-primer.d.ts.map +1 -0
  24. package/dist/resources/llms-primer.js +67 -0
  25. package/dist/resources/llms-primer.js.map +1 -0
  26. package/dist/server.d.ts +27 -0
  27. package/dist/server.d.ts.map +1 -0
  28. package/dist/server.js +140 -0
  29. package/dist/server.js.map +1 -0
  30. package/dist/tools/agreement-types.d.ts +37 -0
  31. package/dist/tools/agreement-types.d.ts.map +1 -0
  32. package/dist/tools/agreement-types.js +579 -0
  33. package/dist/tools/agreement-types.js.map +1 -0
  34. package/dist/tools/agreements.d.ts +21 -0
  35. package/dist/tools/agreements.d.ts.map +1 -0
  36. package/dist/tools/agreements.js +328 -0
  37. package/dist/tools/agreements.js.map +1 -0
  38. package/dist/tools/analytics.d.ts +20 -0
  39. package/dist/tools/analytics.d.ts.map +1 -0
  40. package/dist/tools/analytics.js +126 -0
  41. package/dist/tools/analytics.js.map +1 -0
  42. package/dist/tools/assets.d.ts +23 -0
  43. package/dist/tools/assets.d.ts.map +1 -0
  44. package/dist/tools/assets.js +220 -0
  45. package/dist/tools/assets.js.map +1 -0
  46. package/dist/tools/audio-files.d.ts +21 -0
  47. package/dist/tools/audio-files.d.ts.map +1 -0
  48. package/dist/tools/audio-files.js +358 -0
  49. package/dist/tools/audio-files.js.map +1 -0
  50. package/dist/tools/bulk.d.ts +16 -0
  51. package/dist/tools/bulk.d.ts.map +1 -0
  52. package/dist/tools/bulk.js +82 -0
  53. package/dist/tools/bulk.js.map +1 -0
  54. package/dist/tools/calendar.d.ts +15 -0
  55. package/dist/tools/calendar.d.ts.map +1 -0
  56. package/dist/tools/calendar.js +69 -0
  57. package/dist/tools/calendar.js.map +1 -0
  58. package/dist/tools/collaborators.d.ts +17 -0
  59. package/dist/tools/collaborators.d.ts.map +1 -0
  60. package/dist/tools/collaborators.js +133 -0
  61. package/dist/tools/collaborators.js.map +1 -0
  62. package/dist/tools/comparisons.d.ts +22 -0
  63. package/dist/tools/comparisons.d.ts.map +1 -0
  64. package/dist/tools/comparisons.js +86 -0
  65. package/dist/tools/comparisons.js.map +1 -0
  66. package/dist/tools/credits.d.ts +17 -0
  67. package/dist/tools/credits.d.ts.map +1 -0
  68. package/dist/tools/credits.js +136 -0
  69. package/dist/tools/credits.js.map +1 -0
  70. package/dist/tools/dashboard.d.ts +20 -0
  71. package/dist/tools/dashboard.d.ts.map +1 -0
  72. package/dist/tools/dashboard.js +156 -0
  73. package/dist/tools/dashboard.js.map +1 -0
  74. package/dist/tools/directory.d.ts +15 -0
  75. package/dist/tools/directory.d.ts.map +1 -0
  76. package/dist/tools/directory.js +108 -0
  77. package/dist/tools/directory.js.map +1 -0
  78. package/dist/tools/disputes.d.ts +18 -0
  79. package/dist/tools/disputes.d.ts.map +1 -0
  80. package/dist/tools/disputes.js +66 -0
  81. package/dist/tools/disputes.js.map +1 -0
  82. package/dist/tools/documents.d.ts +15 -0
  83. package/dist/tools/documents.d.ts.map +1 -0
  84. package/dist/tools/documents.js +38 -0
  85. package/dist/tools/documents.js.map +1 -0
  86. package/dist/tools/duplicates.d.ts +16 -0
  87. package/dist/tools/duplicates.d.ts.map +1 -0
  88. package/dist/tools/duplicates.js +72 -0
  89. package/dist/tools/duplicates.js.map +1 -0
  90. package/dist/tools/enrichment.d.ts +23 -0
  91. package/dist/tools/enrichment.d.ts.map +1 -0
  92. package/dist/tools/enrichment.js +207 -0
  93. package/dist/tools/enrichment.js.map +1 -0
  94. package/dist/tools/exports.d.ts +19 -0
  95. package/dist/tools/exports.d.ts.map +1 -0
  96. package/dist/tools/exports.js +155 -0
  97. package/dist/tools/exports.js.map +1 -0
  98. package/dist/tools/health.d.ts +17 -0
  99. package/dist/tools/health.d.ts.map +1 -0
  100. package/dist/tools/health.js +69 -0
  101. package/dist/tools/health.js.map +1 -0
  102. package/dist/tools/import-documents.d.ts +21 -0
  103. package/dist/tools/import-documents.d.ts.map +1 -0
  104. package/dist/tools/import-documents.js +191 -0
  105. package/dist/tools/import-documents.js.map +1 -0
  106. package/dist/tools/import.d.ts +29 -0
  107. package/dist/tools/import.d.ts.map +1 -0
  108. package/dist/tools/import.js +404 -0
  109. package/dist/tools/import.js.map +1 -0
  110. package/dist/tools/index.d.ts +48 -0
  111. package/dist/tools/index.d.ts.map +1 -0
  112. package/dist/tools/index.js +394 -0
  113. package/dist/tools/index.js.map +1 -0
  114. package/dist/tools/integrations.d.ts +15 -0
  115. package/dist/tools/integrations.d.ts.map +1 -0
  116. package/dist/tools/integrations.js +102 -0
  117. package/dist/tools/integrations.js.map +1 -0
  118. package/dist/tools/licensing.d.ts +40 -0
  119. package/dist/tools/licensing.d.ts.map +1 -0
  120. package/dist/tools/licensing.js +436 -0
  121. package/dist/tools/licensing.js.map +1 -0
  122. package/dist/tools/memory.d.ts +21 -0
  123. package/dist/tools/memory.d.ts.map +1 -0
  124. package/dist/tools/memory.js +121 -0
  125. package/dist/tools/memory.js.map +1 -0
  126. package/dist/tools/multimedia.d.ts +19 -0
  127. package/dist/tools/multimedia.d.ts.map +1 -0
  128. package/dist/tools/multimedia.js +293 -0
  129. package/dist/tools/multimedia.js.map +1 -0
  130. package/dist/tools/notes.d.ts +21 -0
  131. package/dist/tools/notes.d.ts.map +1 -0
  132. package/dist/tools/notes.js +126 -0
  133. package/dist/tools/notes.js.map +1 -0
  134. package/dist/tools/notifications.d.ts +17 -0
  135. package/dist/tools/notifications.d.ts.map +1 -0
  136. package/dist/tools/notifications.js +117 -0
  137. package/dist/tools/notifications.js.map +1 -0
  138. package/dist/tools/people.d.ts +53 -0
  139. package/dist/tools/people.d.ts.map +1 -0
  140. package/dist/tools/people.js +534 -0
  141. package/dist/tools/people.js.map +1 -0
  142. package/dist/tools/pica-score.d.ts +15 -0
  143. package/dist/tools/pica-score.d.ts.map +1 -0
  144. package/dist/tools/pica-score.js +30 -0
  145. package/dist/tools/pica-score.js.map +1 -0
  146. package/dist/tools/projects.d.ts +19 -0
  147. package/dist/tools/projects.d.ts.map +1 -0
  148. package/dist/tools/projects.js +142 -0
  149. package/dist/tools/projects.js.map +1 -0
  150. package/dist/tools/purchases.d.ts +15 -0
  151. package/dist/tools/purchases.d.ts.map +1 -0
  152. package/dist/tools/purchases.js +65 -0
  153. package/dist/tools/purchases.js.map +1 -0
  154. package/dist/tools/recordings.d.ts +41 -0
  155. package/dist/tools/recordings.d.ts.map +1 -0
  156. package/dist/tools/recordings.js +293 -0
  157. package/dist/tools/recordings.js.map +1 -0
  158. package/dist/tools/registration.d.ts +16 -0
  159. package/dist/tools/registration.d.ts.map +1 -0
  160. package/dist/tools/registration.js +52 -0
  161. package/dist/tools/registration.js.map +1 -0
  162. package/dist/tools/releases.d.ts +18 -0
  163. package/dist/tools/releases.d.ts.map +1 -0
  164. package/dist/tools/releases.js +138 -0
  165. package/dist/tools/releases.js.map +1 -0
  166. package/dist/tools/royalties.d.ts +23 -0
  167. package/dist/tools/royalties.d.ts.map +1 -0
  168. package/dist/tools/royalties.js +263 -0
  169. package/dist/tools/royalties.js.map +1 -0
  170. package/dist/tools/search.d.ts +30 -0
  171. package/dist/tools/search.d.ts.map +1 -0
  172. package/dist/tools/search.js +117 -0
  173. package/dist/tools/search.js.map +1 -0
  174. package/dist/tools/send.d.ts +18 -0
  175. package/dist/tools/send.d.ts.map +1 -0
  176. package/dist/tools/send.js +189 -0
  177. package/dist/tools/send.js.map +1 -0
  178. package/dist/tools/sessions.d.ts +18 -0
  179. package/dist/tools/sessions.d.ts.map +1 -0
  180. package/dist/tools/sessions.js +107 -0
  181. package/dist/tools/sessions.js.map +1 -0
  182. package/dist/tools/settings.d.ts +18 -0
  183. package/dist/tools/settings.d.ts.map +1 -0
  184. package/dist/tools/settings.js +98 -0
  185. package/dist/tools/settings.js.map +1 -0
  186. package/dist/tools/share-links.d.ts +19 -0
  187. package/dist/tools/share-links.d.ts.map +1 -0
  188. package/dist/tools/share-links.js +126 -0
  189. package/dist/tools/share-links.js.map +1 -0
  190. package/dist/tools/split-sheets.d.ts +24 -0
  191. package/dist/tools/split-sheets.d.ts.map +1 -0
  192. package/dist/tools/split-sheets.js +189 -0
  193. package/dist/tools/split-sheets.js.map +1 -0
  194. package/dist/tools/team.d.ts +22 -0
  195. package/dist/tools/team.d.ts.map +1 -0
  196. package/dist/tools/team.js +139 -0
  197. package/dist/tools/team.js.map +1 -0
  198. package/dist/tools/telegram.d.ts +20 -0
  199. package/dist/tools/telegram.d.ts.map +1 -0
  200. package/dist/tools/telegram.js +94 -0
  201. package/dist/tools/telegram.js.map +1 -0
  202. package/dist/tools/uploads.d.ts +17 -0
  203. package/dist/tools/uploads.d.ts.map +1 -0
  204. package/dist/tools/uploads.js +159 -0
  205. package/dist/tools/uploads.js.map +1 -0
  206. package/dist/tools/works.d.ts +53 -0
  207. package/dist/tools/works.d.ts.map +1 -0
  208. package/dist/tools/works.js +517 -0
  209. package/dist/tools/works.js.map +1 -0
  210. package/dist/utils/credit-gate.d.ts +17 -0
  211. package/dist/utils/credit-gate.d.ts.map +1 -0
  212. package/dist/utils/credit-gate.js +111 -0
  213. package/dist/utils/credit-gate.js.map +1 -0
  214. package/dist/utils/errors.d.ts +29 -0
  215. package/dist/utils/errors.d.ts.map +1 -0
  216. package/dist/utils/errors.js +114 -0
  217. package/dist/utils/errors.js.map +1 -0
  218. package/dist/utils/formatting.d.ts +63 -0
  219. package/dist/utils/formatting.d.ts.map +1 -0
  220. package/dist/utils/formatting.js +130 -0
  221. package/dist/utils/formatting.js.map +1 -0
  222. package/dist/utils/mpp.d.ts +78 -0
  223. package/dist/utils/mpp.d.ts.map +1 -0
  224. package/dist/utils/mpp.js +136 -0
  225. package/dist/utils/mpp.js.map +1 -0
  226. package/package.json +44 -0
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Bulk Operations Tools - MCP tools for batch updates
3
+ */
4
+ import { formatSuccess, formatValidationError } from "../utils/formatting.js";
5
+ export class BulkTools {
6
+ pica;
7
+ constructor(pica) {
8
+ this.pica = pica;
9
+ }
10
+ getTools() {
11
+ return [
12
+ {
13
+ definition: {
14
+ name: "pica_works_bulk_update",
15
+ description: "Batch update multiple works at once (status, type, or other fields)",
16
+ inputSchema: {
17
+ type: "object",
18
+ properties: {
19
+ work_ids: {
20
+ type: "array",
21
+ items: { type: "string" },
22
+ description: "Array of work IDs to update",
23
+ },
24
+ updates: {
25
+ type: "object",
26
+ description: "Fields to update on all works (e.g. { status: 'verified', work_type: 'composition' })",
27
+ },
28
+ },
29
+ required: ["work_ids", "updates"],
30
+ },
31
+ },
32
+ executor: this.bulkUpdateWorks.bind(this),
33
+ },
34
+ {
35
+ definition: {
36
+ name: "pica_people_bulk_update_roles",
37
+ description: "Batch update roles for multiple people at once",
38
+ inputSchema: {
39
+ type: "object",
40
+ properties: {
41
+ person_ids: {
42
+ type: "array",
43
+ items: { type: "string" },
44
+ description: "Array of person IDs to update",
45
+ },
46
+ roles: {
47
+ type: "array",
48
+ items: { type: "string" },
49
+ description: "Roles to assign (e.g. ['writer', 'composer', 'performer'])",
50
+ },
51
+ },
52
+ required: ["person_ids", "roles"],
53
+ },
54
+ },
55
+ executor: this.bulkUpdatePeopleRoles.bind(this),
56
+ },
57
+ ];
58
+ }
59
+ async bulkUpdateWorks(args) {
60
+ if (!args.work_ids?.length) {
61
+ return formatValidationError({ work_ids: "must be a non-empty array" });
62
+ }
63
+ if (!args.updates || Object.keys(args.updates).length === 0) {
64
+ return formatValidationError({
65
+ updates: "must contain at least one field",
66
+ });
67
+ }
68
+ const result = await this.pica.bulk.updateWorks(args.work_ids, args.updates);
69
+ return formatSuccess(`Bulk updated ${args.work_ids.length} works`, result);
70
+ }
71
+ async bulkUpdatePeopleRoles(args) {
72
+ if (!args.person_ids?.length) {
73
+ return formatValidationError({ person_ids: "must be a non-empty array" });
74
+ }
75
+ if (!args.roles?.length) {
76
+ return formatValidationError({ roles: "must be a non-empty array" });
77
+ }
78
+ const result = await this.pica.bulk.updatePeopleRoles(args.person_ids, args.roles);
79
+ return formatSuccess(`Bulk updated roles for ${args.person_ids.length} people`, result);
80
+ }
81
+ }
82
+ //# sourceMappingURL=bulk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bulk.js","sourceRoot":"","sources":["../../src/tools/bulk.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAE9E,MAAM,OAAO,SAAS;IACZ,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,wBAAwB;oBAC9B,WAAW,EACT,qEAAqE;oBACvE,WAAW,EAAE;wBACX,IAAI,EAAE,QAAQ;wBACd,UAAU,EAAE;4BACV,QAAQ,EAAE;gCACR,IAAI,EAAE,OAAO;gCACb,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,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M,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAC7C,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,OAAO,CACb,CAAC;QACF,OAAO,aAAa,CAAC,gBAAgB,IAAI,CAAC,QAAQ,CAAC,MAAM,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC7E,CAAC;IAEO,KAAK,CAAC,qBAAqB,CACjC,IAAyB;QAEzB,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,CAAC;YAC7B,OAAO,qBAAqB,CAAC,EAAE,UAAU,EAAE,2BAA2B,EAAE,CAAC,CAAC;QAC5E,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC;YACxB,OAAO,qBAAqB,CAAC,EAAE,KAAK,EAAE,2BAA2B,EAAE,CAAC,CAAC;QACvE,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,CACnD,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,KAAK,CACX,CAAC;QACF,OAAO,aAAa,CAClB,0BAA0B,IAAI,CAAC,UAAU,CAAC,MAAM,SAAS,EACzD,MAAM,CACP,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Calendar Tools — view upcoming events, deadlines, and scheduled sessions
3
+ */
4
+ import { PicaClient } from "../pica-sdk.js";
5
+ import { ToolDefinition, ToolExecutor } from "./index.js";
6
+ export declare class CalendarTools {
7
+ private pica;
8
+ constructor(pica: PicaClient);
9
+ getTools(): Array<{
10
+ definition: ToolDefinition;
11
+ executor: ToolExecutor;
12
+ }>;
13
+ private getEvents;
14
+ }
15
+ //# sourceMappingURL=calendar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../src/tools/calendar.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,YAAY,EAAc,MAAM,YAAY,CAAC;AAGtE,qBAAa,aAAa;IACxB,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;YA4C3D,SAAS;CAqBxB"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Calendar Tools — view upcoming events, deadlines, and scheduled sessions
3
+ */
4
+ import { formatStructuredList } from "../utils/formatting.js";
5
+ export class CalendarTools {
6
+ pica;
7
+ constructor(pica) {
8
+ this.pica = pica;
9
+ }
10
+ getTools() {
11
+ return [
12
+ {
13
+ definition: {
14
+ name: "pica_calendar_events",
15
+ description: "Get upcoming calendar events — sessions, agreement deadlines, release dates, " +
16
+ "invoice due dates, and Google Calendar events. Defaults to the next 30 days.",
17
+ inputSchema: {
18
+ type: "object",
19
+ properties: {
20
+ start_date: {
21
+ type: "string",
22
+ description: "Start date (YYYY-MM-DD). Defaults to today.",
23
+ },
24
+ end_date: {
25
+ type: "string",
26
+ description: "End date (YYYY-MM-DD). Defaults to 30 days from start.",
27
+ },
28
+ types: {
29
+ type: "array",
30
+ items: { type: "string" },
31
+ description: "Filter by event type: session, invoice_due, invoice_sent, " +
32
+ "payment_received, agreement_expiry, agreement_signing, " +
33
+ "work_release, google_calendar",
34
+ },
35
+ work_id: {
36
+ type: "string",
37
+ description: "Filter events linked to a specific work",
38
+ },
39
+ search: {
40
+ type: "string",
41
+ description: "Search events by title",
42
+ },
43
+ },
44
+ },
45
+ },
46
+ executor: this.getEvents.bind(this),
47
+ },
48
+ ];
49
+ }
50
+ async getEvents(args) {
51
+ const today = new Date().toISOString().split("T")[0];
52
+ const thirtyDays = new Date(Date.now() + 30 * 86400000)
53
+ .toISOString()
54
+ .split("T")[0];
55
+ const result = await this.pica.calendar.getEvents({
56
+ startDate: args.start_date || today,
57
+ endDate: args.end_date || thirtyDays,
58
+ types: args.types,
59
+ workId: args.work_id,
60
+ search: args.search,
61
+ });
62
+ const events = Array.isArray(result) ? result : result?.events || [];
63
+ return formatStructuredList(events, "event", {
64
+ startDate: args.start_date || today,
65
+ endDate: args.end_date || thirtyDays,
66
+ });
67
+ }
68
+ }
69
+ //# sourceMappingURL=calendar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calendar.js","sourceRoot":"","sources":["../../src/tools/calendar.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAiB,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE7E,MAAM,OAAO,aAAa;IAChB,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,sBAAsB;oBAC5B,WAAW,EACT,+EAA+E;wBAC/E,8EAA8E;oBAChF,WAAW,EAAE;wBACX,IAAI,EAAE,QAAQ;wBACd,UAAU,EAAE;4BACV,UAAU,EAAE;gCACV,IAAI,EAAE,QAAQ;gCACd,WAAW,EAAE,6CAA6C;6BAC3D;4BACD,QAAQ,EAAE;gCACR,IAAI,EAAE,QAAQ;gCACd,WAAW,EACT,wDAAwD;6BAC3D;4BACD,KAAK,EAAE;gCACL,IAAI,EAAE,OAAO;gCACb,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gCACzB,WAAW,EACT,4DAA4D;oCAC5D,yDAAyD;oCACzD,+BAA+B;6BAClC;4BACD,OAAO,EAAE;gCACP,IAAI,EAAE,QAAQ;gCACd,WAAW,EAAE,yCAAyC;6BACvD;4BACD,MAAM,EAAE;gCACN,IAAI,EAAE,QAAQ;gCACd,WAAW,EAAE,wBAAwB;6BACtC;yBACF;qBACF;iBACF;gBACD,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;aACpC;SACF,CAAC;IACJ,CAAC;IAEO,KAAK,CAAC,SAAS,CAAC,IAAyB;QAC/C,MAAM,KAAK,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACrD,MAAM,UAAU,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,QAAQ,CAAC;aACpD,WAAW,EAAE;aACb,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAEjB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC;YAChD,SAAS,EAAE,IAAI,CAAC,UAAU,IAAI,KAAK;YACnC,OAAO,EAAE,IAAI,CAAC,QAAQ,IAAI,UAAU;YACpC,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,MAAM,EAAE,IAAI,CAAC,OAAO;YACpB,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB,CAAC,CAAC;QAEH,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,MAAM,IAAI,EAAE,CAAC;QAErE,OAAO,oBAAoB,CAAC,MAAM,EAAE,OAAO,EAAE;YAC3C,SAAS,EAAE,IAAI,CAAC,UAAU,IAAI,KAAK;YACnC,OAAO,EAAE,IAAI,CAAC,QAAQ,IAAI,UAAU;SACrC,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Collaborator Tools - MCP tools for inviting and managing collaborators
3
+ */
4
+ import { PicaClient } from "../pica-sdk.js";
5
+ import { ToolDefinition, ToolExecutor } from "./index.js";
6
+ export declare class CollaboratorsTools {
7
+ private pica;
8
+ constructor(pica: PicaClient);
9
+ getTools(): Array<{
10
+ definition: ToolDefinition;
11
+ executor: ToolExecutor;
12
+ }>;
13
+ private inviteCollaborator;
14
+ private listInvites;
15
+ private resendInvite;
16
+ }
17
+ //# sourceMappingURL=collaborators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collaborators.d.ts","sourceRoot":"","sources":["../../src/tools/collaborators.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,YAAY,EAAc,MAAM,YAAY,CAAC;AAQtE,qBAAa,kBAAkB;IAC7B,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;YA+F3D,kBAAkB;YAgClB,WAAW;YASX,YAAY;CAO3B"}
@@ -0,0 +1,133 @@
1
+ /**
2
+ * Collaborator Tools - MCP tools for inviting and managing collaborators
3
+ */
4
+ import { formatSuccess, formatList, } from "../utils/formatting.js";
5
+ export class CollaboratorsTools {
6
+ pica;
7
+ constructor(pica) {
8
+ this.pica = pica;
9
+ }
10
+ getTools() {
11
+ return [
12
+ {
13
+ definition: {
14
+ name: "pica_collaborators_invite",
15
+ description: "Invite a collaborator to a work by email. Creates the person if they don't exist, sends an invite email, and sets up their credit on the work. Requires the work ID, person details (name + email), the inviter's person ID, and credit details.",
16
+ inputSchema: {
17
+ type: "object",
18
+ properties: {
19
+ work_id: {
20
+ type: "string",
21
+ description: "The work ID to invite the collaborator to",
22
+ },
23
+ name: {
24
+ type: "string",
25
+ description: "Full name of the collaborator",
26
+ },
27
+ email: {
28
+ type: "string",
29
+ description: "Email address of the collaborator",
30
+ },
31
+ role: {
32
+ type: "string",
33
+ description: "Role on the work (e.g. 'producer', 'songwriter', 'drummer', 'vocalist')",
34
+ },
35
+ invited_by: {
36
+ type: "string",
37
+ description: "Person ID of the person sending the invite (the catalog owner). Use pica_people_list to find this ID.",
38
+ },
39
+ credit_type: {
40
+ type: "string",
41
+ description: "Type of credit (e.g. 'production', 'songwriting', 'drums', 'vocals', 'mixing')",
42
+ },
43
+ percentage_split: {
44
+ type: "number",
45
+ description: "Percentage split for this credit (0-100)",
46
+ },
47
+ },
48
+ required: ["work_id", "name", "email", "invited_by", "credit_type"],
49
+ },
50
+ },
51
+ executor: this.inviteCollaborator.bind(this),
52
+ },
53
+ {
54
+ definition: {
55
+ name: "pica_collaborators_invites_list",
56
+ description: "List collaboration invites with optional filters. Returns pending, accepted, or expired invites.",
57
+ inputSchema: {
58
+ type: "object",
59
+ properties: {
60
+ status: {
61
+ type: "string",
62
+ description: "Filter by status (default: 'pending')",
63
+ enum: ["pending", "accepted", "expired"],
64
+ },
65
+ work_id: {
66
+ type: "string",
67
+ description: "Filter invites for a specific work",
68
+ },
69
+ limit: {
70
+ type: "number",
71
+ description: "Maximum results to return (default: 50, max: 100)",
72
+ },
73
+ },
74
+ },
75
+ },
76
+ executor: this.listInvites.bind(this),
77
+ },
78
+ {
79
+ definition: {
80
+ name: "pica_collaborators_invite_resend",
81
+ description: "Resend a pending collaboration invite. Regenerates the invite token and sends a new email.",
82
+ inputSchema: {
83
+ type: "object",
84
+ properties: {
85
+ invite_id: {
86
+ type: "string",
87
+ description: "The invite ID to resend",
88
+ },
89
+ },
90
+ required: ["invite_id"],
91
+ },
92
+ },
93
+ executor: this.resendInvite.bind(this),
94
+ },
95
+ ];
96
+ }
97
+ async inviteCollaborator(args) {
98
+ const result = await this.pica.collaborators.invite({
99
+ workId: args.work_id,
100
+ personData: {
101
+ name: args.name,
102
+ email: args.email,
103
+ role: args.role,
104
+ },
105
+ invitedBy: args.invited_by,
106
+ creditData: {
107
+ credit_type: args.credit_type,
108
+ percentage_split: args.percentage_split,
109
+ },
110
+ });
111
+ const hints = [
112
+ {
113
+ gap: "collaborator_missing_identifiers",
114
+ suggestion: `Enrich ${args.name} with ISNI or IPI for royalty collection (pica_people_enrich_isni)`,
115
+ severity: "important",
116
+ },
117
+ ];
118
+ return formatSuccess(`Invite sent to ${args.name} (${args.email}) for credit "${args.credit_type}" on work ${args.work_id}.`, result, hints);
119
+ }
120
+ async listInvites(args) {
121
+ const invites = await this.pica.collaborators.listInvites({
122
+ status: args.status,
123
+ workId: args.work_id,
124
+ limit: args.limit,
125
+ });
126
+ return formatList(invites, { status: args.status || "pending" });
127
+ }
128
+ async resendInvite(args) {
129
+ const result = await this.pica.collaborators.resendInvite(args.invite_id);
130
+ return formatSuccess(`Invite ${args.invite_id} resent successfully.`, result);
131
+ }
132
+ }
133
+ //# sourceMappingURL=collaborators.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collaborators.js","sourceRoot":"","sources":["../../src/tools/collaborators.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAEL,aAAa,EACb,UAAU,GAEX,MAAM,wBAAwB,CAAC;AAEhC,MAAM,OAAO,kBAAkB;IACrB,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,2BAA2B;oBACjC,WAAW,EACT,kPAAkP;oBACpP,WAAW,EAAE;wBACX,IAAI,EAAE,QAAQ;wBACd,UAAU,EAAE;4BACV,OAAO,EAAE;gCACP,IAAI,EAAE,QAAQ;gCACd,WAAW,EAAE,2CAA2C;6BACzD;4BACD,IAAI,EAAE;gCACJ,IAAI,EAAE,QAAQ;gCACd,WAAW,EAAE,+BAA+B;6BAC7C;4BACD,KAAK,EAAE;gCACL,IAAI,EAAE,QAAQ;gCACd,WAAW,EAAE,mCAAmC;6BACjD;4BACD,IAAI,EAAE;gCACJ,IAAI,EAAE,QAAQ;gCACd,WAAW,EACT,yEAAyE;6BAC5E;4BACD,UAAU,EAAE;gCACV,IAAI,EAAE,QAAQ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AAI,CAAC,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC1E,OAAO,aAAa,CAClB,UAAU,IAAI,CAAC,SAAS,uBAAuB,EAC/C,MAAM,CACP,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Comparison Tools - MCP tools for comparing enrichment sources vs catalog data
3
+ * and registration status across PROs.
4
+ *
5
+ * ADR-116 Phase 2: Comparative views
6
+ *
7
+ * These tools return structured comparisons that agents can reason over directly,
8
+ * eliminating the need for 4-6 separate tool calls to assemble context manually.
9
+ */
10
+ import { PicaClient } from "../pica-sdk.js";
11
+ import { ToolDefinition, ToolExecutor } from "./index.js";
12
+ export declare class ComparisonTools {
13
+ private pica;
14
+ constructor(pica: PicaClient);
15
+ getTools(): Array<{
16
+ definition: ToolDefinition;
17
+ executor: ToolExecutor;
18
+ }>;
19
+ private enrichmentCompare;
20
+ private registrationsCompare;
21
+ }
22
+ //# sourceMappingURL=comparisons.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"comparisons.d.ts","sourceRoot":"","sources":["../../src/tools/comparisons.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,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;YAoD3D,iBAAiB;YAqBjB,oBAAoB;CAkBnC"}
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Comparison Tools - MCP tools for comparing enrichment sources vs catalog data
3
+ * and registration status across PROs.
4
+ *
5
+ * ADR-116 Phase 2: Comparative views
6
+ *
7
+ * These tools return structured comparisons that agents can reason over directly,
8
+ * eliminating the need for 4-6 separate tool calls to assemble context manually.
9
+ */
10
+ import { formatSuccess } from "../utils/formatting.js";
11
+ export class ComparisonTools {
12
+ pica;
13
+ constructor(pica) {
14
+ this.pica = pica;
15
+ }
16
+ getTools() {
17
+ return [
18
+ {
19
+ definition: {
20
+ name: "pica_enrichment_compare",
21
+ description: "Compare enrichment source data vs catalog for a work or person. " +
22
+ "Returns a side-by-side comparison showing what each source (MusicBrainz, MLC, Spotify, " +
23
+ "YouTube, Discogs, ISNI) has vs what's in the catalog, with match status and suggested actions. " +
24
+ "Use this to identify gaps, discrepancies, and enrichment opportunities.",
25
+ inputSchema: {
26
+ type: "object",
27
+ properties: {
28
+ entity_type: {
29
+ type: "string",
30
+ description: "Type of entity to compare",
31
+ enum: ["work", "person"],
32
+ },
33
+ entity_id: {
34
+ type: "string",
35
+ description: "Work ID or Person ID",
36
+ },
37
+ },
38
+ required: ["entity_type", "entity_id"],
39
+ },
40
+ },
41
+ executor: this.enrichmentCompare.bind(this),
42
+ },
43
+ {
44
+ definition: {
45
+ name: "pica_registrations_compare",
46
+ description: "Compare registration status across PROs (PRS, MCPS, PPL, VPL) for a work. " +
47
+ "Returns which PROs the work is registered with, registration dates/IDs, and " +
48
+ "suggested actions for missing registrations. Also identifies cascade opportunities " +
49
+ "(e.g. ISRC available → PPL registration is ready).",
50
+ inputSchema: {
51
+ type: "object",
52
+ properties: {
53
+ work_id: {
54
+ type: "string",
55
+ description: "Work ID to check registrations for",
56
+ },
57
+ },
58
+ required: ["work_id"],
59
+ },
60
+ },
61
+ executor: this.registrationsCompare.bind(this),
62
+ },
63
+ ];
64
+ }
65
+ async enrichmentCompare(args) {
66
+ const result = await this.pica.comparisons.enrichmentCompare({
67
+ entityType: args.entity_type,
68
+ entityId: args.entity_id,
69
+ });
70
+ // SDK request() unwraps data.data, so result is the inner object directly
71
+ const data = result;
72
+ const fieldCount = data.fields?.length || 0;
73
+ const fieldsWithValue = data.fields?.filter((f) => f.currentValue != null).length || 0;
74
+ const actionCount = data.suggestedActions?.length || 0;
75
+ return formatSuccess(`Enrichment comparison for "${data.title}": ${fieldsWithValue}/${fieldCount} fields populated. ${actionCount} suggested action${actionCount !== 1 ? "s" : ""}.`, result);
76
+ }
77
+ async registrationsCompare(args) {
78
+ const result = await this.pica.comparisons.registrationsCompare(args.work_id);
79
+ const data = result;
80
+ const registeredCount = data.registrations?.filter((r) => r.registered === true).length || 0;
81
+ const totalPros = data.registrations?.length || 0;
82
+ const actionCount = data.suggestedActions?.length || 0;
83
+ return formatSuccess(`Registration status for "${data.title}": ${registeredCount}/${totalPros} PROs registered. ${actionCount} suggested action${actionCount !== 1 ? "s" : ""}.`, result);
84
+ }
85
+ }
86
+ //# sourceMappingURL=comparisons.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"comparisons.js","sourceRoot":"","sources":["../../src/tools/comparisons.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAgB,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAErE,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,yBAAyB;oBAC/B,WAAW,EACT,kEAAkE;wBAClE,yFAAyF;wBACzF,iGAAiG;wBACjG,yEAAyE;oBAC3E,WAAW,EAAE;wBACX,IAAI,EAAE,QAAQ;wBACd,UAAU,EAAE;4BACV,WAAW,EAAE;gCACX,IAAI,EAAE,QAAQ;gCACd,WAAW,EAAE,2BAA2B;gCACxC,IAAI,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC;6BACzB;4BACD,SAAS,EAAE;gCACT,IAAI,EAAE,QAAQ;gCACd,WAAW,EAAE,sBAAsB;6BACpC;yBACF;wBACD,QAAQ,EAAE,CAAC,aAAa,EAAE,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GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAC/J,MAAM,CACP,CAAC;IACJ,CAAC;IAEO,KAAK,CAAC,oBAAoB,CAChC,IAAyB;QAEzB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAC7D,IAAI,CAAC,OAAO,CACb,CAAC;QAEF,MAAM,IAAI,GAAG,MAAa,CAAC;QAC3B,MAAM,eAAe,GACnB,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,KAAK,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC;QAC5E,MAAM,SAAS,GAAG,IAAI,CAAC,aAAa,EAAE,MAAM,IAAI,CAAC,CAAC;QAClD,MAAM,WAAW,GAAG,IAAI,CAAC,gBAAgB,EAAE,MAAM,IAAI,CAAC,CAAC;QAEvD,OAAO,aAAa,CAClB,4BAA4B,IAAI,CAAC,KAAK,MAAM,eAAe,IAAI,SAAS,qBAAqB,WAAW,oBAAoB,WAAW,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAC3J,MAAM,CACP,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Credits Tools - MCP tools for managing work credits (collaborators and splits)
3
+ */
4
+ import { PicaClient } from "../pica-sdk.js";
5
+ import { ToolDefinition, ToolExecutor } from "./index.js";
6
+ export declare class CreditsTools {
7
+ private pica;
8
+ constructor(pica: PicaClient);
9
+ getTools(): Array<{
10
+ definition: ToolDefinition;
11
+ executor: ToolExecutor;
12
+ }>;
13
+ private getBalance;
14
+ private listCredits;
15
+ private updateCredits;
16
+ }
17
+ //# sourceMappingURL=credits.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credits.d.ts","sourceRoot":"","sources":["../../src/tools/credits.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,YAAY,EAAc,MAAM,YAAY,CAAC;AAStE,qBAAa,YAAY;IACvB,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,UAAU;YAeV,WAAW;YAOX,aAAa;CAqC5B"}
@@ -0,0 +1,136 @@
1
+ /**
2
+ * Credits Tools - MCP tools for managing work credits (collaborators and splits)
3
+ */
4
+ import { formatSuccess, formatStructuredList, mapGapsToHints, } from "../utils/formatting.js";
5
+ export class CreditsTools {
6
+ pica;
7
+ constructor(pica) {
8
+ this.pica = pica;
9
+ }
10
+ getTools() {
11
+ return [
12
+ {
13
+ definition: {
14
+ name: "pica_credits_balance",
15
+ description: "Check your current credit balance and see what each operation costs. " +
16
+ "Use this before triggering audio analysis or identification to check affordability. If balance is low, use pica_credits_purchase to generate a checkout link.",
17
+ inputSchema: {
18
+ type: "object",
19
+ properties: {},
20
+ },
21
+ },
22
+ executor: this.getBalance.bind(this),
23
+ },
24
+ {
25
+ definition: {
26
+ name: "pica_credits_list",
27
+ description: "Get all credits (collaborators, roles, and splits) for a specific work. Returns who wrote, composed, arranged, or produced the work and their percentage splits. " +
28
+ "→ then: pica_credits_update (fix credits), pica_people_get_full (inspect a credited person)",
29
+ inputSchema: {
30
+ type: "object",
31
+ properties: {
32
+ work_id: {
33
+ type: "string",
34
+ description: "The work ID to get credits for",
35
+ },
36
+ },
37
+ required: ["work_id"],
38
+ },
39
+ },
40
+ executor: this.listCredits.bind(this),
41
+ },
42
+ {
43
+ definition: {
44
+ name: "pica_credits_update",
45
+ description: "Set credits on a work. Replaces all existing credits. Splits must total 100%. Roles: writer, composer, arranger, lyricist, producer, performer. " +
46
+ "→ then: pica_work_completeness (check progress), pica_registration_coverage (check if now registrable)",
47
+ inputSchema: {
48
+ type: "object",
49
+ properties: {
50
+ work_id: {
51
+ type: "string",
52
+ description: "The work ID to set credits on",
53
+ },
54
+ credits: {
55
+ type: "array",
56
+ description: "Array of credit entries. Splits must total 100%.",
57
+ items: {
58
+ type: "object",
59
+ properties: {
60
+ person_id: {
61
+ type: "string",
62
+ description: "Person ID of the credited collaborator",
63
+ },
64
+ role: {
65
+ type: "string",
66
+ description: "Comma-separated roles: writer, composer, arranger, lyricist, producer, performer",
67
+ enum: [
68
+ "writer",
69
+ "composer",
70
+ "arranger",
71
+ "lyricist",
72
+ "producer",
73
+ "performer",
74
+ ],
75
+ },
76
+ splits: {
77
+ type: "number",
78
+ description: "Percentage split (0-100). All splits must total 100%.",
79
+ },
80
+ },
81
+ required: ["person_id", "role", "splits"],
82
+ },
83
+ },
84
+ },
85
+ required: ["work_id", "credits"],
86
+ },
87
+ },
88
+ executor: this.updateCredits.bind(this),
89
+ },
90
+ ];
91
+ }
92
+ async getBalance(_args) {
93
+ const result = await this.pica.creditsBalance.getBalance();
94
+ const balance = result.balance ?? 0;
95
+ const costs = result.credit_costs ?? [];
96
+ const costSummary = costs
97
+ .map((c) => `${c.action_key}: ${c.credits_required} credit(s)`)
98
+ .join(", ");
99
+ return formatSuccess(`Credit balance: ${balance}. Operations: ${costSummary}`, result);
100
+ }
101
+ async listCredits(args) {
102
+ const credits = await this.pica.credits.listForWork(args.work_id);
103
+ return formatStructuredList(credits, "credit", {
104
+ work_id: args.work_id,
105
+ });
106
+ }
107
+ async updateCredits(args) {
108
+ // Validate splits total 100% before saving
109
+ const splitTotal = args.credits.reduce((sum, c) => sum + (c.splits || 0), 0);
110
+ if (splitTotal !== 100) {
111
+ return {
112
+ content: [
113
+ {
114
+ type: "text",
115
+ text: `Splits total ${splitTotal}%, must be exactly 100%. Adjust the splits and try again.`,
116
+ },
117
+ ],
118
+ isError: true,
119
+ };
120
+ }
121
+ const credits = await this.pica.credits.updateForWork(args.work_id, {
122
+ credits: args.credits,
123
+ });
124
+ // Check completeness for hints about next steps
125
+ const hints = [];
126
+ try {
127
+ const completeness = await this.pica.health.getWorkCompleteness(args.work_id);
128
+ hints.push(...mapGapsToHints(completeness?.gaps || completeness?.missing || [], 3));
129
+ }
130
+ catch {
131
+ // Best-effort
132
+ }
133
+ return formatSuccess("Credits updated successfully", credits, hints);
134
+ }
135
+ }
136
+ //# sourceMappingURL=credits.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credits.js","sourceRoot":"","sources":["../../src/tools/credits.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAEL,aAAa,EACb,oBAAoB,EAEpB,cAAc,GACf,MAAM,wBAAwB,CAAC;AAEhC,MAAM,OAAO,YAAY;IACf,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,sBAAsB;oBAC5B,WAAW,EACT,uEAAuE;wBACvE,+JAA+J;oBACjK,WAAW,EAAE;wBACX,IAAI,EAAE,QAAQ;wBACd,UAAU,EAAE,EAAE;qBACf;iBACF;gBACD,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC;aACrC;YACD;gBACE,UAAU,EAAE;oBACV,IAAI,EAAE,mBAAmB;oBACzB,WAAW,EACT,mKAAmK;wBACnK,6FAA6F;oBAC/F,WAAW,EAAE;wBACX,IAAI,EAAE,QAAQ;wBACd,UAAU,EAAE;4BACV,OAAO,EAAE;gCACP,IAAI,EAAE,QAAQ;gCACd,WAAW,EAAE,gCAAgC;6BAC9C;yBACF;wBACD,QAAQ,EAAE,CAAC,SAAS,CAAC;qBACtB;iBACF;gBACD,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC;aACtC;YACD;gBACE,UAAU,EAAE;oBACV,IAAI,EAAE,qB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