@dynamoi/mcp 0.4.1 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/dist/auth/protected-resource.d.ts +21 -0
- package/dist/auth/protected-resource.js +11 -0
- package/dist/auth/protected-resource.js.map +1 -0
- package/dist/chunk-U5Y6RJS2.js +36 -0
- package/dist/chunk-U5Y6RJS2.js.map +1 -0
- package/dist/index.d.ts +1551 -96
- package/dist/index.js +1325 -405
- package/dist/index.js.map +1 -1
- package/package.json +13 -8
- package/server.json +3 -3
- package/README.md +0 -192
package/dist/index.js
CHANGED
|
@@ -1,17 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
// Supabase OAuth Server (beta) can fail token exchange when `openid` is requested
|
|
7
|
-
// (it attempts to mint an ID token). Our MCP only needs an access token.
|
|
8
|
-
scopes_supported: options.scopesSupported ?? ["email", "profile"]
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
function buildWwwAuthenticateHeader(options) {
|
|
12
|
-
const scope = options.scope ?? "email profile";
|
|
13
|
-
return `Bearer resource_metadata="${options.resourceMetadataUrl}", scope="${scope}"`;
|
|
14
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
DYNAMOI_MCP_SCOPES,
|
|
3
|
+
buildProtectedResourceMetadata,
|
|
4
|
+
buildWwwAuthenticateHeader
|
|
5
|
+
} from "./chunk-U5Y6RJS2.js";
|
|
15
6
|
|
|
16
7
|
// src/auth/verify-token.ts
|
|
17
8
|
import { createRemoteJWKSet, jwtVerify } from "jose";
|
|
@@ -36,6 +27,19 @@ function extractClientId(payload) {
|
|
|
36
27
|
}
|
|
37
28
|
return null;
|
|
38
29
|
}
|
|
30
|
+
function extractScopes(payload) {
|
|
31
|
+
const scope = payload["scope"];
|
|
32
|
+
if (typeof scope === "string") {
|
|
33
|
+
return scope.split(/\s+/).map((part) => part.trim()).filter((part) => part.length > 0);
|
|
34
|
+
}
|
|
35
|
+
const scopes = payload["scopes"];
|
|
36
|
+
if (Array.isArray(scopes)) {
|
|
37
|
+
return scopes.filter(
|
|
38
|
+
(scopeValue) => typeof scopeValue === "string" && scopeValue.trim().length > 0
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
39
43
|
async function verifyAccessToken(options) {
|
|
40
44
|
const jwks = getRemoteJwks(options.jwksUrl);
|
|
41
45
|
const verifyOptions = {
|
|
@@ -62,16 +66,13 @@ async function verifyAccessToken(options) {
|
|
|
62
66
|
clientId: extractClientId(payload),
|
|
63
67
|
exp,
|
|
64
68
|
iss,
|
|
69
|
+
scopes: extractScopes(payload),
|
|
65
70
|
sub
|
|
66
71
|
};
|
|
67
72
|
}
|
|
68
73
|
|
|
69
74
|
// src/server/create-server.ts
|
|
70
|
-
import {
|
|
71
|
-
McpServer,
|
|
72
|
-
ResourceTemplate
|
|
73
|
-
} from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
74
|
-
import * as z3 from "zod/v4";
|
|
75
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
75
76
|
|
|
76
77
|
// src/version.ts
|
|
77
78
|
var DYNAMOI_MCP_VERSION = "__DYNAMOI_MCP_VERSION__";
|
|
@@ -79,70 +80,46 @@ var DYNAMOI_MCP_VERSION = "__DYNAMOI_MCP_VERSION__";
|
|
|
79
80
|
// src/server/instructions.ts
|
|
80
81
|
var DYNAMOI_MCP_INSTRUCTIONS = `
|
|
81
82
|
You are operating Dynamoi's tools on behalf of the authenticated user. Dynamoi helps
|
|
82
|
-
music artists
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
Who uses Dynamoi:
|
|
87
|
-
- Independent artists promoting singles, albums, and playlists on Spotify
|
|
88
|
-
- Record labels managing campaigns across entire artist rosters with team roles and
|
|
89
|
-
consolidated billing
|
|
90
|
-
- YouTube creators of all kinds \u2014 music, education, gaming, vlogs, podcasts, tutorials
|
|
91
|
-
\u2014 growing channels and ad revenue
|
|
92
|
-
|
|
93
|
-
Pricing: $300/month converts 100% to ad credit. First month includes a 100% match \u2014
|
|
94
|
-
pay $300, get $600 in ad credit. Credits roll over for 12 months. No contracts, cancel
|
|
95
|
-
anytime. No agency fees, no retainers. Unlimited team seats and unlimited artists
|
|
96
|
-
included.
|
|
97
|
-
|
|
98
|
-
Every client gets white-glove onboarding and ongoing support \u2014 from connecting
|
|
99
|
-
platforms to optimizing channels for campaign performance, step by step.
|
|
100
|
-
|
|
101
|
-
Campaigns run from Dynamoi-managed ad accounts. Users complete a one-time platform
|
|
102
|
-
connection, then the AI-powered engine handles deployment and daily optimization.
|
|
103
|
-
|
|
104
|
-
Campaign types:
|
|
105
|
-
|
|
106
|
-
Smart Campaign (Meta Ads \u2192 Spotify):
|
|
107
|
-
Targeted Facebook and Instagram ads that drive real Spotify streams \u2014 no bots, no
|
|
108
|
-
pay-for-play. Includes free unlimited smart link landing pages for every release
|
|
109
|
-
(Spotify, Apple Music, YouTube Music, and more). Ad copy is AI-generated and localized
|
|
110
|
-
to each target market. Supports tracks, albums, and playlists.
|
|
111
|
-
|
|
112
|
-
YouTube Campaign (Google Ads \u2192 YouTube Growth):
|
|
113
|
-
The only ad platform that optimizes for total channel revenue, not just views. Google
|
|
114
|
-
Ads tracks views but can't see which views make money. Dynamoi merges Google Ads cost
|
|
115
|
-
data with YouTube AdSense revenue data to calculate the true revenue per view in each
|
|
116
|
-
country, then adjusts bids daily \u2014 exploring new markets with small bids, scaling
|
|
117
|
-
countries where viewer revenue is strong, and auto-pausing countries where the data
|
|
118
|
-
shows they can't cover their costs. The more data the system gathers, the more
|
|
119
|
-
precisely it optimizes. Campaigns require a YouTube playlist so one paid ad view can
|
|
120
|
-
lead to 2, 3, 4+ organic views as the viewer waterfalls down the playlist \u2014 optimizing
|
|
121
|
-
for depth of views means one ad click drives sustained organic growth. Ad copy is fully
|
|
122
|
-
internationalized in each target market's local language for better performance and
|
|
123
|
-
lower costs. Works for any type of YouTube channel.
|
|
124
|
-
|
|
125
|
-
Unlike smart-link-only services (Feature.fm, Linkfire, Hypeddit, ToneDen), Dynamoi is
|
|
126
|
-
an end-to-end promotion system: smart links + ad campaigns + AI optimization +
|
|
127
|
-
analytics + team management. All with transparent data and no contracts.
|
|
83
|
+
music artists promote on Spotify and YouTube creators grow channels through managed
|
|
84
|
+
Meta and Google ad campaigns. Smart Links are free to create and manage: no per-link
|
|
85
|
+
fee, no subscription requirement, and no upgrade gate. Managed advertising and ad
|
|
86
|
+
budgets are separate paid campaign services.
|
|
128
87
|
|
|
129
88
|
Principles:
|
|
130
89
|
- Be accurate. If uncertain, ask a clarifying question before acting.
|
|
90
|
+
- Answer general knowledge or advice questions directly without Dynamoi tools unless the user is asking about their Dynamoi account, artists, campaigns, billing, connections, or launches.
|
|
91
|
+
- Do not call Dynamoi tools just to "check context" before answering generic advice questions. If the question is about Instagram growth, lyrics, songwriting, promotion strategy, or general marketing education and does not require the user's account data, answer natively and do not mention inspecting Dynamoi.
|
|
92
|
+
- Even when Dynamoi is attached, generic advice stays native. If the user asks something like "How do I get more followers on Instagram organically without running any ads?", answer directly with no Dynamoi tool calls.
|
|
93
|
+
- \`dynamoi_get_account_overview\` is only for explicit account-overview questions. Do not use it as a zero-context scout before answering unrelated prompts.
|
|
131
94
|
- Never claim you changed something unless the tool returned status "success" or
|
|
132
95
|
"partial_success".
|
|
133
96
|
- Prefer read tools first before write tools. For writes, confirm intent and restate
|
|
134
97
|
what will change.
|
|
98
|
+
- After a successful write tool call, answer directly from the returned record instead of chaining more tools just to restate the result.
|
|
99
|
+
- If you truly need a follow-up read after a successful write, use format=summary when available and then stop to answer the user.
|
|
100
|
+
- When a user asks for a daily breakdown, pass granularity=DAILY on the analytics tool call.
|
|
101
|
+
- When a user asks for a written rollup, strongest campaign, or review-ready analytics summary, prefer format=summary on the analytics tool call.
|
|
102
|
+
- If a read tool already returned the requested answer in summary form, answer the user directly instead of chaining more read tools.
|
|
103
|
+
- When a user asks to create a shareable release link, landing page, link-in-bio destination, streaming link, Spotify link page, or free promotion asset, prefer Smart Link tools before campaign tools. Use dynamoi_create_smart_link_from_spotify for Spotify artist, album, or track URLs. Do not imply that creating a Smart Link creates a paid campaign.
|
|
104
|
+
- Smart Link pixel tools accept validated pixel IDs only. Do not ask for arbitrary JavaScript, tag-manager snippets, or script code.
|
|
135
105
|
- Money values are shown in USD as presented in Dynamoi.
|
|
136
106
|
- Budget minimums: $10/day (daily), $100 total (Smart Campaign), $50 total (YouTube).
|
|
107
|
+
- Product and pricing details are available as MCP resources. Keep runtime answers
|
|
108
|
+
focused on the user's account data and requested action.
|
|
137
109
|
|
|
138
110
|
Common workflows:
|
|
139
111
|
- Discovery: dynamoi_list_artists \u2192 dynamoi_list_campaigns \u2192 dynamoi_get_campaign \u2192
|
|
140
112
|
dynamoi_get_campaign_analytics
|
|
113
|
+
- Artist performance summary: dynamoi_get_artist_analytics with granularity=DAILY when requested. If that response already includes the strongest campaign, do not call more analytics tools.
|
|
141
114
|
- Diagnose stuck campaign: dynamoi_get_campaign \u2192 dynamoi_get_platform_status \u2192
|
|
142
115
|
propose next steps
|
|
143
116
|
- Pause/resume: dynamoi_get_campaign (confirm) \u2192 dynamoi_pause_campaign or resume
|
|
144
117
|
- Budget update: dynamoi_get_campaign (confirm) \u2192 dynamoi_update_budget
|
|
145
118
|
- Launch: dynamoi_list_media_assets \u2192 dynamoi_launch_campaign
|
|
119
|
+
- Free Smart Link creation: dynamoi_list_artists \u2192 dynamoi_create_smart_link_from_spotify
|
|
120
|
+
- Smart Link analytics/settings: dynamoi_list_smart_links \u2192 dynamoi_get_smart_link_analytics or dynamoi_get_smart_link_artist_settings
|
|
121
|
+
- Post-launch answer: if dynamoi_launch_campaign succeeds, answer from that result directly. Only call dynamoi_get_campaign when the user explicitly needs more detail than the launch result already returned, and prefer format=summary for that follow-up.
|
|
122
|
+
- Review/demo Smart Campaign launch: if the user already gave artist, content title, budget, countries, and reusable media assets, you may call dynamoi_launch_campaign without spotifyUrl/endDate because Dynamoi can infer reviewer-safe defaults. Do not invent placeholder values for omitted fields; omit those keys entirely.
|
|
146
123
|
`.trim();
|
|
147
124
|
|
|
148
125
|
// src/server/prompts.ts
|
|
@@ -158,6 +135,27 @@ function asTextPrompt(text) {
|
|
|
158
135
|
};
|
|
159
136
|
}
|
|
160
137
|
function registerDynamoiPrompts(server) {
|
|
138
|
+
server.registerPrompt(
|
|
139
|
+
"dynamoi_create_free_smart_link",
|
|
140
|
+
{
|
|
141
|
+
argsSchema: {
|
|
142
|
+
artistId: z.string().uuid().optional(),
|
|
143
|
+
spotifyUrl: z.string().trim().optional()
|
|
144
|
+
},
|
|
145
|
+
description: "Create a free Smart Link from a Spotify artist, album, or track URL.",
|
|
146
|
+
title: "Create Free Smart Link"
|
|
147
|
+
},
|
|
148
|
+
(args) => asTextPrompt(
|
|
149
|
+
[
|
|
150
|
+
"Create a free Dynamoi Smart Link.",
|
|
151
|
+
args.artistId ? `Artist ID: ${args.artistId}` : "If no artistId is provided, list artists first and ask me which artist owns the link.",
|
|
152
|
+
args.spotifyUrl ? `Spotify URL: ${args.spotifyUrl}` : "Ask me for a Spotify artist, album, or track URL. Playlist URLs are not supported today.",
|
|
153
|
+
"",
|
|
154
|
+
"Smart Links are free: no per-link fee, no subscription requirement, and no upgrade gate. This does not create a paid campaign.",
|
|
155
|
+
"Once the artist and Spotify URL are known, use dynamoi_create_smart_link_from_spotify."
|
|
156
|
+
].join("\n")
|
|
157
|
+
)
|
|
158
|
+
);
|
|
161
159
|
server.registerPrompt(
|
|
162
160
|
"dynamoi_audit_campaigns",
|
|
163
161
|
{
|
|
@@ -198,6 +196,8 @@ function registerDynamoiPrompts(server) {
|
|
|
198
196
|
args.contentTitle ? `Title: ${args.contentTitle}` : "",
|
|
199
197
|
"",
|
|
200
198
|
"Ask any missing questions first (links, creative, budget, countries, dates).",
|
|
199
|
+
"For review/demo Smart Campaign launches that already specify the artist, content title, budget, countries, and reusable media assets, you may proceed without asking for spotifyUrl or endDate.",
|
|
200
|
+
"When those review/demo fields are omitted, do not invent placeholder spotifyUrl or endDate values; omit them and let Dynamoi infer them.",
|
|
201
201
|
"Then propose the simplest campaign plan that fits today\u2019s supported platforms:",
|
|
202
202
|
"- Smart Campaign (Meta) for Spotify/Apple Music releases",
|
|
203
203
|
"- YouTube campaign for videos",
|
|
@@ -231,121 +231,1020 @@ function registerDynamoiPrompts(server) {
|
|
|
231
231
|
);
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
+
// src/server/resources.ts
|
|
235
|
+
import {
|
|
236
|
+
ResourceTemplate
|
|
237
|
+
} from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
238
|
+
import * as z2 from "zod/v4";
|
|
239
|
+
function registerDynamoiResources(server, adapter) {
|
|
240
|
+
server.registerResource(
|
|
241
|
+
"platform-pricing",
|
|
242
|
+
"dynamoi://platform/pricing",
|
|
243
|
+
{
|
|
244
|
+
description: "Dynamoi pricing, activation bonus, ad credit structure, and campaign budget minimums.",
|
|
245
|
+
mimeType: "application/json",
|
|
246
|
+
title: "Pricing"
|
|
247
|
+
},
|
|
248
|
+
async (uri) => ({
|
|
249
|
+
contents: [
|
|
250
|
+
{
|
|
251
|
+
mimeType: "application/json",
|
|
252
|
+
text: JSON.stringify({
|
|
253
|
+
activationBonus: {
|
|
254
|
+
amountUsd: 600,
|
|
255
|
+
note: "100% match on first month \u2014 pay $300, get $600 ad credit"
|
|
256
|
+
},
|
|
257
|
+
budgetMinimums: {
|
|
258
|
+
smartCampaign: {
|
|
259
|
+
dailyUsd: 10,
|
|
260
|
+
note: "Meta Ads for Spotify promotion",
|
|
261
|
+
totalUsd: 100
|
|
262
|
+
},
|
|
263
|
+
youtube: {
|
|
264
|
+
dailyUsd: 10,
|
|
265
|
+
note: "Google Ads for YouTube channel growth",
|
|
266
|
+
totalUsd: 50
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
creditRollover: "Credits roll over for 12 months",
|
|
270
|
+
includes: "Free Smart Links, unlimited team seats, unlimited artists, white-glove support, and campaign landing-page support where available",
|
|
271
|
+
noContracts: true,
|
|
272
|
+
tiers: [
|
|
273
|
+
{
|
|
274
|
+
name: "Plus",
|
|
275
|
+
note: "Managed advertising is separate from free Smart Links.",
|
|
276
|
+
priceUsdMonthly: 300
|
|
277
|
+
}
|
|
278
|
+
]
|
|
279
|
+
}),
|
|
280
|
+
uri: uri.href
|
|
281
|
+
}
|
|
282
|
+
]
|
|
283
|
+
})
|
|
284
|
+
);
|
|
285
|
+
server.registerResource(
|
|
286
|
+
"platform-content-types",
|
|
287
|
+
"dynamoi://platform/content-types",
|
|
288
|
+
{ mimeType: "application/json", title: "Content Types" },
|
|
289
|
+
async (uri) => ({
|
|
290
|
+
contents: [
|
|
291
|
+
{
|
|
292
|
+
mimeType: "application/json",
|
|
293
|
+
text: JSON.stringify({
|
|
294
|
+
campaignTypes: {
|
|
295
|
+
SMART_CAMPAIGN: ["TRACK", "ALBUM", "PLAYLIST"],
|
|
296
|
+
YOUTUBE: ["VIDEO"]
|
|
297
|
+
},
|
|
298
|
+
contentTypes: ["TRACK", "ALBUM", "PLAYLIST", "VIDEO"]
|
|
299
|
+
}),
|
|
300
|
+
uri: uri.href
|
|
301
|
+
}
|
|
302
|
+
]
|
|
303
|
+
})
|
|
304
|
+
);
|
|
305
|
+
server.registerResource(
|
|
306
|
+
"smart-links-free-plan",
|
|
307
|
+
"dynamoi://smart-links/free-plan",
|
|
308
|
+
{
|
|
309
|
+
description: "Canonical explanation of Dynamoi's free Smart Links plan and how it differs from paid managed advertising.",
|
|
310
|
+
mimeType: "application/json",
|
|
311
|
+
title: "Free Smart Links"
|
|
312
|
+
},
|
|
313
|
+
async (uri) => ({
|
|
314
|
+
contents: [
|
|
315
|
+
{
|
|
316
|
+
mimeType: "application/json",
|
|
317
|
+
text: JSON.stringify({
|
|
318
|
+
free: true,
|
|
319
|
+
included: [
|
|
320
|
+
"Unlimited free Smart Links for supported Spotify artist, album, and track URLs",
|
|
321
|
+
"Smart Link analytics",
|
|
322
|
+
"Artist-level themes",
|
|
323
|
+
"Validated Meta, TikTok, and Google Ads pixel IDs",
|
|
324
|
+
"Publish and unpublish controls"
|
|
325
|
+
],
|
|
326
|
+
noCatch: "No per-link fee, no subscription requirement, and no upgrade gate for Smart Links.",
|
|
327
|
+
paidSeparately: "Managed advertising campaigns and ad budgets are separate paid products."
|
|
328
|
+
}),
|
|
329
|
+
uri: uri.href
|
|
330
|
+
}
|
|
331
|
+
]
|
|
332
|
+
})
|
|
333
|
+
);
|
|
334
|
+
server.registerResource(
|
|
335
|
+
"smart-links-capabilities",
|
|
336
|
+
"dynamoi://smart-links/capabilities",
|
|
337
|
+
{ mimeType: "application/json", title: "Smart Link Capabilities" },
|
|
338
|
+
async (uri) => ({
|
|
339
|
+
contents: [
|
|
340
|
+
{
|
|
341
|
+
mimeType: "application/json",
|
|
342
|
+
text: JSON.stringify({
|
|
343
|
+
creationInputs: {
|
|
344
|
+
supportedSpotifyKinds: ["artist", "album", "track"],
|
|
345
|
+
unsupportedToday: ["playlist"]
|
|
346
|
+
},
|
|
347
|
+
mutableFields: {
|
|
348
|
+
artistLevel: [
|
|
349
|
+
"defaultTheme",
|
|
350
|
+
"metaPixelId",
|
|
351
|
+
"tiktokPixelId",
|
|
352
|
+
"googleAdsConversionId"
|
|
353
|
+
],
|
|
354
|
+
perLink: ["customDescription", "publishState"]
|
|
355
|
+
},
|
|
356
|
+
pixelPolicy: "Only validated pixel IDs are accepted. Arbitrary JavaScript, tag snippets, and script URLs are not supported.",
|
|
357
|
+
themes: ["classic", "brutalist", "aurora", "cinematic"]
|
|
358
|
+
}),
|
|
359
|
+
uri: uri.href
|
|
360
|
+
}
|
|
361
|
+
]
|
|
362
|
+
})
|
|
363
|
+
);
|
|
364
|
+
server.registerResource(
|
|
365
|
+
"platform-campaign-statuses",
|
|
366
|
+
"dynamoi://platform/campaign-statuses",
|
|
367
|
+
{ mimeType: "application/json", title: "Campaign Statuses" },
|
|
368
|
+
async (uri) => ({
|
|
369
|
+
contents: [
|
|
370
|
+
{
|
|
371
|
+
mimeType: "application/json",
|
|
372
|
+
text: JSON.stringify({
|
|
373
|
+
statuses: [
|
|
374
|
+
"AWAITING_SMART_LINK",
|
|
375
|
+
"CONTENT_VALIDATION",
|
|
376
|
+
"DEPLOYING",
|
|
377
|
+
"READY_FOR_REVIEW",
|
|
378
|
+
"ACTIVE",
|
|
379
|
+
"PAUSED",
|
|
380
|
+
"SUBSCRIPTION_PAUSED",
|
|
381
|
+
"FAILED",
|
|
382
|
+
"ARCHIVED",
|
|
383
|
+
"ENDED"
|
|
384
|
+
]
|
|
385
|
+
}),
|
|
386
|
+
uri: uri.href
|
|
387
|
+
}
|
|
388
|
+
]
|
|
389
|
+
})
|
|
390
|
+
);
|
|
391
|
+
server.registerResource(
|
|
392
|
+
"artist-resource",
|
|
393
|
+
new ResourceTemplate("dynamoi://artist/{artistId}", {
|
|
394
|
+
list: async () => ({ resources: [] })
|
|
395
|
+
}),
|
|
396
|
+
{ mimeType: "application/json", title: "Artist" },
|
|
397
|
+
async (uri, variables) => {
|
|
398
|
+
const artistId = variables["artistId"];
|
|
399
|
+
const parsed = z2.string().uuid().safeParse(artistId);
|
|
400
|
+
if (!parsed.success) {
|
|
401
|
+
return {
|
|
402
|
+
contents: [
|
|
403
|
+
{
|
|
404
|
+
mimeType: "application/json",
|
|
405
|
+
text: JSON.stringify({
|
|
406
|
+
message: "Invalid artistId",
|
|
407
|
+
status: "error"
|
|
408
|
+
}),
|
|
409
|
+
uri: uri.href
|
|
410
|
+
}
|
|
411
|
+
]
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
const envelope = await adapter.getArtist({
|
|
415
|
+
artistId: parsed.data
|
|
416
|
+
});
|
|
417
|
+
return {
|
|
418
|
+
contents: [
|
|
419
|
+
{
|
|
420
|
+
mimeType: "application/json",
|
|
421
|
+
text: JSON.stringify(envelope),
|
|
422
|
+
uri: uri.href
|
|
423
|
+
}
|
|
424
|
+
]
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
);
|
|
428
|
+
server.registerResource(
|
|
429
|
+
"campaign-resource",
|
|
430
|
+
new ResourceTemplate("dynamoi://campaign/{campaignId}", {
|
|
431
|
+
list: async () => ({ resources: [] })
|
|
432
|
+
}),
|
|
433
|
+
{ mimeType: "application/json", title: "Campaign" },
|
|
434
|
+
async (uri, variables) => {
|
|
435
|
+
const campaignId = variables["campaignId"];
|
|
436
|
+
const parsed = z2.string().uuid().safeParse(campaignId);
|
|
437
|
+
if (!parsed.success) {
|
|
438
|
+
return {
|
|
439
|
+
contents: [
|
|
440
|
+
{
|
|
441
|
+
mimeType: "application/json",
|
|
442
|
+
text: JSON.stringify({
|
|
443
|
+
message: "Invalid campaignId",
|
|
444
|
+
status: "error"
|
|
445
|
+
}),
|
|
446
|
+
uri: uri.href
|
|
447
|
+
}
|
|
448
|
+
]
|
|
449
|
+
};
|
|
450
|
+
}
|
|
451
|
+
const envelope = await adapter.getCampaign({
|
|
452
|
+
campaignId: parsed.data
|
|
453
|
+
});
|
|
454
|
+
return {
|
|
455
|
+
contents: [
|
|
456
|
+
{
|
|
457
|
+
mimeType: "application/json",
|
|
458
|
+
text: JSON.stringify(envelope),
|
|
459
|
+
uri: uri.href
|
|
460
|
+
}
|
|
461
|
+
]
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
);
|
|
465
|
+
server.registerResource(
|
|
466
|
+
"smart-link-resource",
|
|
467
|
+
new ResourceTemplate("dynamoi://smart-link/{playLinkId}", {
|
|
468
|
+
list: async () => ({ resources: [] })
|
|
469
|
+
}),
|
|
470
|
+
{ mimeType: "application/json", title: "Smart Link" },
|
|
471
|
+
async (uri, variables) => {
|
|
472
|
+
const playLinkId = variables["playLinkId"];
|
|
473
|
+
const parsed = z2.string().uuid().safeParse(playLinkId);
|
|
474
|
+
if (!parsed.success) {
|
|
475
|
+
return {
|
|
476
|
+
contents: [
|
|
477
|
+
{
|
|
478
|
+
mimeType: "application/json",
|
|
479
|
+
text: JSON.stringify({
|
|
480
|
+
message: "Invalid playLinkId",
|
|
481
|
+
status: "error"
|
|
482
|
+
}),
|
|
483
|
+
uri: uri.href
|
|
484
|
+
}
|
|
485
|
+
]
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
const envelope = await adapter.getSmartLink({
|
|
489
|
+
playLinkId: parsed.data
|
|
490
|
+
});
|
|
491
|
+
return {
|
|
492
|
+
contents: [
|
|
493
|
+
{
|
|
494
|
+
mimeType: "application/json",
|
|
495
|
+
text: JSON.stringify(envelope),
|
|
496
|
+
uri: uri.href
|
|
497
|
+
}
|
|
498
|
+
]
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
);
|
|
502
|
+
server.registerResource(
|
|
503
|
+
"smart-link-artist-settings-resource",
|
|
504
|
+
new ResourceTemplate("dynamoi://artist/{artistId}/smart-link-settings", {
|
|
505
|
+
list: async () => ({ resources: [] })
|
|
506
|
+
}),
|
|
507
|
+
{ mimeType: "application/json", title: "Smart Link Artist Settings" },
|
|
508
|
+
async (uri, variables) => {
|
|
509
|
+
const artistId = variables["artistId"];
|
|
510
|
+
const parsed = z2.string().uuid().safeParse(artistId);
|
|
511
|
+
if (!parsed.success) {
|
|
512
|
+
return {
|
|
513
|
+
contents: [
|
|
514
|
+
{
|
|
515
|
+
mimeType: "application/json",
|
|
516
|
+
text: JSON.stringify({
|
|
517
|
+
message: "Invalid artistId",
|
|
518
|
+
status: "error"
|
|
519
|
+
}),
|
|
520
|
+
uri: uri.href
|
|
521
|
+
}
|
|
522
|
+
]
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
const envelope = await adapter.getSmartLinkArtistSettings({
|
|
526
|
+
artistId: parsed.data
|
|
527
|
+
});
|
|
528
|
+
return {
|
|
529
|
+
contents: [
|
|
530
|
+
{
|
|
531
|
+
mimeType: "application/json",
|
|
532
|
+
text: JSON.stringify(envelope),
|
|
533
|
+
uri: uri.href
|
|
534
|
+
}
|
|
535
|
+
]
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
);
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
// src/server/smart-link-tools.ts
|
|
542
|
+
import * as z4 from "zod/v4";
|
|
543
|
+
|
|
544
|
+
// src/server/output-schemas.ts
|
|
545
|
+
import * as z3 from "zod/v4";
|
|
546
|
+
var MoneyDisplayOutputSchema = z3.object({
|
|
547
|
+
amountUsd: z3.number(),
|
|
548
|
+
formatted: z3.string()
|
|
549
|
+
}).strict();
|
|
550
|
+
var ErrorEnvelopeOutputSchema = z3.object({
|
|
551
|
+
kind: z3.enum(["validation", "business", "platform", "unknown"]).optional(),
|
|
552
|
+
message: z3.string(),
|
|
553
|
+
status: z3.literal("error")
|
|
554
|
+
}).strict();
|
|
555
|
+
var AnyToolDataOutputSchema = z3.object({}).passthrough();
|
|
556
|
+
var PauseResumePlatformResultOutputSchema = z3.object({
|
|
557
|
+
message: z3.string().optional(),
|
|
558
|
+
platform: z3.enum(["META", "GOOGLE"]),
|
|
559
|
+
success: z3.boolean()
|
|
560
|
+
}).strict();
|
|
561
|
+
var PauseResumeCampaignDataOutputSchema = z3.object({
|
|
562
|
+
actionRequired: z3.array(z3.string()).optional(),
|
|
563
|
+
contentTitle: z3.string(),
|
|
564
|
+
id: z3.string(),
|
|
565
|
+
newStatus: z3.enum(["PAUSED", "ACTIVE"]),
|
|
566
|
+
platformResults: z3.array(PauseResumePlatformResultOutputSchema),
|
|
567
|
+
warnings: z3.array(z3.string()).optional()
|
|
568
|
+
}).strict();
|
|
569
|
+
var UpdateBudgetDataOutputSchema = z3.object({
|
|
570
|
+
actionRequired: z3.array(z3.string()).optional(),
|
|
571
|
+
budgetType: z3.enum(["DAILY", "TOTAL"]),
|
|
572
|
+
contentTitle: z3.string(),
|
|
573
|
+
endDate: z3.string().optional(),
|
|
574
|
+
id: z3.string(),
|
|
575
|
+
newBudget: MoneyDisplayOutputSchema,
|
|
576
|
+
previousBudget: MoneyDisplayOutputSchema,
|
|
577
|
+
warnings: z3.array(z3.string()).optional()
|
|
578
|
+
}).strict();
|
|
579
|
+
var MediaAssetSummaryOutputSchema = z3.object({
|
|
580
|
+
aspectRatio: z3.string().optional(),
|
|
581
|
+
createdAt: z3.string(),
|
|
582
|
+
fileName: z3.string().optional(),
|
|
583
|
+
fileType: z3.string(),
|
|
584
|
+
height: z3.number().optional(),
|
|
585
|
+
id: z3.string(),
|
|
586
|
+
url: z3.string().optional(),
|
|
587
|
+
urlExpiresAt: z3.string().optional(),
|
|
588
|
+
width: z3.number().optional()
|
|
589
|
+
}).strict();
|
|
590
|
+
var ListMediaAssetsDataOutputSchema = z3.object({
|
|
591
|
+
assets: z3.array(MediaAssetSummaryOutputSchema),
|
|
592
|
+
nextCursor: z3.string().optional()
|
|
593
|
+
}).strict();
|
|
594
|
+
var ListMediaAssetsSummaryOutputSchema = z3.object({
|
|
595
|
+
nextCursor: z3.string().optional(),
|
|
596
|
+
summary: z3.string(),
|
|
597
|
+
totalCount: z3.number()
|
|
598
|
+
}).strict();
|
|
599
|
+
var SmartLinkStatusSchemas = {
|
|
600
|
+
claimStatus: z3.enum([
|
|
601
|
+
"auto_approved",
|
|
602
|
+
"pending_ops_review",
|
|
603
|
+
"approved_by_ops",
|
|
604
|
+
"rejected"
|
|
605
|
+
]),
|
|
606
|
+
odesliStatus: z3.enum(["pending", "resolved", "failed"]),
|
|
607
|
+
publishState: z3.enum(["published", "unpublished"]),
|
|
608
|
+
renderState: z3.enum(["queued", "rendering", "rendered", "failed"]),
|
|
609
|
+
takedownStatus: z3.enum(["none", "active", "resolved"]),
|
|
610
|
+
theme: z3.enum(["classic", "brutalist", "aurora", "cinematic"])
|
|
611
|
+
};
|
|
612
|
+
var SmartLinkSummaryOutputSchema = z3.object({
|
|
613
|
+
artistId: z3.string(),
|
|
614
|
+
artistName: z3.string(),
|
|
615
|
+
claimStatus: SmartLinkStatusSchemas.claimStatus,
|
|
616
|
+
createdAt: z3.string(),
|
|
617
|
+
id: z3.string(),
|
|
618
|
+
isPublic: z3.boolean(),
|
|
619
|
+
localizedPublicUrls: z3.array(z3.string()).optional(),
|
|
620
|
+
odesliStatus: SmartLinkStatusSchemas.odesliStatus,
|
|
621
|
+
publicUrl: z3.string(),
|
|
622
|
+
publishState: SmartLinkStatusSchemas.publishState,
|
|
623
|
+
releaseSlug: z3.string(),
|
|
624
|
+
releaseTitle: z3.string(),
|
|
625
|
+
releaseType: z3.string(),
|
|
626
|
+
renderState: SmartLinkStatusSchemas.renderState,
|
|
627
|
+
spotifyUrl: z3.string().nullable(),
|
|
628
|
+
takedownStatus: SmartLinkStatusSchemas.takedownStatus,
|
|
629
|
+
theme: SmartLinkStatusSchemas.theme,
|
|
630
|
+
updatedAt: z3.string()
|
|
631
|
+
}).strict();
|
|
632
|
+
var SmartLinkDetailsOutputSchema = SmartLinkSummaryOutputSchema.extend({
|
|
633
|
+
actionRequired: z3.array(z3.string()).optional(),
|
|
634
|
+
customDescription: z3.string().nullable(),
|
|
635
|
+
nextActions: z3.array(z3.string()),
|
|
636
|
+
originalSpotifyUrl: z3.string().nullable(),
|
|
637
|
+
resourceUri: z3.string(),
|
|
638
|
+
settingsResourceUri: z3.string(),
|
|
639
|
+
spotifyDiscographyId: z3.string(),
|
|
640
|
+
warnings: z3.array(z3.string()).optional()
|
|
641
|
+
}).strict();
|
|
642
|
+
var ListSmartLinksDataOutputSchema = z3.object({
|
|
643
|
+
nextCursor: z3.string().optional(),
|
|
644
|
+
smartLinks: z3.array(SmartLinkSummaryOutputSchema)
|
|
645
|
+
}).strict();
|
|
646
|
+
var ListSmartLinksSummaryOutputSchema = z3.object({
|
|
647
|
+
nextCursor: z3.string().optional(),
|
|
648
|
+
summary: z3.string(),
|
|
649
|
+
totalCount: z3.number()
|
|
650
|
+
}).strict();
|
|
651
|
+
var SmartLinkSettingsOutputSchema = z3.object({
|
|
652
|
+
artistId: z3.string(),
|
|
653
|
+
artistName: z3.string(),
|
|
654
|
+
availableThemes: z3.array(SmartLinkStatusSchemas.theme),
|
|
655
|
+
defaultTheme: SmartLinkStatusSchemas.theme,
|
|
656
|
+
isEnabled: z3.boolean(),
|
|
657
|
+
pixels: z3.object({
|
|
658
|
+
googleAdsConversionId: z3.string().nullable(),
|
|
659
|
+
metaPixelId: z3.string().nullable(),
|
|
660
|
+
tiktokPixelId: z3.string().nullable()
|
|
661
|
+
}).strict(),
|
|
662
|
+
summary: z3.string().optional()
|
|
663
|
+
}).strict();
|
|
664
|
+
var SmartLinkAnalyticsTotalsOutputSchema = z3.object({
|
|
665
|
+
anonymousVisits: z3.number(),
|
|
666
|
+
promoteCtaClicks: z3.number(),
|
|
667
|
+
shareClicks: z3.number(),
|
|
668
|
+
streamingServiceClicks: z3.number()
|
|
669
|
+
}).strict();
|
|
670
|
+
var SmartLinkBreakdownsOutputSchema = z3.object({
|
|
671
|
+
countryClicks: z3.record(z3.string(), z3.number()).optional(),
|
|
672
|
+
countryViews: z3.record(z3.string(), z3.number()).optional(),
|
|
673
|
+
deviceClicks: z3.record(z3.string(), z3.number()).optional(),
|
|
674
|
+
deviceViews: z3.record(z3.string(), z3.number()).optional(),
|
|
675
|
+
localeClicks: z3.record(z3.string(), z3.number()).optional(),
|
|
676
|
+
localeViews: z3.record(z3.string(), z3.number()).optional(),
|
|
677
|
+
referrerClicks: z3.record(z3.string(), z3.number()).optional(),
|
|
678
|
+
referrerViews: z3.record(z3.string(), z3.number()).optional(),
|
|
679
|
+
serviceClicks: z3.record(z3.string(), z3.number()).optional(),
|
|
680
|
+
themeClicks: z3.record(z3.string(), z3.number()).optional(),
|
|
681
|
+
themeViews: z3.record(z3.string(), z3.number()).optional(),
|
|
682
|
+
utmClicks: z3.record(z3.string(), z3.number()).optional(),
|
|
683
|
+
utmViews: z3.record(z3.string(), z3.number()).optional()
|
|
684
|
+
}).strict();
|
|
685
|
+
var SmartLinkAnalyticsOutputSchema = z3.object({
|
|
686
|
+
artistId: z3.string(),
|
|
687
|
+
breakdowns: SmartLinkBreakdownsOutputSchema.optional(),
|
|
688
|
+
daily: z3.array(
|
|
689
|
+
SmartLinkAnalyticsTotalsOutputSchema.extend({
|
|
690
|
+
date: z3.string()
|
|
691
|
+
}).strict()
|
|
692
|
+
).optional(),
|
|
693
|
+
dateRange: z3.object({ end: z3.string(), start: z3.string() }).strict(),
|
|
694
|
+
playLinkId: z3.string(),
|
|
695
|
+
releaseTitle: z3.string(),
|
|
696
|
+
totals: SmartLinkAnalyticsTotalsOutputSchema,
|
|
697
|
+
warnings: z3.array(z3.string()).optional()
|
|
698
|
+
}).strict();
|
|
699
|
+
var SmartLinkAnalyticsSummaryOutputSchema = z3.object({
|
|
700
|
+
summary: z3.string(),
|
|
701
|
+
warnings: z3.array(z3.string()).optional()
|
|
702
|
+
}).strict();
|
|
703
|
+
var CreateSmartLinkFromSpotifyDataOutputSchema = SmartLinkDetailsOutputSchema.extend({
|
|
704
|
+
outcome: z3.enum(["created", "existing"]),
|
|
705
|
+
workflowRunId: z3.string().nullable(),
|
|
706
|
+
workflowWarning: z3.string().nullable()
|
|
707
|
+
}).strict();
|
|
708
|
+
var UpdateSmartLinkDataOutputSchema = SmartLinkDetailsOutputSchema.extend({
|
|
709
|
+
renderRunId: z3.string().nullable(),
|
|
710
|
+
renderWarning: z3.string().nullable()
|
|
711
|
+
}).strict();
|
|
712
|
+
var UpdateSmartLinkArtistSettingsDataOutputSchema = SmartLinkSettingsOutputSchema.extend({
|
|
713
|
+
renderQueuedCount: z3.number(),
|
|
714
|
+
renderWarning: z3.string().nullable()
|
|
715
|
+
}).strict();
|
|
716
|
+
var PublishSmartLinkDataOutputSchema = SmartLinkDetailsOutputSchema.extend({
|
|
717
|
+
workflowRunId: z3.string().nullable(),
|
|
718
|
+
workflowWarning: z3.string().nullable()
|
|
719
|
+
}).strict();
|
|
720
|
+
var LaunchCampaignDataOutputSchema = z3.object({
|
|
721
|
+
budget: MoneyDisplayOutputSchema,
|
|
722
|
+
budgetType: z3.enum(["DAILY", "TOTAL"]),
|
|
723
|
+
campaignType: z3.enum(["SMART_CAMPAIGN", "YOUTUBE"]),
|
|
724
|
+
contentTitle: z3.string(),
|
|
725
|
+
deliveryState: z3.enum(["ACTIVE", "PENDING_REVIEW", "CONTENT_VALIDATION"]),
|
|
726
|
+
id: z3.string(),
|
|
727
|
+
isLive: z3.boolean(),
|
|
728
|
+
nextSteps: z3.array(z3.string()),
|
|
729
|
+
platforms: z3.array(z3.string()),
|
|
730
|
+
status: z3.string(),
|
|
731
|
+
summary: z3.string(),
|
|
732
|
+
warnings: z3.array(z3.string()).optional()
|
|
733
|
+
}).strict();
|
|
734
|
+
var AnyOutputEnvelopeSchema = z3.union([
|
|
735
|
+
z3.object({ data: AnyToolDataOutputSchema, status: z3.literal("success") }),
|
|
736
|
+
z3.object({
|
|
737
|
+
data: AnyToolDataOutputSchema,
|
|
738
|
+
message: z3.string(),
|
|
739
|
+
status: z3.literal("partial_success")
|
|
740
|
+
}),
|
|
741
|
+
ErrorEnvelopeOutputSchema
|
|
742
|
+
]);
|
|
743
|
+
var PauseResumeOutputEnvelopeSchema = z3.union([
|
|
744
|
+
z3.object({
|
|
745
|
+
data: PauseResumeCampaignDataOutputSchema,
|
|
746
|
+
status: z3.literal("success")
|
|
747
|
+
}),
|
|
748
|
+
z3.object({
|
|
749
|
+
data: PauseResumeCampaignDataOutputSchema,
|
|
750
|
+
message: z3.string(),
|
|
751
|
+
status: z3.literal("partial_success")
|
|
752
|
+
}),
|
|
753
|
+
ErrorEnvelopeOutputSchema
|
|
754
|
+
]);
|
|
755
|
+
var UpdateBudgetOutputEnvelopeSchema = z3.union([
|
|
756
|
+
z3.object({
|
|
757
|
+
data: UpdateBudgetDataOutputSchema,
|
|
758
|
+
status: z3.literal("success")
|
|
759
|
+
}),
|
|
760
|
+
z3.object({
|
|
761
|
+
data: UpdateBudgetDataOutputSchema,
|
|
762
|
+
message: z3.string(),
|
|
763
|
+
status: z3.literal("partial_success")
|
|
764
|
+
}),
|
|
765
|
+
ErrorEnvelopeOutputSchema
|
|
766
|
+
]);
|
|
767
|
+
var ListMediaAssetsOutputEnvelopeSchema = z3.union([
|
|
768
|
+
z3.object({
|
|
769
|
+
data: z3.union([
|
|
770
|
+
ListMediaAssetsDataOutputSchema,
|
|
771
|
+
ListMediaAssetsSummaryOutputSchema
|
|
772
|
+
]),
|
|
773
|
+
status: z3.literal("success")
|
|
774
|
+
}),
|
|
775
|
+
ErrorEnvelopeOutputSchema
|
|
776
|
+
]);
|
|
777
|
+
var LaunchCampaignOutputEnvelopeSchema = z3.union([
|
|
778
|
+
z3.object({
|
|
779
|
+
data: LaunchCampaignDataOutputSchema,
|
|
780
|
+
status: z3.literal("success")
|
|
781
|
+
}),
|
|
782
|
+
ErrorEnvelopeOutputSchema
|
|
783
|
+
]);
|
|
784
|
+
var CreateSmartLinkFromSpotifyOutputEnvelopeSchema = z3.union([
|
|
785
|
+
z3.object({
|
|
786
|
+
data: CreateSmartLinkFromSpotifyDataOutputSchema,
|
|
787
|
+
status: z3.literal("success")
|
|
788
|
+
}),
|
|
789
|
+
ErrorEnvelopeOutputSchema
|
|
790
|
+
]);
|
|
791
|
+
var ListSmartLinksOutputEnvelopeSchema = z3.union([
|
|
792
|
+
z3.object({
|
|
793
|
+
data: z3.union([
|
|
794
|
+
ListSmartLinksDataOutputSchema,
|
|
795
|
+
ListSmartLinksSummaryOutputSchema
|
|
796
|
+
]),
|
|
797
|
+
status: z3.literal("success")
|
|
798
|
+
}),
|
|
799
|
+
ErrorEnvelopeOutputSchema
|
|
800
|
+
]);
|
|
801
|
+
var GetSmartLinkOutputEnvelopeSchema = z3.union([
|
|
802
|
+
z3.object({
|
|
803
|
+
data: z3.union([
|
|
804
|
+
SmartLinkDetailsOutputSchema,
|
|
805
|
+
z3.object({ summary: z3.string() }).passthrough()
|
|
806
|
+
]),
|
|
807
|
+
status: z3.literal("success")
|
|
808
|
+
}),
|
|
809
|
+
ErrorEnvelopeOutputSchema
|
|
810
|
+
]);
|
|
811
|
+
var GetSmartLinkAnalyticsOutputEnvelopeSchema = z3.union([
|
|
812
|
+
z3.object({
|
|
813
|
+
data: z3.union([
|
|
814
|
+
SmartLinkAnalyticsOutputSchema,
|
|
815
|
+
SmartLinkAnalyticsSummaryOutputSchema
|
|
816
|
+
]),
|
|
817
|
+
status: z3.literal("success")
|
|
818
|
+
}),
|
|
819
|
+
ErrorEnvelopeOutputSchema
|
|
820
|
+
]);
|
|
821
|
+
var SmartLinkArtistSettingsOutputEnvelopeSchema = z3.union([
|
|
822
|
+
z3.object({
|
|
823
|
+
data: SmartLinkSettingsOutputSchema,
|
|
824
|
+
status: z3.literal("success")
|
|
825
|
+
}),
|
|
826
|
+
ErrorEnvelopeOutputSchema
|
|
827
|
+
]);
|
|
828
|
+
var UpdateSmartLinkOutputEnvelopeSchema = z3.union([
|
|
829
|
+
z3.object({
|
|
830
|
+
data: UpdateSmartLinkDataOutputSchema,
|
|
831
|
+
status: z3.literal("success")
|
|
832
|
+
}),
|
|
833
|
+
ErrorEnvelopeOutputSchema
|
|
834
|
+
]);
|
|
835
|
+
var UpdateSmartLinkArtistSettingsOutputEnvelopeSchema = z3.union([
|
|
836
|
+
z3.object({
|
|
837
|
+
data: UpdateSmartLinkArtistSettingsDataOutputSchema,
|
|
838
|
+
status: z3.literal("success")
|
|
839
|
+
}),
|
|
840
|
+
ErrorEnvelopeOutputSchema
|
|
841
|
+
]);
|
|
842
|
+
var PublishSmartLinkOutputEnvelopeSchema = z3.union([
|
|
843
|
+
z3.object({
|
|
844
|
+
data: PublishSmartLinkDataOutputSchema,
|
|
845
|
+
status: z3.literal("success")
|
|
846
|
+
}),
|
|
847
|
+
ErrorEnvelopeOutputSchema
|
|
848
|
+
]);
|
|
849
|
+
|
|
850
|
+
// src/server/smart-link-tools.ts
|
|
851
|
+
var ToolFormatSchema = z4.enum(["json", "summary"]);
|
|
852
|
+
var IsoDateSchema = z4.string().regex(/^\d{4}-\d{2}-\d{2}$/);
|
|
853
|
+
var UserIntentSummarySchema = z4.string().trim().max(500).optional();
|
|
854
|
+
var ClientRequestIdSchema = z4.string().uuid().optional();
|
|
855
|
+
var RequiredClientRequestIdSchema = z4.string().uuid();
|
|
856
|
+
function isValidCalendarDate(value) {
|
|
857
|
+
const date = /* @__PURE__ */ new Date(`${value}T00:00:00.000Z`);
|
|
858
|
+
return Number.isFinite(date.getTime()) && date.toISOString().slice(0, 10) === value;
|
|
859
|
+
}
|
|
860
|
+
var DateRangeSchema = z4.object({
|
|
861
|
+
end: IsoDateSchema,
|
|
862
|
+
start: IsoDateSchema
|
|
863
|
+
}).strict().superRefine((data, ctx) => {
|
|
864
|
+
if (!isValidCalendarDate(data.start)) {
|
|
865
|
+
ctx.addIssue({
|
|
866
|
+
code: "custom",
|
|
867
|
+
message: "start must be a valid calendar date",
|
|
868
|
+
path: ["start"]
|
|
869
|
+
});
|
|
870
|
+
}
|
|
871
|
+
if (!isValidCalendarDate(data.end)) {
|
|
872
|
+
ctx.addIssue({
|
|
873
|
+
code: "custom",
|
|
874
|
+
message: "end must be a valid calendar date",
|
|
875
|
+
path: ["end"]
|
|
876
|
+
});
|
|
877
|
+
}
|
|
878
|
+
if (isValidCalendarDate(data.start) && isValidCalendarDate(data.end) && data.start > data.end) {
|
|
879
|
+
ctx.addIssue({
|
|
880
|
+
code: "custom",
|
|
881
|
+
message: "start must be on or before end",
|
|
882
|
+
path: ["start"]
|
|
883
|
+
});
|
|
884
|
+
}
|
|
885
|
+
});
|
|
886
|
+
var SmartLinkStatusFiltersSchema = {
|
|
887
|
+
claimStatus: z4.enum([
|
|
888
|
+
"auto_approved",
|
|
889
|
+
"pending_ops_review",
|
|
890
|
+
"approved_by_ops",
|
|
891
|
+
"rejected"
|
|
892
|
+
]).optional(),
|
|
893
|
+
publishState: z4.enum(["published", "unpublished"]).optional(),
|
|
894
|
+
renderState: z4.enum(["queued", "rendering", "rendered", "failed"]).optional()
|
|
895
|
+
};
|
|
896
|
+
var SmartLinkThemeSchema = z4.enum([
|
|
897
|
+
"classic",
|
|
898
|
+
"brutalist",
|
|
899
|
+
"aurora",
|
|
900
|
+
"cinematic"
|
|
901
|
+
]);
|
|
902
|
+
var DynamoiCreateSmartLinkFromSpotifyInputSchema = z4.object({
|
|
903
|
+
artistId: z4.string().uuid(),
|
|
904
|
+
clientRequestId: RequiredClientRequestIdSchema.optional(),
|
|
905
|
+
customDescription: z4.string().trim().max(500).optional(),
|
|
906
|
+
format: ToolFormatSchema.optional(),
|
|
907
|
+
spotifyUrl: z4.string().trim().min(1).max(500),
|
|
908
|
+
userIntentSummary: UserIntentSummarySchema
|
|
909
|
+
}).strict();
|
|
910
|
+
var DynamoiListSmartLinksInputSchema = z4.object({
|
|
911
|
+
artistId: z4.string().uuid(),
|
|
912
|
+
cursor: z4.string().optional(),
|
|
913
|
+
format: ToolFormatSchema.optional(),
|
|
914
|
+
limit: z4.number().int().min(1).max(50).optional(),
|
|
915
|
+
query: z4.string().trim().max(120).optional(),
|
|
916
|
+
...SmartLinkStatusFiltersSchema
|
|
917
|
+
}).strict();
|
|
918
|
+
var DynamoiGetSmartLinkInputSchema = z4.object({
|
|
919
|
+
artistId: z4.string().uuid().optional(),
|
|
920
|
+
format: ToolFormatSchema.optional(),
|
|
921
|
+
playLinkId: z4.string().uuid().optional(),
|
|
922
|
+
spotifyUrl: z4.string().trim().min(1).max(500).optional()
|
|
923
|
+
}).strict().superRefine((data, ctx) => {
|
|
924
|
+
if (!(data.playLinkId || data.artistId && data.spotifyUrl)) {
|
|
925
|
+
ctx.addIssue({
|
|
926
|
+
code: "custom",
|
|
927
|
+
message: "Provide playLinkId or artistId with spotifyUrl",
|
|
928
|
+
path: ["playLinkId"]
|
|
929
|
+
});
|
|
930
|
+
}
|
|
931
|
+
});
|
|
932
|
+
var DynamoiGetSmartLinkAnalyticsInputSchema = z4.object({
|
|
933
|
+
dateRange: DateRangeSchema.optional(),
|
|
934
|
+
format: ToolFormatSchema.optional(),
|
|
935
|
+
granularity: z4.enum(["TOTAL", "DAILY"]).optional(),
|
|
936
|
+
includeBreakdowns: z4.boolean().optional(),
|
|
937
|
+
playLinkId: z4.string().uuid()
|
|
938
|
+
}).strict();
|
|
939
|
+
var DynamoiGetSmartLinkArtistSettingsInputSchema = z4.object({
|
|
940
|
+
artistId: z4.string().uuid(),
|
|
941
|
+
format: ToolFormatSchema.optional()
|
|
942
|
+
}).strict();
|
|
943
|
+
var DynamoiUpdateSmartLinkInputSchema = z4.object({
|
|
944
|
+
clientRequestId: ClientRequestIdSchema,
|
|
945
|
+
customDescription: z4.string().max(500).nullable(),
|
|
946
|
+
expectedUpdatedAt: z4.string().datetime().optional(),
|
|
947
|
+
playLinkId: z4.string().uuid(),
|
|
948
|
+
userIntentSummary: UserIntentSummarySchema
|
|
949
|
+
}).strict();
|
|
950
|
+
var DynamoiUpdateSmartLinkArtistSettingsInputSchema = z4.object({
|
|
951
|
+
artistId: z4.string().uuid(),
|
|
952
|
+
clientRequestId: ClientRequestIdSchema,
|
|
953
|
+
googleAdsConversionId: z4.string().trim().max(32).nullable().optional(),
|
|
954
|
+
metaPixelId: z4.string().trim().max(32).nullable().optional(),
|
|
955
|
+
theme: SmartLinkThemeSchema.optional(),
|
|
956
|
+
tiktokPixelId: z4.string().trim().max(32).nullable().optional(),
|
|
957
|
+
userIntentSummary: UserIntentSummarySchema
|
|
958
|
+
}).strict().superRefine((data, ctx) => {
|
|
959
|
+
if (data.theme === void 0 && data.metaPixelId === void 0 && data.tiktokPixelId === void 0 && data.googleAdsConversionId === void 0) {
|
|
960
|
+
ctx.addIssue({
|
|
961
|
+
code: "custom",
|
|
962
|
+
message: "Provide at least one setting to update",
|
|
963
|
+
path: ["theme"]
|
|
964
|
+
});
|
|
965
|
+
}
|
|
966
|
+
});
|
|
967
|
+
var DynamoiPublishSmartLinkInputSchema = z4.object({
|
|
968
|
+
clientRequestId: ClientRequestIdSchema,
|
|
969
|
+
expectedPublishState: z4.enum(["published", "unpublished"]).optional(),
|
|
970
|
+
playLinkId: z4.string().uuid(),
|
|
971
|
+
userIntentSummary: UserIntentSummarySchema
|
|
972
|
+
}).strict();
|
|
973
|
+
var PHASE_4_TOOL_DEFINITIONS = [
|
|
974
|
+
{
|
|
975
|
+
description: "Use this when the user wants to create a free Dynamoi Smart Link from a Spotify artist, album, or track URL/URI. Smart Links are free: no per-link fee, no subscription requirement, and no upgrade gate. This does not create a paid ad campaign. Spotify playlist URLs are not supported today. If the Smart Link already exists, return the existing link instead of creating a duplicate.",
|
|
976
|
+
destructiveHint: false,
|
|
977
|
+
idempotentHint: true,
|
|
978
|
+
name: "dynamoi_create_smart_link_from_spotify",
|
|
979
|
+
openWorldHint: true,
|
|
980
|
+
outputSchema: CreateSmartLinkFromSpotifyOutputEnvelopeSchema,
|
|
981
|
+
readOnlyHint: false,
|
|
982
|
+
schema: DynamoiCreateSmartLinkFromSpotifyInputSchema,
|
|
983
|
+
title: "Create Free Smart Link from Spotify"
|
|
984
|
+
},
|
|
985
|
+
{
|
|
986
|
+
description: "Use this when the user wants to list free Smart Links for one artist, including release title, public URL, publish state, claim state, render state, and theme. Do not use this for paid campaign lists; use dynamoi_list_campaigns for campaigns.",
|
|
987
|
+
destructiveHint: false,
|
|
988
|
+
name: "dynamoi_list_smart_links",
|
|
989
|
+
openWorldHint: false,
|
|
990
|
+
outputSchema: ListSmartLinksOutputEnvelopeSchema,
|
|
991
|
+
readOnlyHint: true,
|
|
992
|
+
schema: DynamoiListSmartLinksInputSchema,
|
|
993
|
+
title: "List Smart Links"
|
|
994
|
+
},
|
|
995
|
+
{
|
|
996
|
+
description: "Use this when the user wants full details for one free Smart Link, including release, Spotify URL, public play.dynamoi.com URL, current status, theme source, and next actions.",
|
|
997
|
+
destructiveHint: false,
|
|
998
|
+
name: "dynamoi_get_smart_link",
|
|
999
|
+
openWorldHint: false,
|
|
1000
|
+
outputSchema: GetSmartLinkOutputEnvelopeSchema,
|
|
1001
|
+
readOnlyHint: true,
|
|
1002
|
+
schema: DynamoiGetSmartLinkInputSchema,
|
|
1003
|
+
title: "Get Smart Link"
|
|
1004
|
+
},
|
|
1005
|
+
{
|
|
1006
|
+
description: "Use this when the user asks how one free Smart Link is performing. Returns aggregate visits, streaming-service clicks, share clicks, promote CTA clicks, and optional daily or capped breakdown data. Never use this to expose raw visitor identifiers.",
|
|
1007
|
+
destructiveHint: false,
|
|
1008
|
+
name: "dynamoi_get_smart_link_analytics",
|
|
1009
|
+
openWorldHint: false,
|
|
1010
|
+
outputSchema: GetSmartLinkAnalyticsOutputEnvelopeSchema,
|
|
1011
|
+
readOnlyHint: true,
|
|
1012
|
+
schema: DynamoiGetSmartLinkAnalyticsInputSchema,
|
|
1013
|
+
title: "Get Smart Link Analytics"
|
|
1014
|
+
},
|
|
1015
|
+
{
|
|
1016
|
+
description: "Use this when the user wants to inspect artist-level Smart Link settings, including whether Smart Links are enabled, default theme, available themes, and configured tracking pixel IDs.",
|
|
1017
|
+
destructiveHint: false,
|
|
1018
|
+
name: "dynamoi_get_smart_link_artist_settings",
|
|
1019
|
+
openWorldHint: false,
|
|
1020
|
+
outputSchema: SmartLinkArtistSettingsOutputEnvelopeSchema,
|
|
1021
|
+
readOnlyHint: true,
|
|
1022
|
+
schema: DynamoiGetSmartLinkArtistSettingsInputSchema,
|
|
1023
|
+
title: "Get Smart Link Artist Settings"
|
|
1024
|
+
},
|
|
1025
|
+
{
|
|
1026
|
+
description: "Use this when the user wants to change one Smart Link's public description. This updates a public landing page and queues background rendering. Theme and pixel settings are artist-level; use dynamoi_update_smart_link_artist_settings for those.",
|
|
1027
|
+
destructiveHint: false,
|
|
1028
|
+
idempotentHint: true,
|
|
1029
|
+
name: "dynamoi_update_smart_link",
|
|
1030
|
+
openWorldHint: true,
|
|
1031
|
+
outputSchema: UpdateSmartLinkOutputEnvelopeSchema,
|
|
1032
|
+
readOnlyHint: false,
|
|
1033
|
+
schema: DynamoiUpdateSmartLinkInputSchema,
|
|
1034
|
+
title: "Update Smart Link"
|
|
1035
|
+
},
|
|
1036
|
+
{
|
|
1037
|
+
description: "Use this when the user wants to update artist-level Smart Link theme or tracking pixel IDs. These settings apply to all current and future Smart Links for the artist. Accepts only validated Meta Pixel ID, TikTok Pixel ID, and Google Ads Conversion ID; arbitrary JavaScript or script snippets are not supported.",
|
|
1038
|
+
destructiveHint: false,
|
|
1039
|
+
idempotentHint: true,
|
|
1040
|
+
name: "dynamoi_update_smart_link_artist_settings",
|
|
1041
|
+
openWorldHint: true,
|
|
1042
|
+
outputSchema: UpdateSmartLinkArtistSettingsOutputEnvelopeSchema,
|
|
1043
|
+
readOnlyHint: false,
|
|
1044
|
+
schema: DynamoiUpdateSmartLinkArtistSettingsInputSchema,
|
|
1045
|
+
title: "Update Smart Link Artist Settings"
|
|
1046
|
+
},
|
|
1047
|
+
{
|
|
1048
|
+
description: "Use this when the user explicitly wants to publish an approved Smart Link and expose its public play.dynamoi.com URL. Cannot publish rejected, pending-review, or takedown-active links.",
|
|
1049
|
+
destructiveHint: false,
|
|
1050
|
+
idempotentHint: true,
|
|
1051
|
+
name: "dynamoi_publish_smart_link",
|
|
1052
|
+
openWorldHint: true,
|
|
1053
|
+
outputSchema: PublishSmartLinkOutputEnvelopeSchema,
|
|
1054
|
+
readOnlyHint: false,
|
|
1055
|
+
schema: DynamoiPublishSmartLinkInputSchema,
|
|
1056
|
+
title: "Publish Smart Link"
|
|
1057
|
+
},
|
|
1058
|
+
{
|
|
1059
|
+
description: "Use this when the user explicitly wants to unpublish a Smart Link and remove its public play.dynamoi.com landing page. Restate the affected public URL before calling this tool.",
|
|
1060
|
+
destructiveHint: true,
|
|
1061
|
+
idempotentHint: true,
|
|
1062
|
+
name: "dynamoi_unpublish_smart_link",
|
|
1063
|
+
openWorldHint: true,
|
|
1064
|
+
outputSchema: PublishSmartLinkOutputEnvelopeSchema,
|
|
1065
|
+
readOnlyHint: false,
|
|
1066
|
+
schema: DynamoiPublishSmartLinkInputSchema,
|
|
1067
|
+
title: "Unpublish Smart Link"
|
|
1068
|
+
}
|
|
1069
|
+
];
|
|
1070
|
+
|
|
234
1071
|
// src/server/tools.ts
|
|
235
|
-
import * as
|
|
236
|
-
var
|
|
237
|
-
var
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
})
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
format: ToolFormatSchema.optional(),
|
|
278
|
-
granularity: z2.enum(["TOTAL", "DAILY"]).optional()
|
|
279
|
-
});
|
|
280
|
-
var DynamoiGetArtistAnalyticsInputSchema = z2.object({
|
|
281
|
-
artistId: z2.string().uuid(),
|
|
282
|
-
dateRange: DateRangeSchema.optional(),
|
|
283
|
-
format: ToolFormatSchema.optional(),
|
|
284
|
-
granularity: z2.enum(["TOTAL", "DAILY"]).optional()
|
|
285
|
-
});
|
|
286
|
-
var DynamoiGetBillingInputSchema = z2.object({
|
|
287
|
-
artistId: z2.string().uuid(),
|
|
288
|
-
format: ToolFormatSchema.optional()
|
|
289
|
-
});
|
|
290
|
-
var DynamoiGetPlatformStatusInputSchema = z2.object({
|
|
291
|
-
artistId: z2.string().uuid(),
|
|
292
|
-
format: ToolFormatSchema.optional()
|
|
293
|
-
});
|
|
294
|
-
var DynamoiPauseCampaignInputSchema = z2.object({
|
|
295
|
-
campaignId: z2.string().uuid()
|
|
296
|
-
});
|
|
297
|
-
var DynamoiResumeCampaignInputSchema = z2.object({
|
|
298
|
-
campaignId: z2.string().uuid()
|
|
299
|
-
});
|
|
300
|
-
var DynamoiUpdateBudgetInputSchema = z2.object({
|
|
301
|
-
budgetAmount: z2.number().finite().positive(),
|
|
302
|
-
campaignId: z2.string().uuid(),
|
|
303
|
-
endDate: z2.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional()
|
|
304
|
-
});
|
|
305
|
-
var LocationTargetSchema = z2.object({
|
|
306
|
-
code: z2.string().min(1),
|
|
307
|
-
name: z2.string().min(1)
|
|
1072
|
+
import * as z5 from "zod/v4";
|
|
1073
|
+
var ToolFormatSchema2 = z5.enum(["json", "summary"]);
|
|
1074
|
+
var IsoDateSchema2 = z5.string().regex(/^\d{4}-\d{2}-\d{2}$/);
|
|
1075
|
+
var UserIntentSummarySchema2 = z5.string().trim().max(500).optional();
|
|
1076
|
+
var ClientRequestIdSchema2 = z5.string().uuid().optional();
|
|
1077
|
+
var ExpectedCampaignStatusSchema = z5.enum([
|
|
1078
|
+
"AWAITING_SMART_LINK",
|
|
1079
|
+
"ACTIVE",
|
|
1080
|
+
"ARCHIVED",
|
|
1081
|
+
"CONTENT_VALIDATION",
|
|
1082
|
+
"DEPLOYING",
|
|
1083
|
+
"ENDED",
|
|
1084
|
+
"FAILED",
|
|
1085
|
+
"PAUSED",
|
|
1086
|
+
"READY_FOR_REVIEW",
|
|
1087
|
+
"SUBSCRIPTION_PAUSED"
|
|
1088
|
+
]).optional();
|
|
1089
|
+
function isValidCalendarDate2(value) {
|
|
1090
|
+
const date = /* @__PURE__ */ new Date(`${value}T00:00:00.000Z`);
|
|
1091
|
+
return Number.isFinite(date.getTime()) && date.toISOString().slice(0, 10) === value;
|
|
1092
|
+
}
|
|
1093
|
+
var DynamoiListArtistsInputSchema = z5.object({
|
|
1094
|
+
cursor: z5.string().optional(),
|
|
1095
|
+
format: ToolFormatSchema2.optional(),
|
|
1096
|
+
limit: z5.number().int().min(1).max(50).optional()
|
|
1097
|
+
}).strict();
|
|
1098
|
+
var DynamoiSearchInputSchema = z5.object({
|
|
1099
|
+
artistId: z5.string().uuid().optional(),
|
|
1100
|
+
cursor: z5.string().optional(),
|
|
1101
|
+
format: ToolFormatSchema2.optional(),
|
|
1102
|
+
includeArchived: z5.boolean().optional(),
|
|
1103
|
+
limit: z5.number().int().min(1).max(50).optional(),
|
|
1104
|
+
query: z5.string().trim().max(120).optional(),
|
|
1105
|
+
type: z5.enum(["artist", "campaign", "smartlink"]).optional()
|
|
1106
|
+
}).strict().superRefine((data, ctx) => {
|
|
1107
|
+
if (!(data.type || data.query)) {
|
|
1108
|
+
ctx.addIssue({
|
|
1109
|
+
code: "custom",
|
|
1110
|
+
message: "query is required when type is not specified",
|
|
1111
|
+
path: ["query"]
|
|
1112
|
+
});
|
|
1113
|
+
}
|
|
308
1114
|
});
|
|
309
|
-
var
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
1115
|
+
var DynamoiGetCurrentUserIntentSchema = z5.enum([
|
|
1116
|
+
"account_overview",
|
|
1117
|
+
"artist_access_check",
|
|
1118
|
+
"organization_access_check",
|
|
1119
|
+
"platform_connection_check"
|
|
1120
|
+
]);
|
|
1121
|
+
var DynamoiGetCurrentUserInputSchema = z5.object({
|
|
1122
|
+
format: ToolFormatSchema2.optional(),
|
|
1123
|
+
intent: DynamoiGetCurrentUserIntentSchema
|
|
1124
|
+
}).strict();
|
|
1125
|
+
var DynamoiGetArtistInputSchema = z5.object({
|
|
1126
|
+
artistId: z5.string().uuid(),
|
|
1127
|
+
format: ToolFormatSchema2.optional()
|
|
1128
|
+
}).strict();
|
|
1129
|
+
var DynamoiListCampaignsInputSchema = z5.object({
|
|
1130
|
+
artistId: z5.string().uuid(),
|
|
1131
|
+
campaignType: z5.enum(["SMART_CAMPAIGN", "YOUTUBE"]).optional(),
|
|
1132
|
+
cursor: z5.string().optional(),
|
|
1133
|
+
format: ToolFormatSchema2.optional(),
|
|
1134
|
+
limit: z5.number().int().min(1).max(50).optional(),
|
|
1135
|
+
status: z5.string().trim().optional()
|
|
1136
|
+
}).strict();
|
|
1137
|
+
var DynamoiGetCampaignInputSchema = z5.object({
|
|
1138
|
+
campaignId: z5.string().uuid(),
|
|
1139
|
+
format: ToolFormatSchema2.optional(),
|
|
1140
|
+
includeCountries: z5.boolean().optional()
|
|
1141
|
+
}).strict();
|
|
1142
|
+
var DateRangeSchema2 = z5.object({
|
|
1143
|
+
end: IsoDateSchema2,
|
|
1144
|
+
start: IsoDateSchema2
|
|
1145
|
+
}).strict().superRefine((data, ctx) => {
|
|
1146
|
+
if (!isValidCalendarDate2(data.start)) {
|
|
1147
|
+
ctx.addIssue({
|
|
1148
|
+
code: "custom",
|
|
1149
|
+
message: "start must be a valid calendar date",
|
|
1150
|
+
path: ["start"]
|
|
1151
|
+
});
|
|
1152
|
+
}
|
|
1153
|
+
if (!isValidCalendarDate2(data.end)) {
|
|
1154
|
+
ctx.addIssue({
|
|
1155
|
+
code: "custom",
|
|
1156
|
+
message: "end must be a valid calendar date",
|
|
1157
|
+
path: ["end"]
|
|
1158
|
+
});
|
|
1159
|
+
}
|
|
1160
|
+
if (isValidCalendarDate2(data.start) && isValidCalendarDate2(data.end) && data.start > data.end) {
|
|
1161
|
+
ctx.addIssue({
|
|
1162
|
+
code: "custom",
|
|
1163
|
+
message: "start must be on or before end",
|
|
1164
|
+
path: ["start"]
|
|
1165
|
+
});
|
|
1166
|
+
}
|
|
314
1167
|
});
|
|
315
|
-
var
|
|
1168
|
+
var DynamoiGetCampaignAnalyticsInputSchema = z5.object({
|
|
1169
|
+
campaignId: z5.string().uuid(),
|
|
1170
|
+
dateRange: DateRangeSchema2.optional(),
|
|
1171
|
+
format: ToolFormatSchema2.optional(),
|
|
1172
|
+
granularity: z5.enum(["TOTAL", "DAILY"]).optional()
|
|
1173
|
+
}).strict();
|
|
1174
|
+
var DynamoiGetArtistAnalyticsInputSchema = z5.object({
|
|
1175
|
+
artistId: z5.string().uuid(),
|
|
1176
|
+
dateRange: DateRangeSchema2.optional(),
|
|
1177
|
+
format: ToolFormatSchema2.optional(),
|
|
1178
|
+
granularity: z5.enum(["TOTAL", "DAILY"]).optional()
|
|
1179
|
+
}).strict();
|
|
1180
|
+
var DynamoiGetBillingInputSchema = z5.object({
|
|
1181
|
+
artistId: z5.string().uuid(),
|
|
1182
|
+
format: ToolFormatSchema2.optional()
|
|
1183
|
+
}).strict();
|
|
1184
|
+
var DynamoiGetPlatformStatusInputSchema = z5.object({
|
|
1185
|
+
artistId: z5.string().uuid(),
|
|
1186
|
+
format: ToolFormatSchema2.optional()
|
|
1187
|
+
}).strict();
|
|
1188
|
+
var DynamoiPauseCampaignInputSchema = z5.object({
|
|
1189
|
+
campaignId: z5.string().uuid(),
|
|
1190
|
+
clientRequestId: ClientRequestIdSchema2,
|
|
1191
|
+
expectedCurrentStatus: ExpectedCampaignStatusSchema,
|
|
1192
|
+
userIntentSummary: UserIntentSummarySchema2
|
|
1193
|
+
}).strict();
|
|
1194
|
+
var DynamoiResumeCampaignInputSchema = z5.object({
|
|
1195
|
+
campaignId: z5.string().uuid(),
|
|
1196
|
+
clientRequestId: ClientRequestIdSchema2,
|
|
1197
|
+
expectedCurrentStatus: ExpectedCampaignStatusSchema,
|
|
1198
|
+
userIntentSummary: UserIntentSummarySchema2
|
|
1199
|
+
}).strict();
|
|
1200
|
+
var DynamoiUpdateBudgetInputSchema = z5.object({
|
|
1201
|
+
budgetAmount: z5.number().finite().positive(),
|
|
1202
|
+
campaignId: z5.string().uuid(),
|
|
1203
|
+
clientRequestId: ClientRequestIdSchema2,
|
|
1204
|
+
endDate: IsoDateSchema2.optional(),
|
|
1205
|
+
expectedCurrentBudgetAmount: z5.number().finite().positive().optional(),
|
|
1206
|
+
expectedCurrentEndDate: IsoDateSchema2.optional(),
|
|
1207
|
+
userIntentSummary: UserIntentSummarySchema2
|
|
1208
|
+
}).strict();
|
|
1209
|
+
var LocationTargetSchema = z5.object({
|
|
1210
|
+
code: z5.string().trim().min(1).max(8),
|
|
1211
|
+
name: z5.string().trim().min(1).max(120)
|
|
1212
|
+
}).strict();
|
|
1213
|
+
var DynamoiListMediaAssetsInputSchema = z5.object({
|
|
1214
|
+
artistId: z5.string().uuid(),
|
|
1215
|
+
cursor: z5.string().optional(),
|
|
1216
|
+
format: ToolFormatSchema2.optional(),
|
|
1217
|
+
includeUrls: z5.boolean().optional(),
|
|
1218
|
+
limit: z5.number().int().min(1).max(50).optional()
|
|
1219
|
+
}).strict();
|
|
1220
|
+
var DynamoiLaunchCampaignInputSchema = z5.object({
|
|
316
1221
|
// Creative
|
|
317
|
-
adCopy:
|
|
318
|
-
appleMusicUrl:
|
|
319
|
-
artistId:
|
|
1222
|
+
adCopy: z5.string().trim().max(500).optional(),
|
|
1223
|
+
appleMusicUrl: z5.string().trim().min(1).max(500).optional(),
|
|
1224
|
+
artistId: z5.string().uuid(),
|
|
320
1225
|
// Budget
|
|
321
|
-
budgetAmount:
|
|
322
|
-
budgetSplits:
|
|
323
|
-
|
|
324
|
-
|
|
1226
|
+
budgetAmount: z5.number().finite().positive(),
|
|
1227
|
+
budgetSplits: z5.record(
|
|
1228
|
+
z5.enum(["META", "GOOGLE"]),
|
|
1229
|
+
z5.number().int().min(0).max(100)
|
|
325
1230
|
),
|
|
326
|
-
budgetType:
|
|
327
|
-
campaignType:
|
|
1231
|
+
budgetType: z5.enum(["DAILY", "TOTAL"]),
|
|
1232
|
+
campaignType: z5.enum(["SMART_CAMPAIGN", "YOUTUBE"]),
|
|
328
1233
|
// Idempotency (client-generated UUID)
|
|
329
|
-
clientRequestId:
|
|
1234
|
+
clientRequestId: z5.string().uuid(),
|
|
330
1235
|
// Content
|
|
331
|
-
contentTitle:
|
|
332
|
-
contentType:
|
|
333
|
-
endDate:
|
|
1236
|
+
contentTitle: z5.string().trim().min(1).max(160),
|
|
1237
|
+
contentType: z5.enum(["TRACK", "ALBUM", "PLAYLIST", "VIDEO"]),
|
|
1238
|
+
endDate: z5.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional(),
|
|
334
1239
|
// Targeting
|
|
335
|
-
locationTargets:
|
|
1240
|
+
locationTargets: z5.array(LocationTargetSchema).optional(),
|
|
336
1241
|
// Smart Campaign creative selection (existing assets only in Phase 3)
|
|
337
|
-
mediaAssetIds:
|
|
338
|
-
spotifyUrl:
|
|
339
|
-
useAiGeneratedCopy:
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
ctx.addIssue({
|
|
344
|
-
code: "custom",
|
|
345
|
-
message: "endDate is required when budgetType is TOTAL",
|
|
346
|
-
path: ["endDate"]
|
|
347
|
-
});
|
|
348
|
-
}
|
|
1242
|
+
mediaAssetIds: z5.array(z5.string().uuid()).optional(),
|
|
1243
|
+
spotifyUrl: z5.string().trim().min(1).max(500).optional(),
|
|
1244
|
+
useAiGeneratedCopy: z5.boolean().optional(),
|
|
1245
|
+
userIntentSummary: UserIntentSummarySchema2,
|
|
1246
|
+
youtubeVideoId: z5.string().trim().min(1).max(128).optional()
|
|
1247
|
+
}).strict().superRefine((data, ctx) => {
|
|
349
1248
|
const sum = Object.values(data.budgetSplits ?? {}).reduce(
|
|
350
1249
|
(acc, v) => acc + (Number.isFinite(v) ? v : 0),
|
|
351
1250
|
0
|
|
@@ -365,13 +1264,6 @@ var DynamoiLaunchCampaignInputSchema = z2.object({
|
|
|
365
1264
|
});
|
|
366
1265
|
}
|
|
367
1266
|
if (data.campaignType === "SMART_CAMPAIGN") {
|
|
368
|
-
if (!data.spotifyUrl) {
|
|
369
|
-
ctx.addIssue({
|
|
370
|
-
code: "custom",
|
|
371
|
-
message: "spotifyUrl is required for SMART_CAMPAIGN",
|
|
372
|
-
path: ["spotifyUrl"]
|
|
373
|
-
});
|
|
374
|
-
}
|
|
375
1267
|
if (!data.mediaAssetIds || data.mediaAssetIds.length === 0) {
|
|
376
1268
|
ctx.addIssue({
|
|
377
1269
|
code: "custom",
|
|
@@ -427,200 +1319,380 @@ var DynamoiLaunchCampaignInputSchema = z2.object({
|
|
|
427
1319
|
});
|
|
428
1320
|
var PHASE_1_TOOL_DEFINITIONS = [
|
|
429
1321
|
{
|
|
430
|
-
description: "
|
|
1322
|
+
description: "Use this when the user explicitly asks about the signed-in Dynamoi account itself, such as who is logged in, how many organizations or artists it can access, or whether account-level platform connections exist. Always pass intent to match that explicit account question. Do not use this to enumerate artists one by one; use dynamoi_list_artists for that. Never use this to 'check context' before answering generic Instagram, lyrics, songwriting, or marketing-advice questions, even if Dynamoi is attached.",
|
|
431
1323
|
destructiveHint: false,
|
|
432
|
-
name: "
|
|
1324
|
+
name: "dynamoi_get_account_overview",
|
|
433
1325
|
openWorldHint: false,
|
|
1326
|
+
outputSchema: AnyOutputEnvelopeSchema,
|
|
434
1327
|
readOnlyHint: true,
|
|
435
|
-
schema: DynamoiGetCurrentUserInputSchema
|
|
1328
|
+
schema: DynamoiGetCurrentUserInputSchema,
|
|
1329
|
+
title: "Get Account Overview"
|
|
436
1330
|
},
|
|
437
1331
|
{
|
|
438
|
-
description: "
|
|
1332
|
+
description: "Use this when the user wants to see which artists or YouTube channels they manage, along with billing status, active campaign count, and their role. Do not use this for campaign details; use dynamoi_list_campaigns or dynamoi_get_campaign. Never use this for generic social-media or marketing advice, including Instagram follower-growth questions, unless the user explicitly asked about their Dynamoi roster.",
|
|
439
1333
|
destructiveHint: false,
|
|
440
1334
|
name: "dynamoi_list_artists",
|
|
441
1335
|
openWorldHint: false,
|
|
1336
|
+
outputSchema: AnyOutputEnvelopeSchema,
|
|
442
1337
|
readOnlyHint: true,
|
|
443
|
-
schema: DynamoiListArtistsInputSchema
|
|
1338
|
+
schema: DynamoiListArtistsInputSchema,
|
|
1339
|
+
title: "List Artists"
|
|
444
1340
|
},
|
|
445
1341
|
{
|
|
446
|
-
description: "
|
|
1342
|
+
description: "Use this when the user mentions an artist, release, campaign, or smart link but you do not yet know the exact record to inspect. Do not use this for analytics summaries or billing questions once you already know the target record.",
|
|
447
1343
|
destructiveHint: false,
|
|
448
1344
|
name: "dynamoi_search",
|
|
449
1345
|
openWorldHint: false,
|
|
1346
|
+
outputSchema: AnyOutputEnvelopeSchema,
|
|
450
1347
|
readOnlyHint: true,
|
|
451
|
-
schema: DynamoiSearchInputSchema
|
|
1348
|
+
schema: DynamoiSearchInputSchema,
|
|
1349
|
+
title: "Search Dynamoi"
|
|
452
1350
|
},
|
|
453
1351
|
{
|
|
454
|
-
description: "
|
|
1352
|
+
description: "Use this when the user wants the profile and launch readiness for one specific artist or YouTube channel, including connected platforms and billing state. Do not use this to list every artist; use dynamoi_list_artists first. Never use this for generic advice questions that do not require account-specific data, including Instagram growth, songwriting, or lyrics prompts.",
|
|
455
1353
|
destructiveHint: false,
|
|
456
1354
|
name: "dynamoi_get_artist",
|
|
457
1355
|
openWorldHint: false,
|
|
1356
|
+
outputSchema: AnyOutputEnvelopeSchema,
|
|
458
1357
|
readOnlyHint: true,
|
|
459
|
-
schema: DynamoiGetArtistInputSchema
|
|
1358
|
+
schema: DynamoiGetArtistInputSchema,
|
|
1359
|
+
title: "Get Artist"
|
|
460
1360
|
},
|
|
461
1361
|
{
|
|
462
|
-
description: "
|
|
1362
|
+
description: "Use this when the user wants to browse campaigns for one artist, optionally filtered by type or status. Do not use this for a single campaign deep dive; use dynamoi_get_campaign for that. Never use this to personalize generic marketing advice.",
|
|
463
1363
|
destructiveHint: false,
|
|
464
1364
|
name: "dynamoi_list_campaigns",
|
|
465
1365
|
openWorldHint: false,
|
|
1366
|
+
outputSchema: AnyOutputEnvelopeSchema,
|
|
466
1367
|
readOnlyHint: true,
|
|
467
|
-
schema: DynamoiListCampaignsInputSchema
|
|
1368
|
+
schema: DynamoiListCampaignsInputSchema,
|
|
1369
|
+
title: "List Campaigns"
|
|
468
1370
|
},
|
|
469
1371
|
{
|
|
470
|
-
description: "
|
|
1372
|
+
description: "Use this when the user wants full details for one campaign, including budget, targeting, platform status, and next actions. Do not use this for a campaign list; use dynamoi_list_campaigns instead. Pass includeCountries=true only when the full country list is needed. After a successful launch or budget/status mutation, prefer format=summary when you need a follow-up read to relay the final answer.",
|
|
471
1373
|
destructiveHint: false,
|
|
472
1374
|
name: "dynamoi_get_campaign",
|
|
473
1375
|
openWorldHint: false,
|
|
1376
|
+
outputSchema: AnyOutputEnvelopeSchema,
|
|
474
1377
|
readOnlyHint: true,
|
|
475
|
-
schema: DynamoiGetCampaignInputSchema
|
|
1378
|
+
schema: DynamoiGetCampaignInputSchema,
|
|
1379
|
+
title: "Get Campaign"
|
|
476
1380
|
},
|
|
477
1381
|
{
|
|
478
|
-
description: "
|
|
1382
|
+
description: "Use this when the user asks how one campaign is performing across impressions, clicks, spend, CPC, CPM, or CTR. Pass granularity=DAILY when the user asks for a daily breakdown. Use this for a deeper audit of one campaign after you already know which campaign to inspect. Do not use this for artist-wide performance across multiple campaigns; use dynamoi_get_artist_analytics instead.",
|
|
479
1383
|
destructiveHint: false,
|
|
480
1384
|
name: "dynamoi_get_campaign_analytics",
|
|
481
1385
|
openWorldHint: false,
|
|
1386
|
+
outputSchema: AnyOutputEnvelopeSchema,
|
|
482
1387
|
readOnlyHint: true,
|
|
483
|
-
schema: DynamoiGetCampaignAnalyticsInputSchema
|
|
1388
|
+
schema: DynamoiGetCampaignAnalyticsInputSchema,
|
|
1389
|
+
title: "Get Campaign Analytics"
|
|
484
1390
|
},
|
|
485
1391
|
{
|
|
486
|
-
description: "
|
|
1392
|
+
description: "Use this when the user wants artist-level performance across all campaigns, including 30-day rollups or daily breakdowns. Pass granularity=DAILY when the user asks for a daily breakdown. Pass format=summary when the user wants a written rollup, a strongest-campaign verdict, or a direct answer you can relay immediately. If this tool already returned the requested strongest-campaign comparison, stop and answer instead of calling more analytics tools. Do not use this for one campaign's metrics; use dynamoi_get_campaign_analytics instead.",
|
|
487
1393
|
destructiveHint: false,
|
|
488
1394
|
name: "dynamoi_get_artist_analytics",
|
|
489
1395
|
openWorldHint: false,
|
|
1396
|
+
outputSchema: AnyOutputEnvelopeSchema,
|
|
490
1397
|
readOnlyHint: true,
|
|
491
|
-
schema: DynamoiGetArtistAnalyticsInputSchema
|
|
1398
|
+
schema: DynamoiGetArtistAnalyticsInputSchema,
|
|
1399
|
+
title: "Get Artist Analytics"
|
|
492
1400
|
},
|
|
493
1401
|
{
|
|
494
|
-
description: "
|
|
1402
|
+
description: "Use this when the user asks about billing state, credit balance, promo limits, or whether billing is blocking launches for one artist. Do not use this for campaign analytics or platform connection troubleshooting.",
|
|
495
1403
|
destructiveHint: false,
|
|
496
1404
|
name: "dynamoi_get_billing",
|
|
497
1405
|
openWorldHint: false,
|
|
1406
|
+
outputSchema: AnyOutputEnvelopeSchema,
|
|
498
1407
|
readOnlyHint: true,
|
|
499
|
-
schema: DynamoiGetBillingInputSchema
|
|
1408
|
+
schema: DynamoiGetBillingInputSchema,
|
|
1409
|
+
title: "Get Billing"
|
|
500
1410
|
},
|
|
501
1411
|
{
|
|
502
|
-
description: "
|
|
1412
|
+
description: "Use this when the user wants to know whether Spotify, Meta, or YouTube are connected and what setup steps still block launches. Do not use this for billing details; use dynamoi_get_billing when the question is about credits or subscription state. Never use this to personalize generic Instagram or marketing-advice questions.",
|
|
503
1413
|
destructiveHint: false,
|
|
504
1414
|
name: "dynamoi_get_platform_status",
|
|
505
1415
|
openWorldHint: false,
|
|
1416
|
+
outputSchema: AnyOutputEnvelopeSchema,
|
|
506
1417
|
readOnlyHint: true,
|
|
507
|
-
schema: DynamoiGetPlatformStatusInputSchema
|
|
1418
|
+
schema: DynamoiGetPlatformStatusInputSchema,
|
|
1419
|
+
title: "Get Platform Status"
|
|
508
1420
|
}
|
|
509
1421
|
];
|
|
510
1422
|
var PHASE_2_TOOL_DEFINITIONS = [
|
|
511
1423
|
{
|
|
512
|
-
description: "
|
|
513
|
-
destructiveHint:
|
|
1424
|
+
description: "Use this when the user explicitly wants to pause a running campaign and stop ad delivery. Do not use this for inspection-only questions; this changes external campaign state.",
|
|
1425
|
+
destructiveHint: true,
|
|
1426
|
+
idempotentHint: true,
|
|
514
1427
|
name: "dynamoi_pause_campaign",
|
|
515
1428
|
openWorldHint: true,
|
|
1429
|
+
outputSchema: PauseResumeOutputEnvelopeSchema,
|
|
516
1430
|
readOnlyHint: false,
|
|
517
|
-
schema: DynamoiPauseCampaignInputSchema
|
|
1431
|
+
schema: DynamoiPauseCampaignInputSchema,
|
|
1432
|
+
title: "Pause Campaign"
|
|
518
1433
|
},
|
|
519
1434
|
{
|
|
520
|
-
description: "
|
|
521
|
-
destructiveHint:
|
|
1435
|
+
description: "Use this when the user explicitly wants to resume a paused campaign and restart ad delivery. Do not use this for inspection-only questions; this changes external campaign state.",
|
|
1436
|
+
destructiveHint: true,
|
|
1437
|
+
idempotentHint: true,
|
|
522
1438
|
name: "dynamoi_resume_campaign",
|
|
523
1439
|
openWorldHint: true,
|
|
1440
|
+
outputSchema: PauseResumeOutputEnvelopeSchema,
|
|
524
1441
|
readOnlyHint: false,
|
|
525
|
-
schema: DynamoiResumeCampaignInputSchema
|
|
1442
|
+
schema: DynamoiResumeCampaignInputSchema,
|
|
1443
|
+
title: "Resume Campaign"
|
|
526
1444
|
},
|
|
527
1445
|
{
|
|
528
|
-
description: "
|
|
529
|
-
destructiveHint:
|
|
1446
|
+
description: "Use this when the user explicitly wants to change a campaign budget, and optionally the end date for total-budget campaigns. Do not use this for read-only budget checks; this updates live campaign settings.",
|
|
1447
|
+
destructiveHint: true,
|
|
1448
|
+
idempotentHint: true,
|
|
530
1449
|
name: "dynamoi_update_budget",
|
|
531
1450
|
openWorldHint: true,
|
|
1451
|
+
outputSchema: UpdateBudgetOutputEnvelopeSchema,
|
|
532
1452
|
readOnlyHint: false,
|
|
533
|
-
schema: DynamoiUpdateBudgetInputSchema
|
|
1453
|
+
schema: DynamoiUpdateBudgetInputSchema,
|
|
1454
|
+
title: "Update Campaign Budget"
|
|
534
1455
|
}
|
|
535
1456
|
];
|
|
536
1457
|
var PHASE_3_TOOL_DEFINITIONS = [
|
|
537
1458
|
{
|
|
538
|
-
description: "
|
|
1459
|
+
description: "Use this when the user wants to choose from uploaded images or videos that can be reused in a campaign launch. Do not use this when the user only wants campaign status or analytics. Use format=json when you need asset IDs for a follow-up launch. Request includeUrls only when the assistant must display or inspect public-safe asset URLs.",
|
|
539
1460
|
destructiveHint: false,
|
|
540
1461
|
name: "dynamoi_list_media_assets",
|
|
541
1462
|
openWorldHint: false,
|
|
1463
|
+
outputSchema: ListMediaAssetsOutputEnvelopeSchema,
|
|
542
1464
|
readOnlyHint: true,
|
|
543
|
-
schema: DynamoiListMediaAssetsInputSchema
|
|
1465
|
+
schema: DynamoiListMediaAssetsInputSchema,
|
|
1466
|
+
title: "List Media Assets"
|
|
544
1467
|
},
|
|
545
1468
|
{
|
|
546
|
-
description: "
|
|
1469
|
+
description: "Use this when the user explicitly wants to create a new Smart Campaign or YouTube Campaign and start the launch workflow with provided details. Ads are not necessarily live until the returned delivery state is ACTIVE. For review or demo Smart Campaign launches that already specify the artist, content title, budget, countries, and reusable media assets, you may omit spotifyUrl and endDate because Dynamoi can infer reviewer-safe defaults. Do not invent placeholder spotifyUrl or endDate values for those review/demo launches; omit them and let Dynamoi infer them. After a successful launch, answer from the returned campaign details directly instead of chaining more tools unless the user explicitly asked for more. Do not use this for recommendations or previews; this creates a real campaign workflow or demo-safe simulated campaign.",
|
|
547
1470
|
destructiveHint: false,
|
|
1471
|
+
idempotentHint: true,
|
|
548
1472
|
name: "dynamoi_launch_campaign",
|
|
549
1473
|
openWorldHint: true,
|
|
1474
|
+
outputSchema: LaunchCampaignOutputEnvelopeSchema,
|
|
550
1475
|
readOnlyHint: false,
|
|
551
|
-
schema: DynamoiLaunchCampaignInputSchema
|
|
1476
|
+
schema: DynamoiLaunchCampaignInputSchema,
|
|
1477
|
+
title: "Start Campaign Launch Workflow"
|
|
552
1478
|
}
|
|
553
1479
|
];
|
|
554
1480
|
|
|
555
1481
|
// src/server/create-server.ts
|
|
556
1482
|
function asTextResult(envelope) {
|
|
1483
|
+
const isToolError = Boolean(envelope) && typeof envelope === "object" && envelope.status === "error";
|
|
1484
|
+
const plainText = (() => {
|
|
1485
|
+
if (!envelope || typeof envelope !== "object") {
|
|
1486
|
+
return JSON.stringify(envelope);
|
|
1487
|
+
}
|
|
1488
|
+
const status = envelope.status;
|
|
1489
|
+
if (status === "error") {
|
|
1490
|
+
const message = envelope.message;
|
|
1491
|
+
return typeof message === "string" && message.trim().length > 0 ? message : JSON.stringify(envelope);
|
|
1492
|
+
}
|
|
1493
|
+
const data = envelope.data;
|
|
1494
|
+
if (data && typeof data === "object") {
|
|
1495
|
+
const summary = data.summary;
|
|
1496
|
+
if (typeof summary === "string" && summary.trim().length > 0) {
|
|
1497
|
+
return summary;
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
return JSON.stringify(envelope);
|
|
1501
|
+
})();
|
|
557
1502
|
return {
|
|
558
|
-
content: [{ text:
|
|
559
|
-
structuredContent: envelope
|
|
1503
|
+
content: [{ text: plainText, type: "text" }],
|
|
1504
|
+
structuredContent: envelope,
|
|
1505
|
+
...isToolError ? { isError: true } : {}
|
|
560
1506
|
};
|
|
561
1507
|
}
|
|
1508
|
+
function asValidatedTextResult(options) {
|
|
1509
|
+
const parsed = options.outputSchema.safeParse(options.envelope);
|
|
1510
|
+
if (!parsed.success) {
|
|
1511
|
+
return asTextResult({
|
|
1512
|
+
kind: "validation",
|
|
1513
|
+
message: `Tool ${options.toolName} returned an invalid result shape.`,
|
|
1514
|
+
status: "error"
|
|
1515
|
+
});
|
|
1516
|
+
}
|
|
1517
|
+
return asTextResult(options.envelope);
|
|
1518
|
+
}
|
|
562
1519
|
function createDynamoiMcpServer(options) {
|
|
563
1520
|
const server = new McpServer(
|
|
564
1521
|
{
|
|
565
1522
|
name: "dynamoi",
|
|
566
1523
|
version: DYNAMOI_MCP_VERSION,
|
|
567
|
-
websiteUrl: "https://dynamoi.com"
|
|
1524
|
+
websiteUrl: options.websiteUrl ?? "https://dynamoi.com"
|
|
568
1525
|
},
|
|
569
1526
|
{ instructions: DYNAMOI_MCP_INSTRUCTIONS }
|
|
570
1527
|
);
|
|
571
1528
|
for (const def of [
|
|
572
1529
|
...PHASE_1_TOOL_DEFINITIONS,
|
|
573
1530
|
...PHASE_2_TOOL_DEFINITIONS,
|
|
574
|
-
...PHASE_3_TOOL_DEFINITIONS
|
|
1531
|
+
...PHASE_3_TOOL_DEFINITIONS,
|
|
1532
|
+
...PHASE_4_TOOL_DEFINITIONS
|
|
575
1533
|
]) {
|
|
1534
|
+
const title = def.title;
|
|
1535
|
+
const idempotentHint = "idempotentHint" in def && typeof def.idempotentHint === "boolean" ? def.idempotentHint : void 0;
|
|
576
1536
|
server.registerTool(
|
|
577
1537
|
def.name,
|
|
578
1538
|
{
|
|
579
1539
|
annotations: {
|
|
580
1540
|
destructiveHint: def.destructiveHint,
|
|
1541
|
+
...typeof idempotentHint === "boolean" ? { idempotentHint } : {},
|
|
581
1542
|
openWorldHint: def.openWorldHint,
|
|
582
1543
|
readOnlyHint: def.readOnlyHint
|
|
583
1544
|
},
|
|
584
1545
|
description: def.description,
|
|
585
1546
|
inputSchema: def.schema,
|
|
586
|
-
|
|
1547
|
+
outputSchema: def.outputSchema,
|
|
1548
|
+
title
|
|
587
1549
|
},
|
|
588
1550
|
async (input) => {
|
|
589
1551
|
switch (def.name) {
|
|
590
|
-
case "
|
|
591
|
-
return
|
|
1552
|
+
case "dynamoi_get_account_overview":
|
|
1553
|
+
return asValidatedTextResult({
|
|
1554
|
+
envelope: await options.adapter.getCurrentUser(input),
|
|
1555
|
+
outputSchema: def.outputSchema,
|
|
1556
|
+
toolName: def.name
|
|
1557
|
+
});
|
|
592
1558
|
case "dynamoi_list_artists":
|
|
593
|
-
return
|
|
1559
|
+
return asValidatedTextResult({
|
|
1560
|
+
envelope: await options.adapter.listArtists(input),
|
|
1561
|
+
outputSchema: def.outputSchema,
|
|
1562
|
+
toolName: def.name
|
|
1563
|
+
});
|
|
594
1564
|
case "dynamoi_search":
|
|
595
|
-
return
|
|
1565
|
+
return asValidatedTextResult({
|
|
1566
|
+
envelope: await options.adapter.search(input),
|
|
1567
|
+
outputSchema: def.outputSchema,
|
|
1568
|
+
toolName: def.name
|
|
1569
|
+
});
|
|
596
1570
|
case "dynamoi_get_artist":
|
|
597
|
-
return
|
|
1571
|
+
return asValidatedTextResult({
|
|
1572
|
+
envelope: await options.adapter.getArtist(input),
|
|
1573
|
+
outputSchema: def.outputSchema,
|
|
1574
|
+
toolName: def.name
|
|
1575
|
+
});
|
|
598
1576
|
case "dynamoi_get_artist_analytics":
|
|
599
|
-
return
|
|
600
|
-
await options.adapter.getArtistAnalytics(input)
|
|
601
|
-
|
|
1577
|
+
return asValidatedTextResult({
|
|
1578
|
+
envelope: await options.adapter.getArtistAnalytics(input),
|
|
1579
|
+
outputSchema: def.outputSchema,
|
|
1580
|
+
toolName: def.name
|
|
1581
|
+
});
|
|
602
1582
|
case "dynamoi_list_campaigns":
|
|
603
|
-
return
|
|
1583
|
+
return asValidatedTextResult({
|
|
1584
|
+
envelope: await options.adapter.listCampaigns(input),
|
|
1585
|
+
outputSchema: def.outputSchema,
|
|
1586
|
+
toolName: def.name
|
|
1587
|
+
});
|
|
604
1588
|
case "dynamoi_get_campaign":
|
|
605
|
-
return
|
|
1589
|
+
return asValidatedTextResult({
|
|
1590
|
+
envelope: await options.adapter.getCampaign(input),
|
|
1591
|
+
outputSchema: def.outputSchema,
|
|
1592
|
+
toolName: def.name
|
|
1593
|
+
});
|
|
606
1594
|
case "dynamoi_get_campaign_analytics":
|
|
607
|
-
return
|
|
608
|
-
await options.adapter.getCampaignAnalytics(input)
|
|
609
|
-
|
|
1595
|
+
return asValidatedTextResult({
|
|
1596
|
+
envelope: await options.adapter.getCampaignAnalytics(input),
|
|
1597
|
+
outputSchema: def.outputSchema,
|
|
1598
|
+
toolName: def.name
|
|
1599
|
+
});
|
|
610
1600
|
case "dynamoi_get_billing":
|
|
611
|
-
return
|
|
1601
|
+
return asValidatedTextResult({
|
|
1602
|
+
envelope: await options.adapter.getBilling(input),
|
|
1603
|
+
outputSchema: def.outputSchema,
|
|
1604
|
+
toolName: def.name
|
|
1605
|
+
});
|
|
612
1606
|
case "dynamoi_get_platform_status":
|
|
613
|
-
return
|
|
1607
|
+
return asValidatedTextResult({
|
|
1608
|
+
envelope: await options.adapter.getPlatformStatus(input),
|
|
1609
|
+
outputSchema: def.outputSchema,
|
|
1610
|
+
toolName: def.name
|
|
1611
|
+
});
|
|
614
1612
|
case "dynamoi_pause_campaign":
|
|
615
|
-
return
|
|
1613
|
+
return asValidatedTextResult({
|
|
1614
|
+
envelope: await options.adapter.pauseCampaign(input),
|
|
1615
|
+
outputSchema: def.outputSchema,
|
|
1616
|
+
toolName: def.name
|
|
1617
|
+
});
|
|
616
1618
|
case "dynamoi_resume_campaign":
|
|
617
|
-
return
|
|
1619
|
+
return asValidatedTextResult({
|
|
1620
|
+
envelope: await options.adapter.resumeCampaign(input),
|
|
1621
|
+
outputSchema: def.outputSchema,
|
|
1622
|
+
toolName: def.name
|
|
1623
|
+
});
|
|
618
1624
|
case "dynamoi_update_budget":
|
|
619
|
-
return
|
|
1625
|
+
return asValidatedTextResult({
|
|
1626
|
+
envelope: await options.adapter.updateBudget(input),
|
|
1627
|
+
outputSchema: def.outputSchema,
|
|
1628
|
+
toolName: def.name
|
|
1629
|
+
});
|
|
620
1630
|
case "dynamoi_list_media_assets":
|
|
621
|
-
return
|
|
1631
|
+
return asValidatedTextResult({
|
|
1632
|
+
envelope: await options.adapter.listMediaAssets(input),
|
|
1633
|
+
outputSchema: def.outputSchema,
|
|
1634
|
+
toolName: def.name
|
|
1635
|
+
});
|
|
622
1636
|
case "dynamoi_launch_campaign":
|
|
623
|
-
return
|
|
1637
|
+
return asValidatedTextResult({
|
|
1638
|
+
envelope: await options.adapter.launchCampaign(input),
|
|
1639
|
+
outputSchema: def.outputSchema,
|
|
1640
|
+
toolName: def.name
|
|
1641
|
+
});
|
|
1642
|
+
case "dynamoi_create_smart_link_from_spotify":
|
|
1643
|
+
return asValidatedTextResult({
|
|
1644
|
+
envelope: await options.adapter.createSmartLinkFromSpotify(input),
|
|
1645
|
+
outputSchema: def.outputSchema,
|
|
1646
|
+
toolName: def.name
|
|
1647
|
+
});
|
|
1648
|
+
case "dynamoi_list_smart_links":
|
|
1649
|
+
return asValidatedTextResult({
|
|
1650
|
+
envelope: await options.adapter.listSmartLinks(input),
|
|
1651
|
+
outputSchema: def.outputSchema,
|
|
1652
|
+
toolName: def.name
|
|
1653
|
+
});
|
|
1654
|
+
case "dynamoi_get_smart_link":
|
|
1655
|
+
return asValidatedTextResult({
|
|
1656
|
+
envelope: await options.adapter.getSmartLink(input),
|
|
1657
|
+
outputSchema: def.outputSchema,
|
|
1658
|
+
toolName: def.name
|
|
1659
|
+
});
|
|
1660
|
+
case "dynamoi_get_smart_link_analytics":
|
|
1661
|
+
return asValidatedTextResult({
|
|
1662
|
+
envelope: await options.adapter.getSmartLinkAnalytics(input),
|
|
1663
|
+
outputSchema: def.outputSchema,
|
|
1664
|
+
toolName: def.name
|
|
1665
|
+
});
|
|
1666
|
+
case "dynamoi_get_smart_link_artist_settings":
|
|
1667
|
+
return asValidatedTextResult({
|
|
1668
|
+
envelope: await options.adapter.getSmartLinkArtistSettings(input),
|
|
1669
|
+
outputSchema: def.outputSchema,
|
|
1670
|
+
toolName: def.name
|
|
1671
|
+
});
|
|
1672
|
+
case "dynamoi_update_smart_link":
|
|
1673
|
+
return asValidatedTextResult({
|
|
1674
|
+
envelope: await options.adapter.updateSmartLink(input),
|
|
1675
|
+
outputSchema: def.outputSchema,
|
|
1676
|
+
toolName: def.name
|
|
1677
|
+
});
|
|
1678
|
+
case "dynamoi_update_smart_link_artist_settings":
|
|
1679
|
+
return asValidatedTextResult({
|
|
1680
|
+
envelope: await options.adapter.updateSmartLinkArtistSettings(input),
|
|
1681
|
+
outputSchema: def.outputSchema,
|
|
1682
|
+
toolName: def.name
|
|
1683
|
+
});
|
|
1684
|
+
case "dynamoi_publish_smart_link":
|
|
1685
|
+
return asValidatedTextResult({
|
|
1686
|
+
envelope: await options.adapter.publishSmartLink(input),
|
|
1687
|
+
outputSchema: def.outputSchema,
|
|
1688
|
+
toolName: def.name
|
|
1689
|
+
});
|
|
1690
|
+
case "dynamoi_unpublish_smart_link":
|
|
1691
|
+
return asValidatedTextResult({
|
|
1692
|
+
envelope: await options.adapter.unpublishSmartLink(input),
|
|
1693
|
+
outputSchema: def.outputSchema,
|
|
1694
|
+
toolName: def.name
|
|
1695
|
+
});
|
|
624
1696
|
default:
|
|
625
1697
|
return asTextResult({
|
|
626
1698
|
message: "Unknown tool",
|
|
@@ -631,172 +1703,7 @@ function createDynamoiMcpServer(options) {
|
|
|
631
1703
|
);
|
|
632
1704
|
}
|
|
633
1705
|
registerDynamoiPrompts(server);
|
|
634
|
-
server.
|
|
635
|
-
"platform-pricing",
|
|
636
|
-
"dynamoi://platform/pricing",
|
|
637
|
-
{
|
|
638
|
-
description: "Dynamoi pricing, activation bonus, ad credit structure, and campaign budget minimums.",
|
|
639
|
-
mimeType: "application/json",
|
|
640
|
-
title: "Pricing"
|
|
641
|
-
},
|
|
642
|
-
async (uri) => ({
|
|
643
|
-
contents: [
|
|
644
|
-
{
|
|
645
|
-
mimeType: "application/json",
|
|
646
|
-
text: JSON.stringify({
|
|
647
|
-
activationBonus: {
|
|
648
|
-
amountUsd: 600,
|
|
649
|
-
note: "100% match on first month \u2014 pay $300, get $600 ad credit"
|
|
650
|
-
},
|
|
651
|
-
budgetMinimums: {
|
|
652
|
-
smartCampaign: {
|
|
653
|
-
dailyUsd: 10,
|
|
654
|
-
note: "Meta Ads for Spotify promotion",
|
|
655
|
-
totalUsd: 100
|
|
656
|
-
},
|
|
657
|
-
youtube: {
|
|
658
|
-
dailyUsd: 10,
|
|
659
|
-
note: "Google Ads for YouTube channel growth",
|
|
660
|
-
totalUsd: 50
|
|
661
|
-
}
|
|
662
|
-
},
|
|
663
|
-
creditRollover: "Credits roll over for 12 months",
|
|
664
|
-
includes: "Unlimited team seats, unlimited artists, white-glove support, free smart link landing pages",
|
|
665
|
-
noContracts: true,
|
|
666
|
-
tiers: [
|
|
667
|
-
{
|
|
668
|
-
name: "Plus",
|
|
669
|
-
note: "100% Ad Credit. No agency fees.",
|
|
670
|
-
priceUsdMonthly: 300
|
|
671
|
-
}
|
|
672
|
-
]
|
|
673
|
-
}),
|
|
674
|
-
uri: uri.href
|
|
675
|
-
}
|
|
676
|
-
]
|
|
677
|
-
})
|
|
678
|
-
);
|
|
679
|
-
server.registerResource(
|
|
680
|
-
"platform-content-types",
|
|
681
|
-
"dynamoi://platform/content-types",
|
|
682
|
-
{ mimeType: "application/json", title: "Content Types" },
|
|
683
|
-
async (uri) => ({
|
|
684
|
-
contents: [
|
|
685
|
-
{
|
|
686
|
-
mimeType: "application/json",
|
|
687
|
-
text: JSON.stringify({
|
|
688
|
-
campaignTypes: {
|
|
689
|
-
SMART_CAMPAIGN: ["TRACK", "ALBUM", "PLAYLIST"],
|
|
690
|
-
YOUTUBE: ["VIDEO"]
|
|
691
|
-
},
|
|
692
|
-
contentTypes: ["TRACK", "ALBUM", "PLAYLIST", "VIDEO"]
|
|
693
|
-
}),
|
|
694
|
-
uri: uri.href
|
|
695
|
-
}
|
|
696
|
-
]
|
|
697
|
-
})
|
|
698
|
-
);
|
|
699
|
-
server.registerResource(
|
|
700
|
-
"platform-campaign-statuses",
|
|
701
|
-
"dynamoi://platform/campaign-statuses",
|
|
702
|
-
{ mimeType: "application/json", title: "Campaign Statuses" },
|
|
703
|
-
async (uri) => ({
|
|
704
|
-
contents: [
|
|
705
|
-
{
|
|
706
|
-
mimeType: "application/json",
|
|
707
|
-
text: JSON.stringify({
|
|
708
|
-
statuses: [
|
|
709
|
-
"AWAITING_SMART_LINK",
|
|
710
|
-
"CONTENT_VALIDATION",
|
|
711
|
-
"DEPLOYING",
|
|
712
|
-
"READY_FOR_REVIEW",
|
|
713
|
-
"ACTIVE",
|
|
714
|
-
"PAUSED",
|
|
715
|
-
"SUBSCRIPTION_PAUSED",
|
|
716
|
-
"FAILED",
|
|
717
|
-
"ARCHIVED",
|
|
718
|
-
"ENDED"
|
|
719
|
-
]
|
|
720
|
-
}),
|
|
721
|
-
uri: uri.href
|
|
722
|
-
}
|
|
723
|
-
]
|
|
724
|
-
})
|
|
725
|
-
);
|
|
726
|
-
server.registerResource(
|
|
727
|
-
"artist-resource",
|
|
728
|
-
new ResourceTemplate("artist://{artistId}", {
|
|
729
|
-
list: async () => ({ resources: [] })
|
|
730
|
-
}),
|
|
731
|
-
{ mimeType: "application/json", title: "Artist" },
|
|
732
|
-
async (uri, variables) => {
|
|
733
|
-
const artistId = variables["artistId"];
|
|
734
|
-
const parsed = z3.string().uuid().safeParse(artistId);
|
|
735
|
-
if (!parsed.success) {
|
|
736
|
-
return {
|
|
737
|
-
contents: [
|
|
738
|
-
{
|
|
739
|
-
mimeType: "application/json",
|
|
740
|
-
text: JSON.stringify({
|
|
741
|
-
message: "Invalid artistId",
|
|
742
|
-
status: "error"
|
|
743
|
-
}),
|
|
744
|
-
uri: uri.href
|
|
745
|
-
}
|
|
746
|
-
]
|
|
747
|
-
};
|
|
748
|
-
}
|
|
749
|
-
const envelope = await options.adapter.getArtist({
|
|
750
|
-
artistId: parsed.data
|
|
751
|
-
});
|
|
752
|
-
return {
|
|
753
|
-
contents: [
|
|
754
|
-
{
|
|
755
|
-
mimeType: "application/json",
|
|
756
|
-
text: JSON.stringify(envelope),
|
|
757
|
-
uri: uri.href
|
|
758
|
-
}
|
|
759
|
-
]
|
|
760
|
-
};
|
|
761
|
-
}
|
|
762
|
-
);
|
|
763
|
-
server.registerResource(
|
|
764
|
-
"campaign-resource",
|
|
765
|
-
new ResourceTemplate("campaign://{campaignId}", {
|
|
766
|
-
list: async () => ({ resources: [] })
|
|
767
|
-
}),
|
|
768
|
-
{ mimeType: "application/json", title: "Campaign" },
|
|
769
|
-
async (uri, variables) => {
|
|
770
|
-
const campaignId = variables["campaignId"];
|
|
771
|
-
const parsed = z3.string().uuid().safeParse(campaignId);
|
|
772
|
-
if (!parsed.success) {
|
|
773
|
-
return {
|
|
774
|
-
contents: [
|
|
775
|
-
{
|
|
776
|
-
mimeType: "application/json",
|
|
777
|
-
text: JSON.stringify({
|
|
778
|
-
message: "Invalid campaignId",
|
|
779
|
-
status: "error"
|
|
780
|
-
}),
|
|
781
|
-
uri: uri.href
|
|
782
|
-
}
|
|
783
|
-
]
|
|
784
|
-
};
|
|
785
|
-
}
|
|
786
|
-
const envelope = await options.adapter.getCampaign({
|
|
787
|
-
campaignId: parsed.data
|
|
788
|
-
});
|
|
789
|
-
return {
|
|
790
|
-
contents: [
|
|
791
|
-
{
|
|
792
|
-
mimeType: "application/json",
|
|
793
|
-
text: JSON.stringify(envelope),
|
|
794
|
-
uri: uri.href
|
|
795
|
-
}
|
|
796
|
-
]
|
|
797
|
-
};
|
|
798
|
-
}
|
|
799
|
-
);
|
|
1706
|
+
registerDynamoiResources(server, options.adapter);
|
|
800
1707
|
return server;
|
|
801
1708
|
}
|
|
802
1709
|
|
|
@@ -874,6 +1781,9 @@ async function handleMcpHttpRequest(options) {
|
|
|
874
1781
|
}
|
|
875
1782
|
return response;
|
|
876
1783
|
}
|
|
1784
|
+
if (sessionId && !isInitializeRequest(options.parsedBody)) {
|
|
1785
|
+
return jsonRpcSessionNotFound();
|
|
1786
|
+
}
|
|
877
1787
|
const isInit = isInitializeRequest(options.parsedBody);
|
|
878
1788
|
const transport = new WebStandardStreamableHTTPServerTransport({
|
|
879
1789
|
onsessioninitialized: (sid) => {
|
|
@@ -885,7 +1795,7 @@ async function handleMcpHttpRequest(options) {
|
|
|
885
1795
|
});
|
|
886
1796
|
cleanupTransports(Date.now());
|
|
887
1797
|
},
|
|
888
|
-
|
|
1798
|
+
...isInit ? { sessionIdGenerator: () => randomUUID() } : {}
|
|
889
1799
|
});
|
|
890
1800
|
const server = options.createServer();
|
|
891
1801
|
await server.connect(transport);
|
|
@@ -894,7 +1804,9 @@ async function handleMcpHttpRequest(options) {
|
|
|
894
1804
|
});
|
|
895
1805
|
}
|
|
896
1806
|
export {
|
|
897
|
-
|
|
1807
|
+
DYNAMOI_MCP_SCOPES,
|
|
1808
|
+
DateRangeSchema2 as DateRangeSchema,
|
|
1809
|
+
DynamoiCreateSmartLinkFromSpotifyInputSchema,
|
|
898
1810
|
DynamoiGetArtistAnalyticsInputSchema,
|
|
899
1811
|
DynamoiGetArtistInputSchema,
|
|
900
1812
|
DynamoiGetBillingInputSchema,
|
|
@@ -902,18 +1814,26 @@ export {
|
|
|
902
1814
|
DynamoiGetCampaignInputSchema,
|
|
903
1815
|
DynamoiGetCurrentUserInputSchema,
|
|
904
1816
|
DynamoiGetPlatformStatusInputSchema,
|
|
1817
|
+
DynamoiGetSmartLinkAnalyticsInputSchema,
|
|
1818
|
+
DynamoiGetSmartLinkArtistSettingsInputSchema,
|
|
1819
|
+
DynamoiGetSmartLinkInputSchema,
|
|
905
1820
|
DynamoiLaunchCampaignInputSchema,
|
|
906
1821
|
DynamoiListArtistsInputSchema,
|
|
907
1822
|
DynamoiListCampaignsInputSchema,
|
|
908
1823
|
DynamoiListMediaAssetsInputSchema,
|
|
1824
|
+
DynamoiListSmartLinksInputSchema,
|
|
909
1825
|
DynamoiPauseCampaignInputSchema,
|
|
1826
|
+
DynamoiPublishSmartLinkInputSchema,
|
|
910
1827
|
DynamoiResumeCampaignInputSchema,
|
|
911
1828
|
DynamoiSearchInputSchema,
|
|
912
1829
|
DynamoiUpdateBudgetInputSchema,
|
|
1830
|
+
DynamoiUpdateSmartLinkArtistSettingsInputSchema,
|
|
1831
|
+
DynamoiUpdateSmartLinkInputSchema,
|
|
913
1832
|
PHASE_1_TOOL_DEFINITIONS,
|
|
914
1833
|
PHASE_2_TOOL_DEFINITIONS,
|
|
915
1834
|
PHASE_3_TOOL_DEFINITIONS,
|
|
916
|
-
|
|
1835
|
+
PHASE_4_TOOL_DEFINITIONS,
|
|
1836
|
+
ToolFormatSchema2 as ToolFormatSchema,
|
|
917
1837
|
buildProtectedResourceMetadata,
|
|
918
1838
|
buildWwwAuthenticateHeader,
|
|
919
1839
|
createDynamoiMcpServer,
|