@labelgrid/mcp 0.2.2 → 0.3.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 (54) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +132 -100
  3. package/dist/config.d.ts +15 -0
  4. package/dist/config.js +37 -5
  5. package/dist/coverage.js +79 -79
  6. package/dist/entities.d.ts +25 -0
  7. package/dist/entities.js +51 -0
  8. package/dist/gating.d.ts +1 -1
  9. package/dist/gating.js +5 -1
  10. package/dist/projection.d.ts +40 -0
  11. package/dist/projection.js +145 -0
  12. package/dist/resources.d.ts +29 -0
  13. package/dist/resources.js +107 -0
  14. package/dist/server.d.ts +1 -1
  15. package/dist/server.js +23 -3
  16. package/dist/tools/account.d.ts +3 -0
  17. package/dist/tools/account.js +32 -0
  18. package/dist/tools/all.js +12 -20
  19. package/dist/tools/catalog.d.ts +14 -0
  20. package/dist/tools/catalog.js +267 -0
  21. package/dist/tools/distribution.d.ts +13 -0
  22. package/dist/tools/distribution.js +266 -0
  23. package/dist/tools/finance.d.ts +12 -0
  24. package/dist/tools/finance.js +311 -0
  25. package/dist/tools/insights.d.ts +7 -0
  26. package/dist/tools/insights.js +139 -0
  27. package/dist/tools/reference.js +9 -24
  28. package/dist/tools/releases.d.ts +11 -0
  29. package/dist/tools/releases.js +177 -0
  30. package/dist/tools/setup.js +1 -1
  31. package/dist/tools/webhooks.d.ts +3 -3
  32. package/dist/tools/webhooks.js +73 -105
  33. package/package.json +3 -2
  34. package/server.json +3 -3
  35. package/dist/tools/accounting.d.ts +0 -12
  36. package/dist/tools/accounting.js +0 -386
  37. package/dist/tools/analytics.d.ts +0 -3
  38. package/dist/tools/analytics.js +0 -62
  39. package/dist/tools/catalog-read.d.ts +0 -10
  40. package/dist/tools/catalog-read.js +0 -145
  41. package/dist/tools/catalog-write.d.ts +0 -12
  42. package/dist/tools/catalog-write.js +0 -206
  43. package/dist/tools/delivery.d.ts +0 -6
  44. package/dist/tools/delivery.js +0 -40
  45. package/dist/tools/files-read.d.ts +0 -7
  46. package/dist/tools/files-read.js +0 -86
  47. package/dist/tools/full-writes.d.ts +0 -12
  48. package/dist/tools/full-writes.js +0 -248
  49. package/dist/tools/identity.d.ts +0 -3
  50. package/dist/tools/identity.js +0 -28
  51. package/dist/tools/release-write.d.ts +0 -12
  52. package/dist/tools/release-write.js +0 -184
  53. package/dist/tools/review-read.d.ts +0 -7
  54. package/dist/tools/review-read.js +0 -78
@@ -1,184 +0,0 @@
1
- /**
2
- * Release write toolset (safe writes): the release/track draft lifecycle plus
3
- * validate, quality-report refresh, landing-page config, a short URL, and
4
- * review-issue notes.
5
- *
6
- * create_release and create_track send an auto-generated Idempotency-Key so a
7
- * retried creation cannot duplicate the entity. Release/track create+update
8
- * forward a permissive `fields` object straight to the API, which owns all
9
- * validation; the descriptions name the required fields.
10
- */
11
- import { z } from 'zod';
12
- /** A permissive body of API fields, forwarded verbatim to the endpoint. */
13
- function fieldsBody(desc) {
14
- return z.record(z.string(), z.unknown()).describe(desc);
15
- }
16
- /** Optional caller-supplied idempotency key, plumbed to the Idempotency-Key header. */
17
- const idempotencyKey = z
18
- .string()
19
- .min(8)
20
- .max(128)
21
- .optional()
22
- .describe('Optional idempotency key. The server deduplicates by this key for 24h — pass the SAME key when retrying a call whose outcome you did not observe. Without it, each call is a new operation.');
23
- const createRelease = {
24
- name: 'create_release',
25
- toolset: 'releases',
26
- gate: 'safe_write',
27
- title: 'Create a release (draft)',
28
- description: 'Create a new release in DRAFT state. Pass its metadata in `fields`. Required: content_type, label_id, artists, titles, cat (catalog number), artwork_ai_usage, primary_genre_id. Pass idempotency_key and reuse the SAME value if you retry a call whose outcome you did not observe — the server deduplicates by it for 24h; without a key each call is a new operation. Add tracks with create_track, then validate_release before distributing.',
29
- inputShape: {
30
- fields: fieldsBody('Release metadata. Required: content_type, label_id, artists, titles, cat, artwork_ai_usage, primary_genre_id. Many optional fields (dates, copyright lines, genres, per-outlet URLs) are supported — see the API docs.'),
31
- idempotency_key: idempotencyKey,
32
- },
33
- annotations: {},
34
- handler: (args, { client }) => client.post('/releases', args.fields, {
35
- idempotency: true,
36
- idempotencyKey: args.idempotency_key,
37
- }),
38
- };
39
- const updateRelease = {
40
- name: 'update_release',
41
- toolset: 'releases',
42
- gate: 'safe_write',
43
- title: 'Update a release',
44
- description: 'Update a release’s metadata. Supply only the fields you want to change in `fields`. Once a release has been submitted or distributed, some fields are locked: attempting to change a locked field returns a 403 with code RELEASE_LOCKED_FIELDS, surfaced verbatim so you can see exactly which fields cannot be changed.',
45
- inputShape: {
46
- release_id: z.number().int().positive(),
47
- fields: fieldsBody('Release fields to change (same field set as create_release).'),
48
- },
49
- annotations: {},
50
- handler: (args, { client }) => client.patch(`/releases/${args.release_id}`, args.fields),
51
- };
52
- const deleteRelease = {
53
- name: 'delete_release',
54
- toolset: 'releases',
55
- gate: 'safe_write',
56
- title: 'Delete a release',
57
- description: 'Delete a release. The API only allows deleting a draft that has never been submitted; it refuses to delete a release that has been submitted or distributed.',
58
- inputShape: { release_id: z.number().int().positive() },
59
- annotations: { destructiveHint: true },
60
- handler: (args, { client }) => client.delete(`/releases/${args.release_id}`),
61
- };
62
- const createTrack = {
63
- name: 'create_track',
64
- toolset: 'releases',
65
- gate: 'safe_write',
66
- title: 'Create a track',
67
- description: 'Create a track on a release. Pass its metadata in `fields`. Required: release_id, disc, track_num, composition_type, artists, audio_ai_usage, composition_ai_usage, commercial_samples, audio_language, contributors, and recording_country (a required ISO 3166-1 alpha-2 country code, e.g. "US"). Pass idempotency_key and reuse the SAME value if you retry a call whose outcome you did not observe — the server deduplicates by it for 24h; without a key each call is a new operation.',
68
- inputShape: {
69
- fields: fieldsBody('Track metadata. Required: release_id, disc, track_num, composition_type, artists, audio_ai_usage, composition_ai_usage, commercial_samples, audio_language, contributors, recording_country (ISO 3166-1 alpha-2). Optional: titles, isrc, iswc, writers, publishers, splits, and more — see the API docs.'),
70
- idempotency_key: idempotencyKey,
71
- },
72
- annotations: {},
73
- handler: (args, { client }) => client.post('/tracks', args.fields, {
74
- idempotency: true,
75
- idempotencyKey: args.idempotency_key,
76
- }),
77
- };
78
- const updateTrack = {
79
- name: 'update_track',
80
- toolset: 'releases',
81
- gate: 'safe_write',
82
- title: 'Update a track',
83
- description: 'Update a track’s metadata. Supply only the fields you want to change in `fields`. As with releases, some fields lock once the parent release is submitted or distributed.',
84
- inputShape: {
85
- track_id: z.number().int().positive(),
86
- fields: fieldsBody('Track fields to change (same field set as create_track).'),
87
- },
88
- annotations: {},
89
- handler: (args, { client }) => client.patch(`/tracks/${args.track_id}`, args.fields),
90
- };
91
- const deleteTrack = {
92
- name: 'delete_track',
93
- toolset: 'releases',
94
- gate: 'safe_write',
95
- title: 'Delete a track',
96
- description: 'Delete a track. Allowed while the parent release is an editable draft; the API refuses once the release is submitted or distributed.',
97
- inputShape: { track_id: z.number().int().positive() },
98
- annotations: { destructiveHint: true },
99
- handler: (args, { client }) => client.delete(`/tracks/${args.track_id}`),
100
- };
101
- const validateRelease = {
102
- name: 'validate_release',
103
- toolset: 'releases',
104
- gate: 'safe_write',
105
- title: 'Validate a release',
106
- description: 'Run validation on a release and return any problems that would block distribution, as both a human-readable `errors` list and a machine-readable `errors_structured` list. This is a near-read check: it changes nothing and is safe to repeat. Run it before distributing.',
107
- inputShape: { release_id: z.number().int().positive() },
108
- annotations: { idempotentHint: true },
109
- handler: (args, { client }) => client.post(`/releases/${args.release_id}/validate`),
110
- };
111
- const refreshQualityReport = {
112
- name: 'refresh_quality_report',
113
- toolset: 'releases',
114
- gate: 'safe_write',
115
- title: 'Refresh the quality report',
116
- description: 'Re-run the Preflight QC automated checks and refresh the release’s quality report. Read the results with get_quality_report. The server applies an hourly refresh budget, so frequent calls may be rate-limited. Preflight QC is an optional add-on.',
117
- inputShape: { release_id: z.number().int().positive() },
118
- annotations: { idempotentHint: true },
119
- handler: (args, { client }) => client.post(`/releases/${args.release_id}/quality-report/refresh`),
120
- };
121
- const updateLandingConfig = {
122
- name: 'update_landing_config',
123
- toolset: 'releases',
124
- gate: 'safe_write',
125
- title: 'Update a release landing-page config',
126
- description: 'Set the smart-link landing-page configuration for a release. `actions` uses the current (v2) action-list contract — each entry describes one call-to-action on the page. You can also set links_page_enabled, config_mode, page_style, custom_cta_text, custom_description, and pre_order_links. This replaces the landing configuration.',
127
- inputShape: {
128
- release_id: z.number().int().positive(),
129
- links_page_enabled: z
130
- .union([z.boolean(), z.string()])
131
- .optional()
132
- .describe('Whether the smart-link page is enabled.'),
133
- config_mode: z.string().optional(),
134
- page_style: z.string().optional(),
135
- custom_cta_text: z.string().optional(),
136
- custom_description: z.string().optional(),
137
- actions: z
138
- .array(z.record(z.string(), z.unknown()))
139
- .optional()
140
- .describe('The v2 action list — one object per call-to-action on the landing page.'),
141
- pre_order_links: z.array(z.record(z.string(), z.unknown())).optional(),
142
- },
143
- annotations: {},
144
- handler: (args, { client }) => {
145
- const { release_id, ...body } = args;
146
- return client.put(`/releases/${release_id}/landing-config`, body);
147
- },
148
- };
149
- const createReleaseShortUrl = {
150
- name: 'create_release_short_url',
151
- toolset: 'releases',
152
- gate: 'safe_write',
153
- title: 'Create a release short URL',
154
- description: 'Create (or return the existing) short URL for a release’s smart-link landing page. Safe to repeat.',
155
- inputShape: { release_id: z.number().int().positive() },
156
- annotations: { idempotentHint: true },
157
- handler: (args, { client }) => client.post('/releases/short-url', { release_id: args.release_id }),
158
- };
159
- const addReviewIssueNote = {
160
- name: 'add_review_issue_note',
161
- toolset: 'releases',
162
- gate: 'safe_write',
163
- title: 'Add a note to a review issue',
164
- description: 'Add a note to a release review issue — for example to explain a fix or add context for the reviewer. `review_issue_id` is the id of the issue (from list_review_issues).',
165
- inputShape: {
166
- review_issue_id: z.number().int().positive(),
167
- note: z.string().describe('The note text to attach to the issue.'),
168
- },
169
- annotations: {},
170
- handler: (args, { client }) => client.post(`/review-issues/${args.review_issue_id}/notes`, { note: args.note }),
171
- };
172
- export const releaseWriteTools = [
173
- createRelease,
174
- updateRelease,
175
- deleteRelease,
176
- createTrack,
177
- updateTrack,
178
- deleteTrack,
179
- validateRelease,
180
- refreshQualityReport,
181
- updateLandingConfig,
182
- createReleaseShortUrl,
183
- addReviewIssueNote,
184
- ];
@@ -1,7 +0,0 @@
1
- /**
2
- * Review reads: release quality-check issues, the issue-definition catalog,
3
- * the Preflight QC quality report, and Stream Radar early-warning flags. All
4
- * read-only, in the `review` toolset.
5
- */
6
- import type { ToolDef } from './types.js';
7
- export declare const reviewReadTools: ToolDef[];
@@ -1,78 +0,0 @@
1
- /**
2
- * Review reads: release quality-check issues, the issue-definition catalog,
3
- * the Preflight QC quality report, and Stream Radar early-warning flags. All
4
- * read-only, in the `review` toolset.
5
- */
6
- import { z } from 'zod';
7
- const listReviewIssues = {
8
- name: 'list_review_issues',
9
- toolset: 'review',
10
- gate: 'read',
11
- title: 'List release review issues',
12
- description: 'List the review issues raised against a release during its automated quality checks. `release_id` is required. Each issue carries a code (see list_issue_definitions for what each code means), severity, and whether it blocks distribution. Use this to see what a customer must fix before a release can go out.',
13
- inputShape: {
14
- release_id: z.number().int().positive().describe('The release whose issues to list. Required.'),
15
- },
16
- annotations: { readOnlyHint: true },
17
- handler: (args, { client }) => client.get('/review-issues', { release_id: args.release_id }),
18
- };
19
- const listIssueDefinitions = {
20
- name: 'list_issue_definitions',
21
- toolset: 'review',
22
- gate: 'read',
23
- title: 'List issue definitions',
24
- description: 'Retrieve the catalog of review issue definitions: each code’s human-readable title, description, severity and whether it blocks distribution. Use it to interpret the codes returned by list_review_issues and the quality report. Issue codes are string slugs.',
25
- inputShape: {},
26
- annotations: { readOnlyHint: true },
27
- handler: (_args, { client }) => client.get('/issue-definitions'),
28
- };
29
- const getQualityReport = {
30
- name: 'get_quality_report',
31
- toolset: 'review',
32
- gate: 'read',
33
- title: 'Get a release quality report',
34
- description: 'Retrieve the Preflight QC quality report for a release: the customer-facing issues found by the automated checks so you can review them before confirming the release into distribution. Preflight QC is an optional add-on — if your account does not have it enabled the API returns a 403, which is surfaced verbatim.',
35
- inputShape: { release_id: z.number().int().positive() },
36
- annotations: { readOnlyHint: true },
37
- handler: (args, { client }) => client.get(`/releases/${args.release_id}/quality-report`),
38
- };
39
- const listStreamRadarFlags = {
40
- name: 'list_stream_radar_flags',
41
- toolset: 'review',
42
- gate: 'read',
43
- title: 'List Stream Radar flags',
44
- description: 'List Stream Radar flags for your releases, paginated — early-warning flags from streaming-integrity monitoring that surface possible artificial-streaming activity so you can act early. Filter by status, severity, dsp, isrc, release_id, and the last-detected date range (detected_from/detected_to). Stream Radar is an optional add-on; without it the API returns a 403, surfaced verbatim.',
45
- inputShape: {
46
- page: z.number().int().positive().optional(),
47
- per_page: z.number().int().positive().optional(),
48
- status: z.string().optional().describe('Filter by flag status.'),
49
- severity: z.string().optional().describe('Filter by severity.'),
50
- dsp: z.string().optional().describe('Filter by platform/DSP.'),
51
- isrc: z.string().optional(),
52
- release_id: z.number().int().positive().optional(),
53
- detected_from: z.string().optional().describe('Earliest last-detected date, YYYY-MM-DD.'),
54
- detected_to: z.string().optional().describe('Latest last-detected date, YYYY-MM-DD.'),
55
- },
56
- annotations: { readOnlyHint: true },
57
- handler: (args, { client }) => {
58
- const { page, per_page, ...filter } = args;
59
- return client.get('/stream-radar/flags', { page, per_page, filter });
60
- },
61
- };
62
- const getStreamRadarFlag = {
63
- name: 'get_stream_radar_flag',
64
- toolset: 'review',
65
- gate: 'read',
66
- title: 'Get a Stream Radar flag',
67
- description: 'Retrieve one Stream Radar flag by id, with its full detail. Stream Radar is an optional add-on; without it the API returns a 403, surfaced verbatim.',
68
- inputShape: { flag_id: z.number().int().positive() },
69
- annotations: { readOnlyHint: true },
70
- handler: (args, { client }) => client.get(`/stream-radar/flags/${args.flag_id}`),
71
- };
72
- export const reviewReadTools = [
73
- listReviewIssues,
74
- listIssueDefinitions,
75
- getQualityReport,
76
- listStreamRadarFlags,
77
- getStreamRadarFlag,
78
- ];