@dynamoi/mcp 0.7.1 → 1.0.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.
Files changed (63) hide show
  1. package/CAPABILITY_PARITY.md +57 -59
  2. package/CHANGELOG.md +167 -0
  3. package/README.md +281 -123
  4. package/dist/auth/protected-resource.d.ts +5 -18
  5. package/dist/auth/protected-resource.d.ts.map +1 -1
  6. package/dist/auth/protected-resource.js +8 -12
  7. package/dist/auth/protected-resource.js.map +1 -1
  8. package/dist/{chunk-2jm8hjsz.js → chunk-3htwe57a.js} +19 -30
  9. package/dist/chunk-3htwe57a.js.map +10 -0
  10. package/dist/chunk-n5xmtwjj.js +9 -0
  11. package/dist/chunk-n5xmtwjj.js.map +10 -0
  12. package/dist/consent.d.ts +3 -3
  13. package/dist/consent.d.ts.map +1 -1
  14. package/dist/consent.js +8 -8
  15. package/dist/consent.js.map +1 -1
  16. package/dist/flow-types.d.ts +3 -3
  17. package/dist/flow-types.d.ts.map +1 -1
  18. package/dist/index.d.ts +7 -5
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +1203 -577
  21. package/dist/index.js.map +19 -17
  22. package/dist/server/about.d.ts +74 -0
  23. package/dist/server/about.d.ts.map +1 -0
  24. package/dist/server/create-server.d.ts +18 -12
  25. package/dist/server/create-server.d.ts.map +1 -1
  26. package/dist/server/distribution-tools.d.ts +53 -3
  27. package/dist/server/distribution-tools.d.ts.map +1 -1
  28. package/dist/server/instructions.d.ts.map +1 -1
  29. package/dist/server/messaging.d.ts +14 -0
  30. package/dist/server/messaging.d.ts.map +1 -0
  31. package/dist/server/onboarding-tool-definitions.d.ts +50 -0
  32. package/dist/server/onboarding-tool-definitions.d.ts.map +1 -1
  33. package/dist/server/openai-tools.d.ts +50 -0
  34. package/dist/server/openai-tools.d.ts.map +1 -1
  35. package/dist/server/output-schemas.d.ts +233 -0
  36. package/dist/server/output-schemas.d.ts.map +1 -1
  37. package/dist/server/playbook-resources.d.ts +1 -1
  38. package/dist/server/playbook-resources.d.ts.map +1 -1
  39. package/dist/server/prompts.d.ts +1 -1
  40. package/dist/server/prompts.d.ts.map +1 -1
  41. package/dist/server/resources.d.ts +1 -1
  42. package/dist/server/resources.d.ts.map +1 -1
  43. package/dist/server/shop-tools.d.ts +335 -0
  44. package/dist/server/shop-tools.d.ts.map +1 -0
  45. package/dist/server/smart-link-theme-preview.d.ts +26 -1
  46. package/dist/server/smart-link-theme-preview.d.ts.map +1 -1
  47. package/dist/server/smart-link-tools.d.ts +126 -2
  48. package/dist/server/smart-link-tools.d.ts.map +1 -1
  49. package/dist/server/tools.d.ts +402 -13
  50. package/dist/server/tools.d.ts.map +1 -1
  51. package/dist/server/workflow-tools.d.ts +62 -1
  52. package/dist/server/workflow-tools.d.ts.map +1 -1
  53. package/dist/transport/http.d.ts +7 -1
  54. package/dist/transport/http.d.ts.map +1 -1
  55. package/dist/types.d.ts +14 -2
  56. package/dist/types.d.ts.map +1 -1
  57. package/package.json +6 -6
  58. package/server.json +2 -13
  59. package/dist/auth/verify-token.d.ts +0 -21
  60. package/dist/auth/verify-token.d.ts.map +0 -1
  61. package/dist/chunk-2jm8hjsz.js.map +0 -10
  62. package/dist/chunk-kb3xpcrb.js +0 -9
  63. package/dist/chunk-kb3xpcrb.js.map +0 -10
package/dist/index.js.map CHANGED
@@ -1,26 +1,28 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/server/distribution-tools.ts", "../../src/server/output-schemas.ts", "../../src/auth/verify-token.ts", "../../src/server/create-server.ts", "../../src/version.ts", "../../src/server/instructions.ts", "../../src/server/prompts.ts", "../../src/server/resources.ts", "../../src/server/playbook-resources.ts", "../../src/server/smart-link-theme-preview.ts", "../../src/server/smart-link-tools.ts", "../../src/server/shared-schemas.ts", "../../src/server/tools.ts", "../../src/server/onboarding-tool-definitions.ts", "../../src/server/openai-tools.ts", "../../src/server/workflow-tools.ts", "../../src/transport/http.ts"],
3
+ "sources": ["../../src/server/about.ts", "../../src/server/output-schemas.ts", "../../src/server/create-server.ts", "../../src/version.ts", "../../src/server/distribution-tools.ts", "../../src/server/instructions.ts", "../../src/server/prompts.ts", "../../src/server/resources.ts", "../../src/server/playbook-resources.ts", "../../src/server/shop-tools.ts", "../../src/server/smart-link-theme-preview.ts", "../../src/server/smart-link-tools.ts", "../../src/server/shared-schemas.ts", "../../src/server/tools.ts", "../../src/server/onboarding-tool-definitions.ts", "../../src/server/openai-tools.ts", "../../src/server/workflow-tools.ts", "../../src/server/messaging.ts", "../../src/transport/http.ts"],
4
4
  "sourcesContent": [
5
- "import * as z from \"zod/v4\";\nimport { AnyOutputEnvelopeSchema } from \"./output-schemas\";\nexport const DynamoiGetDistributionApplicationInputSchema = z\n\t.object({\n\t\tartistId: z.string().uuid(),\n\t})\n\t.strict();\n\nexport const DynamoiApplyForDistributionInputSchema = z\n\t.object({\n\t\tadultSignerAttestation: z.literal(true),\n\t\tapplicantCountry: z.string().trim().length(2),\n\t\tartistId: z.string().uuid(),\n\t\tconfirmApplicationSubmission: z.literal(true),\n\t\tpayoutCountry: z.string().trim().length(2),\n\t\ttaxResidencyCountry: z.string().trim().length(2),\n\t\tuserIntentSummary: z.string().trim().min(1).max(500),\n\t})\n\t.strict();\n\nexport const DISTRIBUTION_TOOL_DEFINITIONS = [\n\t{\n\t\tdescription:\n\t\t\t\"Use this when the user asks whether an artist qualifies for Dynamoi music distribution, wants the five application requirements, or wants the status of an existing distribution application. It checks Spotify connection, at least 1,000 Spotify followers, at least 10,000 verified Soundcharts monthly listeners, connected Facebook Page plus Instagram professional identity, and a connected YouTube channel. Meeting all five requirements permits an application but never guarantees approval. When the connection tools are available, use purpose=distribution_identity for missing Meta or YouTube identity; otherwise send the user to the distribution application in Dynamoi. Identity connections do not require advertising billing.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_get_distribution_application\",\n\t\topenWorldHint: false,\n\t\toutputSchema: AnyOutputEnvelopeSchema,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiGetDistributionApplicationInputSchema,\n\t\ttitle: \"Check Distribution Application\",\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"Submit an artist's application for Dynamoi music distribution after the user explicitly asks to apply and all five eligibility requirements are met. This records an application for manual review; it does not approve distribution, accept an agreement, submit a release, transfer rights, configure splits or tax forms, or deliver music to stores. All three two-letter country codes, an adult signer attestation, confirmApplicationSubmission=true, and a concise userIntentSummary are required. Repeated submission is idempotent for an active application.\",\n\t\tdestructiveHint: false,\n\t\tidempotentHint: true,\n\t\tname: \"dynamoi_apply_for_distribution\",\n\t\topenWorldHint: false,\n\t\toutputSchema: AnyOutputEnvelopeSchema,\n\t\treadOnlyHint: false,\n\t\tschema: DynamoiApplyForDistributionInputSchema,\n\t\ttitle: \"Apply for Music Distribution\",\n\t},\n] as const;\n",
6
- "import * as z from \"zod/v4\";\n\nconst MoneyDisplayOutputSchema = z\n\t.object({\n\t\tamountUsd: z.number(),\n\t\tformatted: z.string(),\n\t})\n\t.strict();\n\nfunction createOutputEnvelopeSchema(\n\tdataSchema: z.ZodType,\n\toptions?: { allowPartial?: boolean },\n) {\n\tconst statuses = options?.allowPartial\n\t\t? ([\"success\", \"partial_success\", \"error\"] as const)\n\t\t: ([\"success\", \"error\"] as const);\n\treturn z\n\t\t.object({\n\t\t\tdata: dataSchema.optional(),\n\t\t\tkind: z\n\t\t\t\t.enum([\"validation\", \"business\", \"platform\", \"unknown\"])\n\t\t\t\t.optional(),\n\t\t\tmessage: z.string().optional(),\n\t\t\tstatus: z.enum(statuses),\n\t\t})\n\t\t.strict()\n\t\t.superRefine((value, context) => {\n\t\t\tif (value.status === \"error\" && !value.message) {\n\t\t\t\tcontext.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tmessage: \"Error tool results require a message.\",\n\t\t\t\t\tpath: [\"message\"],\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (value.status !== \"error\" && value.data === undefined) {\n\t\t\t\tcontext.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tmessage: \"Successful tool results require data.\",\n\t\t\t\t\tpath: [\"data\"],\n\t\t\t\t});\n\t\t\t}\n\t\t});\n}\n\nconst AnyToolDataOutputSchema = z.object({}).passthrough();\n\nconst MediaAssetSummaryOutputSchema = z\n\t.object({\n\t\taspectRatio: z.string().optional(),\n\t\tcreatedAt: z.string(),\n\t\tfileName: z.string().optional(),\n\t\tfileType: z.string(),\n\t\theight: z.number().optional(),\n\t\tid: z.string(),\n\t\turl: z.string().optional(),\n\t\turlExpiresAt: z.string().optional(),\n\t\twidth: z.number().optional(),\n\t})\n\t.strict();\n\nconst ListMediaAssetsDataOutputSchema = z\n\t.object({\n\t\tassets: z.array(MediaAssetSummaryOutputSchema),\n\t\tnextCursor: z.string().optional(),\n\t})\n\t.strict();\n\nconst ListMediaAssetsSummaryOutputSchema = z\n\t.object({\n\t\tnextCursor: z.string().optional(),\n\t\tsummary: z.string(),\n\t\ttotalCount: z.number(),\n\t})\n\t.strict();\n\nconst SmartLinkStatusSchemas = {\n\tclaimStatus: z.enum([\n\t\t\"auto_approved\",\n\t\t\"pending_ops_review\",\n\t\t\"verification_deferred\",\n\t\t\"approved_by_ops\",\n\t\t\"rejected\",\n\t]),\n\todesliStatus: z.enum([\"pending\", \"resolved\", \"failed\"]),\n\tpublishState: z.enum([\"published\", \"unpublished\"]),\n\trenderState: z.enum([\"queued\", \"rendering\", \"rendered\", \"failed\"]),\n\ttakedownStatus: z.enum([\"none\", \"active\", \"resolved\"]),\n\ttheme: z.enum([\"classic\", \"brutalist\", \"aurora\", \"cinematic\"]),\n};\n\nconst SmartLinkSummaryOutputSchema = z\n\t.object({\n\t\tartistHubUrl: z.string(),\n\t\tartistId: z.string(),\n\t\tartistName: z.string(),\n\t\tclaimStatus: SmartLinkStatusSchemas.claimStatus,\n\t\tcreatedAt: z.string(),\n\t\tid: z.string(),\n\t\tisPublic: z.boolean(),\n\t\tlocalizedPublicUrls: z.array(z.string()).optional(),\n\t\todesliStatus: SmartLinkStatusSchemas.odesliStatus,\n\t\tpublicUrl: z.string(),\n\t\tpublishState: SmartLinkStatusSchemas.publishState,\n\t\treleaseSlug: z.string(),\n\t\treleaseTitle: z.string(),\n\t\treleaseType: z.string(),\n\t\trenderState: SmartLinkStatusSchemas.renderState,\n\t\tspotifyUrl: z.string().nullable(),\n\t\ttakedownStatus: SmartLinkStatusSchemas.takedownStatus,\n\t\ttheme: SmartLinkStatusSchemas.theme,\n\t\tupdatedAt: z.string(),\n\t})\n\t.strict();\n\nconst SmartLinkDetailsOutputSchema = SmartLinkSummaryOutputSchema.extend({\n\tactionRequired: z.array(z.string()).optional(),\n\tcustomDescription: z.string().nullable(),\n\tnextActions: z.array(z.string()),\n\toriginalSpotifyUrl: z.string().nullable(),\n\tsummary: z.string(),\n\twarnings: z.array(z.string()).optional(),\n}).strict();\n\nconst ListSmartLinksDataOutputSchema = z\n\t.object({\n\t\tnextCursor: z.string().optional(),\n\t\tsmartLinks: z.array(SmartLinkSummaryOutputSchema),\n\t})\n\t.strict();\n\nconst ListSmartLinksSummaryOutputSchema = z\n\t.object({\n\t\tnextCursor: z.string().optional(),\n\t\tsummary: z.string(),\n\t\ttotalCount: z.number(),\n\t})\n\t.strict();\n\nconst AvailableCountryOutputSchema = z\n\t.object({\n\t\tcode: z.string(),\n\t\tdominantLanguage: z.string().optional(),\n\t\tgoogleAdsId: z.number(),\n\t\tname: z.string(),\n\t})\n\t.strict();\n\nconst ListAvailableCountriesDataOutputSchema = z\n\t.object({\n\t\tcampaignType: z.enum([\"SMART_CAMPAIGN\", \"YOUTUBE\"]),\n\t\tcountries: z.array(AvailableCountryOutputSchema),\n\t\tnextCursor: z.string().optional(),\n\t\tnotes: z.array(z.string()),\n\t\tsource: z.enum([\"SMART_CAMPAIGN_COUNTRIES\", \"GOOGLE_ADS_COUNTRIES\"]),\n\t\ttotalCount: z.number(),\n\t})\n\t.strict();\n\nconst SummaryCountOutputSchema = z\n\t.object({\n\t\tnextCursor: z.string().optional(),\n\t\tsummary: z.string(),\n\t\ttotalCount: z.number(),\n\t})\n\t.strict();\n\nconst SummaryWarningsActionsOutputSchema = z\n\t.object({\n\t\tactionRequired: z.array(z.string()).optional(),\n\t\tsummary: z.string(),\n\t\twarnings: z.array(z.string()).optional(),\n\t})\n\t.strict();\n\nconst NormalizedTargetingOutputSchema = z.union([\n\tz.object({ mode: z.literal(\"GLOBAL\") }).strict(),\n\tz\n\t\t.object({\n\t\t\tcountries: z.array(\n\t\t\t\tz.object({ code: z.string(), name: z.string() }).strict(),\n\t\t\t),\n\t\t\tmode: z.literal(\"COUNTRIES\"),\n\t\t})\n\t\t.strict(),\n]);\n\nconst GetCampaignReadinessDataOutputSchema = z\n\t.object({\n\t\tartistId: z.string(),\n\t\tartistName: z.string(),\n\t\tblockingIssues: z.array(z.string()),\n\t\tcampaignType: z.enum([\"SMART_CAMPAIGN\", \"YOUTUBE\"]),\n\t\tisReady: z.boolean(),\n\t\tmissingInputs: z.array(z.string()),\n\t\tnormalizedTargeting: NormalizedTargetingOutputSchema,\n\t\trecommendedNextAction: z.string(),\n\t\twarnings: z.array(z.string()),\n\t})\n\t.strict();\n\nconst CreateSmartLinkFromSpotifyDataOutputSchema =\n\tSmartLinkDetailsOutputSchema.extend({\n\t\toutcome: z.enum([\"created\", \"existing\"]),\n\t\tworkflowWarning: z.string().nullable(),\n\t}).strict();\n\nconst CreateSmartLinksFromSpotifyArtistDataOutputSchema = z\n\t.object({\n\t\tartistCreatedFromSpotify: z.boolean().optional(),\n\t\tartistHubUrl: z.string(),\n\t\tartistId: z.string(),\n\t\tartistName: z.string(),\n\t\tcatalogImportStatus: z.enum([\"started\", \"start_failed\"]),\n\t\tcurrentSmartLinkCount: z.number(),\n\t\texistingCount: z.number(),\n\t\tinitialSmartLink: SmartLinkSummaryOutputSchema.nullable(),\n\t\tnewlyAvailableCount: z.number(),\n\t\tnextActions: z.array(z.string()),\n\t\tsmartLinks: z.array(SmartLinkSummaryOutputSchema),\n\t\tspotifyArtistUrl: z.string(),\n\t\tsummary: z.string(),\n\t\twarnings: z.array(z.string()).optional(),\n\t})\n\t.strict();\n\nconst LaunchCampaignDataOutputSchema = z\n\t.object({\n\t\tbudget: MoneyDisplayOutputSchema,\n\t\tbudgetType: z.enum([\"DAILY\", \"TOTAL\"]),\n\t\tcampaignType: z.enum([\"SMART_CAMPAIGN\", \"YOUTUBE\"]),\n\t\tcontentTitle: z.string(),\n\t\tdeliveryState: z.enum([\"ACTIVE\", \"PENDING_REVIEW\", \"CONTENT_VALIDATION\"]),\n\t\tid: z.string(),\n\t\tisLive: z.boolean(),\n\t\tnextSteps: z.array(z.string()),\n\t\tplatforms: z.array(z.string()),\n\t\tstatus: z.string(),\n\t\tsummary: z.string(),\n\t\twarnings: z.array(z.string()).optional(),\n\t})\n\t.strict();\n\nexport const AnyOutputEnvelopeSchema = createOutputEnvelopeSchema(\n\tAnyToolDataOutputSchema,\n\t{ allowPartial: true },\n);\n\nexport const ListMediaAssetsOutputEnvelopeSchema = createOutputEnvelopeSchema(\n\tz.union([\n\t\tListMediaAssetsDataOutputSchema,\n\t\tListMediaAssetsSummaryOutputSchema,\n\t]),\n);\n\nexport const LaunchCampaignOutputEnvelopeSchema = createOutputEnvelopeSchema(\n\tLaunchCampaignDataOutputSchema,\n);\n\nexport const ListAvailableCountriesOutputEnvelopeSchema =\n\tcreateOutputEnvelopeSchema(\n\t\tz.union([ListAvailableCountriesDataOutputSchema, SummaryCountOutputSchema]),\n\t);\n\nexport const GetCampaignReadinessOutputEnvelopeSchema =\n\tcreateOutputEnvelopeSchema(\n\t\tz.union([\n\t\t\tGetCampaignReadinessDataOutputSchema,\n\t\t\tSummaryWarningsActionsOutputSchema,\n\t\t]),\n\t);\n\nexport const CreateSmartLinkFromSpotifyOutputEnvelopeSchema =\n\tcreateOutputEnvelopeSchema(CreateSmartLinkFromSpotifyDataOutputSchema);\n\nexport const CreateSmartLinksFromSpotifyArtistOutputEnvelopeSchema =\n\tcreateOutputEnvelopeSchema(CreateSmartLinksFromSpotifyArtistDataOutputSchema);\n\nexport const ListSmartLinksOutputEnvelopeSchema = createOutputEnvelopeSchema(\n\tz.union([ListSmartLinksDataOutputSchema, ListSmartLinksSummaryOutputSchema]),\n);\n",
7
- "import { createRemoteJWKSet, type JWTVerifyOptions, jwtVerify } from \"jose\";\n\ntype VerifiedAccessToken = {\n\tsub: string;\n\tiss: string;\n\taud: string | string[] | undefined;\n\texp: number;\n\tgrantId: string | null;\n\tclientId: string | null;\n\tjti: string | null;\n\tscopes: string[];\n\tsessionId: string | null;\n};\n\ntype VerifyAccessTokenOptions = {\n\talgorithms?: Array<\"ES256\" | \"RS256\">;\n\ttoken: string;\n\tjwksUrl: string;\n\tissuer: string;\n\taudienceAllowlist: string[];\n};\n\nconst jwksByUrl = new Map<string, ReturnType<typeof createRemoteJWKSet>>();\n\nfunction getRemoteJwks(jwksUrl: string) {\n\tconst existing = jwksByUrl.get(jwksUrl);\n\tif (existing) {\n\t\treturn existing;\n\t}\n\tconst created = createRemoteJWKSet(new URL(jwksUrl));\n\tjwksByUrl.set(jwksUrl, created);\n\treturn created;\n}\n\nfunction extractClientId(payload: Record<string, unknown>): string | null {\n\tconst direct = payload[\"client_id\"];\n\tif (typeof direct === \"string\" && direct.trim().length > 0) {\n\t\treturn direct;\n\t}\n\tconst azp = payload[\"azp\"];\n\tif (typeof azp === \"string\" && azp.trim().length > 0) {\n\t\treturn azp;\n\t}\n\treturn null;\n}\n\nfunction extractScopes(payload: Record<string, unknown>): string[] {\n\tconst scope = payload[\"scope\"];\n\tif (typeof scope === \"string\") {\n\t\treturn scope\n\t\t\t.split(/\\s+/)\n\t\t\t.map((part) => part.trim())\n\t\t\t.filter((part) => part.length > 0);\n\t}\n\tconst scopes = payload[\"scopes\"];\n\tif (Array.isArray(scopes)) {\n\t\treturn scopes.filter(\n\t\t\t(scopeValue): scopeValue is string =>\n\t\t\t\ttypeof scopeValue === \"string\" && scopeValue.trim().length > 0,\n\t\t);\n\t}\n\treturn [];\n}\n\nexport async function verifyAccessToken(\n\toptions: VerifyAccessTokenOptions,\n): Promise<VerifiedAccessToken> {\n\tconst jwks = getRemoteJwks(options.jwksUrl);\n\tconst verifyOptions: JWTVerifyOptions = {\n\t\talgorithms: options.algorithms ?? [\"ES256\", \"RS256\"],\n\t\taudience: options.audienceAllowlist,\n\t\tissuer: options.issuer,\n\t};\n\n\tconst { payload } = await jwtVerify(options.token, jwks, verifyOptions);\n\n\tconst sub = typeof payload.sub === \"string\" ? payload.sub : null;\n\tif (!sub) {\n\t\tthrow new Error(\"JWT missing sub\");\n\t}\n\tconst iss = typeof payload.iss === \"string\" ? payload.iss : null;\n\tif (!iss) {\n\t\tthrow new Error(\"JWT missing iss\");\n\t}\n\tconst exp = typeof payload.exp === \"number\" ? payload.exp : null;\n\tif (!exp) {\n\t\tthrow new Error(\"JWT missing exp\");\n\t}\n\tconst aud = payload.aud as string | string[] | undefined;\n\n\treturn {\n\t\taud,\n\t\tclientId: extractClientId(payload as Record<string, unknown>),\n\t\texp,\n\t\tgrantId: typeof payload[\"gid\"] === \"string\" ? payload[\"gid\"] : null,\n\t\tiss,\n\t\tjti: typeof payload.jti === \"string\" ? payload.jti : null,\n\t\tscopes: extractScopes(payload as Record<string, unknown>),\n\t\tsessionId: typeof payload.sid === \"string\" ? payload.sid : null,\n\t\tsub,\n\t};\n}\n",
8
- "import { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport * as z from \"zod/v4\";\nimport {\n\tDYNAMOI_BETTER_AUTH_MCP_SCOPES,\n\tDYNAMOI_MCP_TOOL_SCOPES,\n} from \"../auth/protected-resource\";\nimport type {\n\tCreateSmartLinkFromSpotifyData,\n\tCreateSmartLinksFromSpotifyArtistData,\n\tApplyForDistributionData,\n\tGetArtistAnalyticsJsonData,\n\tGetArtistAnalyticsSummaryData,\n\tGetArtistData,\n\tGetArtistSummaryData,\n\tGetBillingData,\n\tGetBillingSummaryData,\n\tGetCampaignAnalyticsJsonData,\n\tGetCampaignAnalyticsSummaryData,\n\tGetCampaignData,\n\tGetCampaignDeploymentStatusData,\n\tGetCampaignDeploymentStatusSummaryData,\n\tGetCampaignReadinessData,\n\tGetCampaignReadinessSummaryData,\n\tGetCampaignSummaryData,\n\tGetCurrentUserData,\n\tGetCurrentUserSummaryData,\n\tGetDistributionApplicationData,\n\tGetOnboardingStatusData,\n\tGetOnboardingStatusSummaryData,\n\tGetPlatformStatusData,\n\tGetPlatformStatusSummaryData,\n\tGetSmartLinkAnalyticsData,\n\tGetSmartLinkAnalyticsSummaryData,\n\tGetSmartLinkData,\n\tGetSmartLinkSummaryData,\n\tLaunchCampaignData,\n\tListArtistsData,\n\tListArtistsSummaryData,\n\tListAvailableCountriesData,\n\tListAvailableCountriesSummaryData,\n\tListCampaignsJsonData,\n\tListCampaignsSummaryData,\n\tListMediaAssetsData,\n\tListMediaAssetsSummaryData,\n\tListSmartLinksData,\n\tListSmartLinksSummaryData,\n\tPauseResumeCampaignData,\n\tResultEnvelope,\n\tSearchData,\n\tSearchSummaryData,\n\tSmartLinkSettingsData,\n\tStartMetaConnectionData,\n\tStartYoutubeChannelLinkData,\n\tUpdateBudgetData,\n\tUpdateCampaignData,\n\tUpdateSmartLinkArtistSettingsData,\n\tUpdateSmartLinkData,\n} from \"../types\";\nimport { DYNAMOI_MCP_VERSION } from \"../version\";\nimport {\n\tDYNAMOI_CHATGPT_APP_INSTRUCTIONS,\n\tDYNAMOI_MCP_INSTRUCTIONS,\n} from \"./instructions\";\nimport { DISTRIBUTION_TOOL_DEFINITIONS } from \"./distribution-tools\";\nimport type { OpenAiFetchData, OpenAiSearchData } from \"./openai-tools\";\nimport { registerDynamoiPrompts } from \"./prompts\";\nimport { registerDynamoiResources } from \"./resources\";\nimport {\n\tpreviewSmartLinkThemes,\n\tregisterSmartLinkThemePreviewResource,\n\tSMART_LINK_THEME_PREVIEW_RESOURCE_URI,\n\tSMART_LINK_THEME_PREVIEW_TOOL_DEFINITION,\n} from \"./smart-link-theme-preview\";\nimport { PHASE_4_TOOL_DEFINITIONS } from \"./smart-link-tools\";\nimport {\n\tPHASE_1_TOOL_DEFINITIONS,\n\tPHASE_2_TOOL_DEFINITIONS,\n\tPHASE_ONBOARDING_TOOL_DEFINITIONS,\n} from \"./tools\";\nimport { PHASE_3_TOOL_DEFINITIONS } from \"./workflow-tools\";\n\nfunction buildDynamoiToolSecuritySchemes(scopes: readonly string[]) {\n\treturn [{ scopes: [...scopes], type: \"oauth2\" as const }];\n}\n\nconst DescriptiveEntitySchema = z\n\t.object({\n\t\tid: z.string().optional(),\n\t\tname: z.string().optional(),\n\t\tpublicUrl: z.string().optional(),\n\t\tsummary: z.string().optional(),\n\t})\n\t.passthrough();\n\nconst CHATGPT_DESCRIPTIVE_DATA_SCHEMAS = {\n\tdynamoi_get_account_overview: z\n\t\t.object({\n\t\t\tartistCount: z.number().optional(),\n\t\t\tartists: z\n\t\t\t\t.object({\n\t\t\t\t\tcount: z.number(),\n\t\t\t\t\tsummaries: z.array(DescriptiveEntitySchema),\n\t\t\t\t})\n\t\t\t\t.optional(),\n\t\t\torganizationCount: z.number().optional(),\n\t\t\trecommendedNextActions: z.array(z.string()).optional(),\n\t\t\tstate: z.object({}).passthrough().optional(),\n\t\t\tsummary: z.string().optional(),\n\t\t\tuser: z.object({ name: z.string().optional() }).optional(),\n\t\t})\n\t\t.passthrough(),\n\tdynamoi_get_artist_analytics: z\n\t\t.object({\n\t\t\tartistId: z.string().optional(),\n\t\t\tartistName: z.string().optional(),\n\t\t\tdateRange: z.object({ end: z.string(), start: z.string() }).optional(),\n\t\t\tsummary: z.string().optional(),\n\t\t})\n\t\t.passthrough(),\n\tdynamoi_get_campaign: DescriptiveEntitySchema.extend({\n\t\tartistId: z.string().optional(),\n\t\tcontentTitle: z.string().optional(),\n\t\tnextActions: z.array(z.string()).optional(),\n\t\tstatus: z.string().optional(),\n\t}).passthrough(),\n\tdynamoi_get_platform_status: z\n\t\t.object({\n\t\t\tartistId: z.string().optional(),\n\t\t\tartistName: z.string().optional(),\n\t\t\tplatforms: z.object({}).passthrough().optional(),\n\t\t\tsummary: z.string().optional(),\n\t\t})\n\t\t.passthrough(),\n\tdynamoi_get_smart_link: DescriptiveEntitySchema.extend({\n\t\tartistId: z.string().optional(),\n\t\tartistName: z.string().optional(),\n\t\tnextActions: z.array(z.string()).optional(),\n\t\tpublishState: z.string().optional(),\n\t\treleaseTitle: z.string().optional(),\n\t\ttheme: z.string().optional(),\n\t}).passthrough(),\n\tdynamoi_list_artists: z\n\t\t.object({\n\t\t\tartists: z.array(DescriptiveEntitySchema).optional(),\n\t\t\tnextCursor: z.string().optional(),\n\t\t\tsummary: z.string().optional(),\n\t\t\ttotalCount: z.number().optional(),\n\t\t})\n\t\t.passthrough(),\n\tdynamoi_list_campaigns: z\n\t\t.object({\n\t\t\tcampaigns: z.array(DescriptiveEntitySchema).optional(),\n\t\t\tnextCursor: z.string().optional(),\n\t\t\tsummary: z.string().optional(),\n\t\t\ttotalCount: z.number().optional(),\n\t\t})\n\t\t.passthrough(),\n\tdynamoi_preview_smart_link_themes: z\n\t\t.object({\n\t\t\tartistName: z.string(),\n\t\t\treleaseTitle: z.string(),\n\t\t\tthemes: z.array(DescriptiveEntitySchema),\n\t\t})\n\t\t.passthrough(),\n\tdynamoi_search: z\n\t\t.object({\n\t\t\tnextCursor: z.string().optional(),\n\t\t\tresults: z.array(DescriptiveEntitySchema).optional(),\n\t\t\tsummary: z.string().optional(),\n\t\t\ttotalCount: z.number().optional(),\n\t\t})\n\t\t.passthrough(),\n\tdynamoi_update_smart_link: DescriptiveEntitySchema.extend({\n\t\tartistId: z.string().optional(),\n\t\tartistName: z.string().optional(),\n\t\tdefaultTheme: z.string().optional(),\n\t\trenderQueuedCount: z.number().optional(),\n\t\trenderWarning: z.string().nullable().optional(),\n\t}).passthrough(),\n\tfetch: DescriptiveEntitySchema,\n\tsearch: z\n\t\t.object({ results: z.array(DescriptiveEntitySchema).optional() })\n\t\t.passthrough(),\n} as const;\n\nfunction getAdvertisedToolOutputSchema(options: {\n\tcanonical: z.ZodType;\n\ttoolName: string;\n\ttoolProfile: DynamoiMcpToolProfile;\n}) {\n\tif (options.toolProfile !== \"chatgpt-app\") {\n\t\treturn options.canonical;\n\t}\n\tconst dataSchema =\n\t\tCHATGPT_DESCRIPTIVE_DATA_SCHEMAS[\n\t\t\toptions.toolName as keyof typeof CHATGPT_DESCRIPTIVE_DATA_SCHEMAS\n\t\t];\n\tif (!dataSchema) {\n\t\treturn options.canonical;\n\t}\n\treturn z\n\t\t.object({\n\t\t\tdata: dataSchema.optional(),\n\t\t\tkind: z.string().optional(),\n\t\t\tmessage: z.string().optional(),\n\t\t\tstatus: z.enum([\"success\", \"partial_success\", \"error\"]),\n\t\t})\n\t\t.passthrough();\n}\n\nfunction getDynamoiToolOAuthScopes(\n\ttoolName: keyof typeof DYNAMOI_MCP_TOOL_SCOPES,\n\tproviderScopes: readonly string[],\n): readonly string[] {\n\tconst requiredScopes = DYNAMOI_MCP_TOOL_SCOPES[toolName];\n\tif (!providerScopes.some((scope) => scope.startsWith(\"dynamoi:\"))) {\n\t\treturn providerScopes;\n\t}\n\tconst missingScopes = requiredScopes.filter(\n\t\t(scope) => !providerScopes.includes(scope),\n\t);\n\tif (missingScopes.length > 0) {\n\t\tthrow new Error(\n\t\t\t`MCP provider does not support ${toolName} scopes: ${missingScopes.join(\", \")}`,\n\t\t);\n\t}\n\treturn requiredScopes;\n}\n\nexport type DynamoiMcpToolProfile = \"full\" | \"chatgpt-app\";\n\ntype DynamoiToolDefinition =\n\t| (typeof PHASE_1_TOOL_DEFINITIONS)[number]\n\t| (typeof PHASE_ONBOARDING_TOOL_DEFINITIONS)[number]\n\t| (typeof PHASE_2_TOOL_DEFINITIONS)[number]\n\t| (typeof PHASE_3_TOOL_DEFINITIONS)[number]\n\t| (typeof PHASE_4_TOOL_DEFINITIONS)[number]\n\t| (typeof DISTRIBUTION_TOOL_DEFINITIONS)[number]\n\t| typeof SMART_LINK_THEME_PREVIEW_TOOL_DEFINITION;\n\nconst DYNAMOI_TOOL_DEFINITIONS = [\n\t...PHASE_1_TOOL_DEFINITIONS,\n\t...PHASE_ONBOARDING_TOOL_DEFINITIONS,\n\t...PHASE_2_TOOL_DEFINITIONS,\n\t...PHASE_3_TOOL_DEFINITIONS,\n\t...DISTRIBUTION_TOOL_DEFINITIONS,\n\tSMART_LINK_THEME_PREVIEW_TOOL_DEFINITION,\n\t...PHASE_4_TOOL_DEFINITIONS,\n] as const satisfies readonly DynamoiToolDefinition[];\n\nconst CHATGPT_APP_EXCLUDED_TOOL_NAMES = new Set<string>([\n\t\"dynamoi_get_billing\",\n\t\"dynamoi_get_campaign_readiness\",\n\t\"dynamoi_launch_campaign\",\n\t\"dynamoi_list_available_countries\",\n\t\"dynamoi_list_media_assets\",\n\t\"dynamoi_start_meta_connection\",\n\t\"dynamoi_start_youtube_channel_link\",\n\t\"dynamoi_update_campaign\",\n]);\n\nexport function getDynamoiToolDefinitions(options?: {\n\ttoolProfile?: DynamoiMcpToolProfile;\n}): DynamoiToolDefinition[] {\n\tconst definitions = [...DYNAMOI_TOOL_DEFINITIONS];\n\tif ((options?.toolProfile ?? \"full\") !== \"chatgpt-app\") {\n\t\treturn definitions;\n\t}\n\treturn definitions.filter(\n\t\t(definition) => !CHATGPT_APP_EXCLUDED_TOOL_NAMES.has(definition.name),\n\t);\n}\n\nexport type Phase3Adapter = {\n\tapplyForDistribution(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<ApplyForDistributionData>>;\n\tgetCurrentUser(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<GetCurrentUserData | GetCurrentUserSummaryData>>;\n\tgetDistributionApplication(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<GetDistributionApplicationData>>;\n\tlistArtists(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<ListArtistsData | ListArtistsSummaryData>>;\n\tsearch(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<SearchData | SearchSummaryData>>;\n\topenAiSearch(input: unknown): Promise<ResultEnvelope<OpenAiSearchData>>;\n\topenAiFetch(input: unknown): Promise<ResultEnvelope<OpenAiFetchData>>;\n\tgetArtist(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<GetArtistData | GetArtistSummaryData>>;\n\tgetArtistAnalytics(\n\t\tinput: unknown,\n\t): Promise<\n\t\tResultEnvelope<GetArtistAnalyticsJsonData | GetArtistAnalyticsSummaryData>\n\t>;\n\tlistCampaigns(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<ListCampaignsJsonData | ListCampaignsSummaryData>>;\n\tgetCampaign(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<GetCampaignData | GetCampaignSummaryData>>;\n\tgetCampaignAnalytics(\n\t\tinput: unknown,\n\t): Promise<\n\t\tResultEnvelope<\n\t\t\tGetCampaignAnalyticsJsonData | GetCampaignAnalyticsSummaryData\n\t\t>\n\t>;\n\tgetBilling(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<GetBillingData | GetBillingSummaryData>>;\n\tstartMetaConnection(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<StartMetaConnectionData>>;\n\tgetPlatformStatus(\n\t\tinput: unknown,\n\t): Promise<\n\t\tResultEnvelope<GetPlatformStatusData | GetPlatformStatusSummaryData>\n\t>;\n\tstartYoutubeChannelLink(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<StartYoutubeChannelLinkData>>;\n\tlistAvailableCountries(\n\t\tinput: unknown,\n\t): Promise<\n\t\tResultEnvelope<\n\t\t\tListAvailableCountriesData | ListAvailableCountriesSummaryData\n\t\t>\n\t>;\n\tgetOnboardingStatus(\n\t\tinput: unknown,\n\t): Promise<\n\t\tResultEnvelope<GetOnboardingStatusData | GetOnboardingStatusSummaryData>\n\t>;\n\tgetCampaignReadiness(\n\t\tinput: unknown,\n\t): Promise<\n\t\tResultEnvelope<GetCampaignReadinessData | GetCampaignReadinessSummaryData>\n\t>;\n\tgetCampaignDeploymentStatus(\n\t\tinput: unknown,\n\t): Promise<\n\t\tResultEnvelope<\n\t\t\tGetCampaignDeploymentStatusData | GetCampaignDeploymentStatusSummaryData\n\t\t>\n\t>;\n\n\tpauseCampaign(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<PauseResumeCampaignData>>;\n\tresumeCampaign(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<PauseResumeCampaignData>>;\n\tupdateBudget(input: unknown): Promise<ResultEnvelope<UpdateBudgetData>>;\n\tupdateCampaign(input: unknown): Promise<ResultEnvelope<UpdateCampaignData>>;\n\n\tlistMediaAssets(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<ListMediaAssetsData | ListMediaAssetsSummaryData>>;\n\tlaunchCampaign(input: unknown): Promise<ResultEnvelope<LaunchCampaignData>>;\n\tcreateSmartLinkFromSpotify(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<CreateSmartLinkFromSpotifyData>>;\n\tcreateSmartLinksFromSpotifyArtist(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<CreateSmartLinksFromSpotifyArtistData>>;\n\tlistSmartLinks(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<ListSmartLinksData | ListSmartLinksSummaryData>>;\n\tgetSmartLink(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<GetSmartLinkData | GetSmartLinkSummaryData>>;\n\tgetSmartLinkAnalytics(\n\t\tinput: unknown,\n\t): Promise<\n\t\tResultEnvelope<GetSmartLinkAnalyticsData | GetSmartLinkAnalyticsSummaryData>\n\t>;\n\tgetSmartLinkArtistSettings(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<SmartLinkSettingsData>>;\n\tupdateSmartLink(\n\t\tinput: unknown,\n\t): Promise<\n\t\tResultEnvelope<UpdateSmartLinkData | UpdateSmartLinkArtistSettingsData>\n\t>;\n\tupdateSmartLinkArtistSettings(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<UpdateSmartLinkArtistSettingsData>>;\n};\n\ntype DynamoiToolName = (typeof DYNAMOI_TOOL_DEFINITIONS)[number][\"name\"];\ntype DynamoiToolDispatcher = (\n\tadapter: Phase3Adapter,\n\tinput: unknown,\n) => Promise<ResultEnvelope<unknown>>;\n\nconst DYNAMOI_TOOL_DISPATCHERS = {\n\tdynamoi_apply_for_distribution: (adapter, input) =>\n\t\tadapter.applyForDistribution(input),\n\tdynamoi_create_smart_link_from_spotify: (adapter, input) =>\n\t\tadapter.createSmartLinkFromSpotify(input),\n\tdynamoi_create_smart_links_from_spotify_artist: (adapter, input) =>\n\t\tadapter.createSmartLinksFromSpotifyArtist(input),\n\tdynamoi_get_account_overview: (adapter, input) =>\n\t\tadapter.getCurrentUser(input),\n\tdynamoi_get_artist_analytics: (adapter, input) =>\n\t\tadapter.getArtistAnalytics(input),\n\tdynamoi_get_billing: (adapter, input) => adapter.getBilling(input),\n\tdynamoi_get_campaign: (adapter, input) => adapter.getCampaign(input),\n\tdynamoi_get_campaign_readiness: (adapter, input) =>\n\t\tadapter.getCampaignReadiness(input),\n\tdynamoi_get_distribution_application: (adapter, input) =>\n\t\tadapter.getDistributionApplication(input),\n\tdynamoi_get_platform_status: (adapter, input) =>\n\t\tadapter.getPlatformStatus(input),\n\tdynamoi_get_smart_link: (adapter, input) => adapter.getSmartLink(input),\n\tdynamoi_launch_campaign: (adapter, input) => adapter.launchCampaign(input),\n\tdynamoi_list_artists: (adapter, input) => adapter.listArtists(input),\n\tdynamoi_list_available_countries: (adapter, input) =>\n\t\tadapter.listAvailableCountries(input),\n\tdynamoi_list_campaigns: (adapter, input) => adapter.listCampaigns(input),\n\tdynamoi_list_media_assets: (adapter, input) => adapter.listMediaAssets(input),\n\tdynamoi_list_smart_links: (adapter, input) => adapter.listSmartLinks(input),\n\tdynamoi_preview_smart_link_themes: (_adapter, input) =>\n\t\tPromise.resolve(previewSmartLinkThemes(input)),\n\tdynamoi_search: (adapter, input) => adapter.search(input),\n\tdynamoi_start_meta_connection: (adapter, input) =>\n\t\tadapter.startMetaConnection(input),\n\tdynamoi_start_youtube_channel_link: (adapter, input) =>\n\t\tadapter.startYoutubeChannelLink(input),\n\tdynamoi_update_campaign: (adapter, input) => adapter.updateCampaign(input),\n\tdynamoi_update_smart_link: (adapter, input) => adapter.updateSmartLink(input),\n\tfetch: (adapter, input) => adapter.openAiFetch(input),\n\tsearch: (adapter, input) => adapter.openAiSearch(input),\n} satisfies Record<DynamoiToolName, DynamoiToolDispatcher>;\n\nexport function asTextResult(envelope: unknown) {\n\tconst isToolError =\n\t\tBoolean(envelope) &&\n\t\ttypeof envelope === \"object\" &&\n\t\t(envelope as { status?: unknown }).status === \"error\";\n\tconst plainText = (() => {\n\t\tif (!envelope || typeof envelope !== \"object\") {\n\t\t\treturn JSON.stringify(envelope);\n\t\t}\n\n\t\tconst status = (envelope as { status?: unknown }).status;\n\t\tif (status === \"error\") {\n\t\t\tconst message = (envelope as { message?: unknown }).message;\n\t\t\treturn typeof message === \"string\" && message.trim().length > 0\n\t\t\t\t? message\n\t\t\t\t: JSON.stringify(envelope);\n\t\t}\n\n\t\tconst data = (envelope as { data?: unknown }).data;\n\t\tif (data && typeof data === \"object\") {\n\t\t\tconst summary = (data as { summary?: unknown }).summary;\n\t\t\tif (typeof summary === \"string\" && summary.trim().length > 0) {\n\t\t\t\treturn summary;\n\t\t\t}\n\t\t}\n\n\t\treturn JSON.stringify(envelope);\n\t})();\n\n\tconst result: {\n\t\tcontent: Array<{ text: string; type: \"text\" }>;\n\t\tstructuredContent: Record<string, unknown>;\n\t\tisError?: boolean;\n\t} = {\n\t\tcontent: [{ text: plainText, type: \"text\" as const }],\n\t\tstructuredContent: envelope as Record<string, unknown>,\n\t};\n\tif (isToolError) {\n\t\tresult.isError = true;\n\t}\n\n\treturn result;\n}\n\nexport function asValidatedTextResult(options: {\n\tenvelope: unknown;\n\toutputSchema: z.ZodType;\n\ttoolName: string;\n}) {\n\tconst parsed = options.outputSchema.safeParse(options.envelope);\n\tif (!parsed.success) {\n\t\treturn asTextResult({\n\t\t\tkind: \"validation\",\n\t\t\tmessage: `Tool ${options.toolName} returned an invalid result shape.`,\n\t\t\tstatus: \"error\",\n\t\t} satisfies ResultEnvelope<never>);\n\t}\n\treturn asTextResult(options.envelope);\n}\n\nexport function createDynamoiMcpServer(options: {\n\tadapter: Phase3Adapter;\n\tonToolCall?: (input: {\n\t\tdurationMs: number;\n\t\terror?: unknown;\n\t\tresult?: unknown;\n\t\ttoolName: string;\n\t}) => Promise<void> | void;\n\toauthScopes?: readonly string[];\n\ttoolProfile?: DynamoiMcpToolProfile;\n\twebsiteUrl?: string;\n}): McpServer {\n\tconst toolProfile = options.toolProfile ?? \"full\";\n\tconst server = new McpServer(\n\t\t{\n\t\t\tname: \"dynamoi\",\n\t\t\tversion: DYNAMOI_MCP_VERSION,\n\t\t\twebsiteUrl: options.websiteUrl ?? \"https://dynamoi.com\",\n\t\t},\n\t\t{\n\t\t\tinstructions:\n\t\t\t\ttoolProfile === \"chatgpt-app\"\n\t\t\t\t\t? DYNAMOI_CHATGPT_APP_INSTRUCTIONS\n\t\t\t\t\t: DYNAMOI_MCP_INSTRUCTIONS,\n\t\t},\n\t);\n\n\tfor (const def of getDynamoiToolDefinitions({ toolProfile })) {\n\t\tconst title = def.title;\n\t\tconst dispatcher = DYNAMOI_TOOL_DISPATCHERS[def.name];\n\t\tconst idempotentHint =\n\t\t\t\"idempotentHint\" in def && typeof def.idempotentHint === \"boolean\"\n\t\t\t\t? def.idempotentHint\n\t\t\t\t: undefined;\n\t\tconst meta: Record<string, unknown> = {\n\t\t\tsecuritySchemes: buildDynamoiToolSecuritySchemes(\n\t\t\t\tgetDynamoiToolOAuthScopes(\n\t\t\t\t\tdef.name,\n\t\t\t\t\toptions.oauthScopes ?? DYNAMOI_BETTER_AUTH_MCP_SCOPES,\n\t\t\t\t),\n\t\t\t),\n\t\t};\n\t\tif (def.name === \"dynamoi_preview_smart_link_themes\") {\n\t\t\tmeta[\"openai/outputTemplate\"] = SMART_LINK_THEME_PREVIEW_RESOURCE_URI;\n\t\t\tmeta[\"ui\"] = { resourceUri: SMART_LINK_THEME_PREVIEW_RESOURCE_URI };\n\t\t}\n\t\tconst annotations: Record<string, unknown> = {\n\t\t\tdestructiveHint: def.destructiveHint,\n\t\t\topenWorldHint: def.openWorldHint,\n\t\t\treadOnlyHint: def.readOnlyHint,\n\t\t};\n\t\tif (typeof idempotentHint === \"boolean\") {\n\t\t\tannotations[\"idempotentHint\"] = idempotentHint;\n\t\t}\n\t\tserver.registerTool(\n\t\t\tdef.name,\n\t\t\t{\n\t\t\t\t_meta: meta,\n\t\t\t\tannotations,\n\t\t\t\tdescription: def.description,\n\t\t\t\tinputSchema: def.schema,\n\t\t\t\toutputSchema: getAdvertisedToolOutputSchema({\n\t\t\t\t\tcanonical: def.outputSchema,\n\t\t\t\t\ttoolName: def.name,\n\t\t\t\t\ttoolProfile,\n\t\t\t\t}),\n\t\t\t\ttitle,\n\t\t\t},\n\t\t\tasync (input: unknown) => {\n\t\t\t\tconst startedAt = Date.now();\n\t\t\t\ttry {\n\t\t\t\t\tconst envelope = await dispatcher(options.adapter, input);\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait options.onToolCall?.({\n\t\t\t\t\t\t\tdurationMs: Date.now() - startedAt,\n\t\t\t\t\t\t\tresult: envelope,\n\t\t\t\t\t\t\ttoolName: def.name,\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t// Observability must never change a tool result.\n\t\t\t\t\t}\n\t\t\t\t\treturn asValidatedTextResult({\n\t\t\t\t\t\tenvelope,\n\t\t\t\t\t\toutputSchema: def.outputSchema,\n\t\t\t\t\t\ttoolName: def.name,\n\t\t\t\t\t});\n\t\t\t\t} catch (error) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait options.onToolCall?.({\n\t\t\t\t\t\t\tdurationMs: Date.now() - startedAt,\n\t\t\t\t\t\t\terror,\n\t\t\t\t\t\t\ttoolName: def.name,\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t// Preserve the dispatcher failure when observability also fails.\n\t\t\t\t\t}\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t},\n\t\t);\n\t}\n\n\tregisterSmartLinkThemePreviewResource(server);\n\n\tif (toolProfile === \"full\") {\n\t\tregisterDynamoiPrompts(server);\n\t\tregisterDynamoiResources(server, options.adapter);\n\t}\n\n\treturn server;\n}\n",
9
- "// This identifier is replaced at build time by the package build script.\n// The source fallback keeps dashboard runtime imports from leaking a placeholder.\ndeclare const __DYNAMOI_MCP_VERSION__: string | undefined;\n\nconst BUNDLED_DYNAMOI_MCP_VERSION =\n\ttypeof __DYNAMOI_MCP_VERSION__ === \"string\" ? __DYNAMOI_MCP_VERSION__ : \"\";\n\nexport const DYNAMOI_MCP_VERSION =\n\tBUNDLED_DYNAMOI_MCP_VERSION.length > 0 &&\n\t!BUNDLED_DYNAMOI_MCP_VERSION.includes(\"__\")\n\t\t? BUNDLED_DYNAMOI_MCP_VERSION\n\t\t: \"0.7.1\";\n",
10
- "export const DYNAMOI_MCP_INSTRUCTIONS = `\nYou are operating Dynamoi's tools on behalf of the authenticated user. Dynamoi helps\nartists and labels create music-promotion campaigns, build Smart Links, review analytics,\nand apply for music distribution. YouTube creators can grow channels through managed\nGoogle ad campaigns. Smart Links are free to create and manage. High-popularity\nor unverifiable artist links may stay unpublished in verification hold until Dynamoi\ncan verify the client relationship. Managed advertising and ad budgets are separate\npaid campaign services.\n\n=== Session Start Routine ===\n\nWhen the user's first message in a Dynamoi session is account-relevant (artists, campaigns, smart links, analytics, distribution, billing, connections, launches, or \"what should I do here\"), call dynamoi_get_account_overview first to learn the user's state. The response includes a recommendedNextActions array and a state object — treat that array as authoritative guidance for what to ask or do next.\n\nRoute by state from dynamoi_get_account_overview:\n\n- state.hasAnyArtist === false: This is a brand-new user. Ask whether they are a Spotify artist, a YouTube creator, or a label/manager.\n - Spotify artist with a URL → call dynamoi_create_smart_links_from_spotify_artist immediately to create their free hub. Read dynamoi://playbooks/spotify-artist for scripted phrasing.\n - YouTube creator → read dynamoi://playbooks/youtube-creator and explain Dynamoi's revenue-per-view optimization advantage before asking whether they want to link the channel. If yes, call dynamoi_start_youtube_channel_link.\n - Label or manager with a roster → read dynamoi://playbooks/label-or-manager for the multi-artist setup walkthrough.\n\n- state.hasAnyArtist === true && state.hasAnySmartLink === false: The fastest visible win is a free Smart Link. Offer dynamoi_create_smart_link_from_spotify (single release) or dynamoi_create_smart_links_from_spotify_artist (full catalog) before campaign tools.\n\n- state.hasAnyArtist === true && state.hasAnyActiveCampaign === false: Offer dynamoi_get_campaign_readiness to validate launch inputs without creating anything.\n\n- state.hasAnyArtist === true && billing blocks a launch: tell the user managed-advertising billing setup must happen in the Dynamoi dashboard, not through a ChatGPT checkout link. After they start or restore billing there, poll dynamoi_get_billing for the target artist to confirm billing is active.\n\n- state.hasAnyArtist === true && state.hasAnyConnectedMeta === false and the user wants Spotify Smart Campaigns: only offer dynamoi_start_meta_connection after billing is active. If the tool returns billing_required, route the user to dashboard billing first. If it returns billing_check_unavailable, retry shortly instead of treating the user as unpaid. After Meta browser return, poll dynamoi_get_platform_status for the target artist with the returned onboardingAttemptId and onboardingFlow=meta. Treat platforms.meta.status as complete when it is oauth_complete, partnership_pending, or partnership_active.\n\n- state.hasAnyArtist === true && state.hasAnyConnectedYoutube === false and the user wants YouTube growth: offer dynamoi_start_youtube_channel_link, then poll dynamoi_get_platform_status for the target artist with the returned onboardingAttemptId and onboardingFlow=youtube after the browser return page sends them back to chat. Treat the connection as complete when platforms.youtube.connected is true.\n\nDo NOT call dynamoi_list_artists or dynamoi_search as a first step for brand-new users — both will return empty for them and the conversation stalls. Always go through dynamoi_get_account_overview first.\n\n=== End Session Start Routine ===\n\nPrinciples:\n- Be accurate. If uncertain, ask a clarifying question before acting.\n- 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.\n- 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.\n- 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.\n- \\`dynamoi_get_account_overview\\` is the first call for account-relevant session starts and explicit account-overview questions. Do not use it as a zero-context scout before answering unrelated prompts.\n- Never claim you changed something unless the tool returned status \"success\" or\n \"partial_success\".\n- Prefer read tools first before write tools. For writes, confirm intent and restate\n what will change.\n- After a successful write tool call, answer directly from the returned record instead of chaining more tools just to restate the result.\n- If you truly need a follow-up read after a successful write, use format=summary when available and then stop to answer the user.\n- When a user asks for a daily breakdown, pass granularity=DAILY on the analytics tool call.\n- When a user asks for a written rollup, strongest campaign, or review-ready analytics summary, prefer format=summary on the analytics tool call.\n- If a read tool already returned the requested answer in summary form, answer the user directly instead of chaining more read tools.\n- 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_links_from_spotify_artist for Spotify artist URLs when the user wants the artist hub, full catalog, or all Smart Links. Use dynamoi_create_smart_link_from_spotify for a single album or track URL. Do not imply that creating a Smart Link creates a paid campaign.\n- When answering from Smart Link tools, lead with the artist hub URL when present, then public release URLs, release title, artist name, status, and next action. Do not include internal UUIDs unless the user explicitly asks for IDs or you need an ID for a follow-up tool call.\n- Smart Link pixel tools accept validated pixel IDs only. Do not ask for arbitrary JavaScript, tag-manager snippets, or script code.\n- When the user asks about music distribution, call dynamoi_get_distribution_application before making eligibility claims. Treat its five scored requirements as authoritative. Applicant country, tax-residency country, payout country, and the adult signer attestation are required submission fields, but they are not additional eligibility-score requirements.\n- For missing Meta or YouTube distribution identity, use purpose=distribution_identity on the relevant connection tool when that tool is available. These least-privilege identity flows do not require advertising billing. Never substitute the advertising flow.\n- Call dynamoi_apply_for_distribution only after the user explicitly asks to submit, confirms the application, provides all required country fields, and attests that the signer is an adult. Submission starts manual review; it never implies approval, agreement acceptance, release submission, rights clearance, store delivery, royalty setup, or payout readiness.\n- Money values are shown in USD as presented in Dynamoi.\n- Budget minimums: $10/day (daily), $50 total (Smart Campaign), $50 total (YouTube).\n- Product and pricing details are available as MCP resources. Keep runtime answers\n focused on the user's account data and requested action.\n\nCommon workflows:\n- Discovery: dynamoi_list_artists → dynamoi_list_campaigns → dynamoi_get_campaign →\n dynamoi_get_campaign with includeAnalytics=true when needed\n- 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.\n- Diagnose stuck campaign: dynamoi_get_campaign → dynamoi_get_platform_status →\n propose next steps\n- Pause/resume: dynamoi_get_campaign (confirm) → dynamoi_update_campaign with action=pause or action=resume\n- Budget update: dynamoi_get_campaign (confirm) → dynamoi_update_campaign with action=update_budget\n- Launch: dynamoi_list_media_assets → dynamoi_launch_campaign\n- Free Smart Link artist catalog creation: dynamoi_create_smart_links_from_spotify_artist; omit artistId for a brand-new user with no Dynamoi artist yet\n- Free Smart Link single-release creation: dynamoi_list_artists → dynamoi_create_smart_link_from_spotify\n- Smart Link analytics/settings: dynamoi_list_smart_links → dynamoi_get_smart_link with includeAnalytics=true or includeArtistSettings=true\n- Distribution: dynamoi_get_distribution_application → satisfy missing identity requirements with purpose=distribution_identity when available → collect required country fields and adult attestation → explicit confirmation → dynamoi_apply_for_distribution\n- 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.\n- 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.\n`.trim();\n\nexport const DYNAMOI_CHATGPT_APP_INSTRUCTIONS = `\nYou are operating Dynamoi's ChatGPT app tools on behalf of the authenticated user.\nDynamoi helps artists and labels create music-promotion assets, review campaign and\nSmart Link analytics, and check or submit music-distribution applications from ChatGPT.\n\nThis ChatGPT app surface is review-safe and does not start billing, external OAuth\nconnections, campaign launches, campaign budget changes, or direct purchase flows.\nWhen the user asks to buy, subscribe, launch a paid campaign, connect Meta or YouTube,\nor change a live campaign, explain that those steps happen in the Dynamoi dashboard.\nUse the available read tools afterward to check existing status, analytics, and setup\nstate.\n\nPrinciples:\n- Answer general marketing, songwriting, lyrics, or social-media advice natively\n unless the user explicitly asks about their Dynamoi account, artists, campaigns,\n analytics, or Smart Links.\n- Do not call Dynamoi tools just to \"check context\" for generic advice.\n- For account questions, use dynamoi_get_account_overview first.\n- For artist rosters, use dynamoi_list_artists.\n- For existing campaigns, use dynamoi_list_campaigns, dynamoi_get_campaign, and\n dynamoi_get_artist_analytics. These tools are read-only.\n- For music distribution, use dynamoi_get_distribution_application to explain the exact\n five requirements and current application status. Use dynamoi_apply_for_distribution\n only after explicit user confirmation and complete country/adult-attestation fields.\n An application starts manual review and never guarantees approval or distributes a release.\n- For free Smart Links, use dynamoi_create_smart_link_from_spotify,\n dynamoi_create_smart_links_from_spotify_artist, dynamoi_list_smart_links,\n dynamoi_get_smart_link, and dynamoi_update_smart_link.\n- When reading Smart Links, set includeAnalytics=true for visit/click analytics and\n includeArtistSettings=true for artist-level theme or pixel settings.\n- Smart Link pixel tools accept validated pixel IDs only. Do not ask for arbitrary\n JavaScript, tag-manager snippets, or script code.\n- Never claim you changed something unless the tool returned status \"success\" or\n \"partial_success\".\n- For writes, confirm intent and restate what will change.\n- After a successful write tool call, answer directly from the returned record instead\n of chaining more tools just to restate the result.\n- When answering from Smart Link tools, lead with the artist hub URL when present,\n then public release URLs, release title, artist name, status, and next action. Do\n not include internal UUIDs unless the user explicitly asks for IDs or you need an ID\n for a follow-up tool call.\n`.trim();\n",
11
- "import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport * as z from \"zod/v4\";\n\nfunction asTextPrompt(text: string) {\n\treturn {\n\t\tmessages: [\n\t\t\t{\n\t\t\t\tcontent: { text, type: \"text\" as const },\n\t\t\t\trole: \"user\" as const,\n\t\t\t},\n\t\t],\n\t};\n}\n\nexport function registerDynamoiPrompts(server: McpServer) {\n\tserver.registerPrompt(\n\t\t\"dynamoi_find_smart_link_url\",\n\t\t{\n\t\t\targsSchema: {\n\t\t\t\tartistId: z.string().uuid().optional(),\n\t\t\t\tquery: z.string().trim().optional(),\n\t\t\t},\n\t\t\tdescription:\n\t\t\t\t\"Find a user's free Smart Link URL and answer with public URLs, titles, and statuses.\",\n\t\t\ttitle: \"Find Smart Link URL\",\n\t\t},\n\t\t(args) =>\n\t\t\tasTextPrompt(\n\t\t\t\t[\n\t\t\t\t\t\"Find my Dynamoi Smart Link URL.\",\n\t\t\t\t\targs.artistId\n\t\t\t\t\t\t? `Artist ID: ${args.artistId}`\n\t\t\t\t\t\t: \"If no artistId is provided, use dynamoi_search or dynamoi_list_artists to identify the artist first.\",\n\t\t\t\t\targs.query ? `Search query: ${args.query}` : \"\",\n\t\t\t\t\t\"\",\n\t\t\t\t\t\"Use dynamoi_list_smart_links or dynamoi_search with type=smartlink.\",\n\t\t\t\t\t\"In the final answer, show the release title, artist, public URL, and status. Do not show internal IDs unless I ask for them.\",\n\t\t\t\t]\n\t\t\t\t\t.filter(Boolean)\n\t\t\t\t\t.join(\"\\n\"),\n\t\t\t),\n\t);\n\n\tserver.registerPrompt(\n\t\t\"dynamoi_explain_free_smart_links\",\n\t\t{\n\t\t\targsSchema: {},\n\t\t\tdescription:\n\t\t\t\t\"Explain Dynamoi free Smart Links and how they differ from paid managed advertising.\",\n\t\t\ttitle: \"Explain Free Smart Links\",\n\t\t},\n\t\t() =>\n\t\t\tasTextPrompt(\n\t\t\t\t[\n\t\t\t\t\t\"Explain Dynamoi free Smart Links.\",\n\t\t\t\t\t\"Use MCP resources if needed, especially dynamoi://smart-links/free-plan and dynamoi://business/free-vs-paid.\",\n\t\t\t\t\t\"Be clear: Smart Links are free to create and manage. High-popularity or unverifiable artist links may require verification before public publishing. Managed advertising and ad budgets are separate paid services.\",\n\t\t\t\t\t\"Do not inspect my account data unless I ask about my artists, links, campaigns, billing, or settings.\",\n\t\t\t\t].join(\"\\n\"),\n\t\t\t),\n\t);\n\n\tserver.registerPrompt(\n\t\t\"dynamoi_create_free_smart_link\",\n\t\t{\n\t\t\targsSchema: {\n\t\t\t\tartistId: z.string().uuid().optional(),\n\t\t\t\tspotifyUrl: z.string().trim().optional(),\n\t\t\t},\n\t\t\tdescription:\n\t\t\t\t\"Create free Smart Links from a Spotify artist, album, or track URL.\",\n\t\t\ttitle: \"Create Free Smart Link\",\n\t\t},\n\t\t(args) =>\n\t\t\tasTextPrompt(\n\t\t\t\t[\n\t\t\t\t\t\"Create a free Dynamoi Smart Link.\",\n\t\t\t\t\targs.artistId\n\t\t\t\t\t\t? `Artist ID: ${args.artistId}`\n\t\t\t\t\t\t: \"If no artistId is provided, list artists first and ask me which artist owns the link.\",\n\t\t\t\t\targs.spotifyUrl\n\t\t\t\t\t\t? `Spotify URL: ${args.spotifyUrl}`\n\t\t\t\t\t\t: \"Ask me for a Spotify artist, album, or track URL. Playlist URLs are not supported today.\",\n\t\t\t\t\t\"\",\n\t\t\t\t\t\"Smart Links are free to create and manage. High-popularity or unverifiable artist links may require verification before public publishing. This does not create a paid campaign.\",\n\t\t\t\t\t\"If the Spotify URL is an artist URL and I want my hub/catalog, use dynamoi_create_smart_links_from_spotify_artist. If it is an album or track URL, use dynamoi_create_smart_link_from_spotify.\",\n\t\t\t\t].join(\"\\n\"),\n\t\t\t),\n\t);\n\n\tserver.registerPrompt(\n\t\t\"dynamoi_audit_campaigns\",\n\t\t{\n\t\t\targsSchema: {\n\t\t\t\tartistId: z.string().uuid().optional(),\n\t\t\t},\n\t\t\tdescription:\n\t\t\t\t\"Audit an artist's campaigns and summarize what is working and what to fix next.\",\n\t\t\ttitle: \"Audit Campaigns\",\n\t\t},\n\t\t(args) =>\n\t\t\tasTextPrompt(\n\t\t\t\t[\n\t\t\t\t\t\"Audit my campaigns in Dynamoi.\",\n\t\t\t\t\targs.artistId\n\t\t\t\t\t\t? `Artist ID: ${args.artistId}`\n\t\t\t\t\t\t: \"If no artistId is provided, start by listing artists and ask me which one to audit.\",\n\t\t\t\t\t\"\",\n\t\t\t\t\t\"Steps:\",\n\t\t\t\t\t\"1. Use dynamoi_list_campaigns and dynamoi_get_campaign with includeAnalytics=true for the last 7-14 days when one campaign needs a deeper read.\",\n\t\t\t\t\t\"2. Identify any campaigns that are paused, failed, or stuck in a pre-active state and explain why using dynamoi_get_campaign and dynamoi_get_platform_status.\",\n\t\t\t\t\t\"3. Recommend 3-5 next actions with clear priorities.\",\n\t\t\t\t].join(\"\\n\"),\n\t\t\t),\n\t);\n\n\tserver.registerPrompt(\n\t\t\"dynamoi_release_launch_plan\",\n\t\t{\n\t\t\targsSchema: {\n\t\t\t\tartistId: z.string().uuid().optional(),\n\t\t\t\tcontentTitle: z.string().trim().optional(),\n\t\t\t\tcontentType: z.enum([\"TRACK\", \"ALBUM\", \"PLAYLIST\", \"VIDEO\"]).optional(),\n\t\t\t},\n\t\t\tdescription:\n\t\t\t\t\"Create a pragmatic release launch plan and propose a Dynamoi campaign setup.\",\n\t\t\ttitle: \"Release Launch Plan\",\n\t\t},\n\t\t(args) =>\n\t\t\tasTextPrompt(\n\t\t\t\t[\n\t\t\t\t\t\"Help me plan a release launch using Dynamoi.\",\n\t\t\t\t\targs.artistId\n\t\t\t\t\t\t? `Artist ID: ${args.artistId}`\n\t\t\t\t\t\t: \"If no artistId is provided, list artists first.\",\n\t\t\t\t\targs.contentType ? `Content type: ${args.contentType}` : \"\",\n\t\t\t\t\targs.contentTitle ? `Title: ${args.contentTitle}` : \"\",\n\t\t\t\t\t\"\",\n\t\t\t\t\t\"Ask any missing questions first (links, creative, budget, countries, dates).\",\n\t\t\t\t\t\"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.\",\n\t\t\t\t\t\"When those review/demo fields are omitted, do not invent placeholder spotifyUrl or endDate values; omit them and let Dynamoi infer them.\",\n\t\t\t\t\t\"Then propose the simplest campaign plan that fits today’s supported platforms:\",\n\t\t\t\t\t\"- Smart Campaign (Meta) for Spotify/Apple Music releases\",\n\t\t\t\t\t\"- YouTube campaign for videos\",\n\t\t\t\t\t\"\",\n\t\t\t\t\t\"If we proceed to launch:\",\n\t\t\t\t\t\"- For Smart Campaign: use dynamoi_list_media_assets and then dynamoi_launch_campaign.\",\n\t\t\t\t\t\"- For YouTube: use dynamoi_launch_campaign with youtubeVideoId.\",\n\t\t\t\t]\n\t\t\t\t\t.filter(Boolean)\n\t\t\t\t\t.join(\"\\n\"),\n\t\t\t),\n\t);\n\n\tserver.registerPrompt(\n\t\t\"dynamoi_why_campaign_blocked\",\n\t\t{\n\t\t\targsSchema: {\n\t\t\t\tcampaignId: z.string().uuid(),\n\t\t\t},\n\t\t\tdescription:\n\t\t\t\t\"Diagnose why a campaign is blocked/stuck and recommend the next fix.\",\n\t\t\ttitle: \"Why Is My Campaign Blocked?\",\n\t\t},\n\t\t(args) =>\n\t\t\tasTextPrompt(\n\t\t\t\t[\n\t\t\t\t\t\"My campaign seems blocked or stuck. Diagnose it and tell me what to do next.\",\n\t\t\t\t\t`Campaign ID: ${args.campaignId}`,\n\t\t\t\t\t\"\",\n\t\t\t\t\t\"Steps:\",\n\t\t\t\t\t\"1. Use dynamoi_get_campaign with includeDeploymentStatus=true to inspect current status and blockers.\",\n\t\t\t\t\t\"2. Use dynamoi_get_platform_status for the artist to check Meta/Google connection state.\",\n\t\t\t\t\t\"3. If appropriate, suggest safe next actions and confirm before calling dynamoi_update_campaign.\",\n\t\t\t\t].join(\"\\n\"),\n\t\t\t),\n\t);\n}\n",
12
- "import {\n\ttype McpServer,\n\tResourceTemplate,\n} from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport * as z from \"zod/v4\";\nimport type { Phase3Adapter } from \"./create-server\";\nimport { registerPlaybookResources } from \"./playbook-resources\";\n\nexport function registerDynamoiResources(\n\tserver: McpServer,\n\tadapter: Phase3Adapter,\n) {\n\t// Static resources (small, cache-friendly reference data)\n\tserver.registerResource(\n\t\t\"platform-pricing\",\n\t\t\"dynamoi://platform/pricing\",\n\t\t{\n\t\t\tdescription:\n\t\t\t\t\"Dynamoi campaign setup guidance and campaign budget minimums.\",\n\t\t\tmimeType: \"application/json\",\n\t\t\ttitle: \"Pricing\",\n\t\t},\n\t\tasync (uri) => ({\n\t\t\tcontents: [\n\t\t\t\t{\n\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\t\tbudgetMinimums: {\n\t\t\t\t\t\t\tsmartCampaign: {\n\t\t\t\t\t\t\t\tdailyUsd: 10,\n\t\t\t\t\t\t\t\tnote: \"Meta Ads for Spotify promotion\",\n\t\t\t\t\t\t\t\ttotalUsd: 50,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyoutube: {\n\t\t\t\t\t\t\t\tdailyUsd: 10,\n\t\t\t\t\t\t\t\tnote: \"Google Ads for YouTube channel growth\",\n\t\t\t\t\t\t\t\ttotalUsd: 50,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tincludes:\n\t\t\t\t\t\t\t\"Free Smart Links, unlimited team seats, unlimited artists, white-glove support, and campaign landing-page support where available\",\n\t\t\t\t\t\tmanagedAdvertising: {\n\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\"Managed advertising subscription and payment setup happen in the Dynamoi dashboard, outside ChatGPT. This MCP server can check billing readiness after setup, but does not create checkout links or collect payment.\",\n\t\t\t\t\t\t\tpaymentSetupLocation: \"Dynamoi dashboard\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\tnoContracts: true,\n\t\t\t\t\t}),\n\t\t\t\t\turi: uri.href,\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t);\n\n\tserver.registerResource(\n\t\t\"platform-content-types\",\n\t\t\"dynamoi://platform/content-types\",\n\t\t{ mimeType: \"application/json\", title: \"Content Types\" },\n\t\tasync (uri) => ({\n\t\t\tcontents: [\n\t\t\t\t{\n\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\t\tcampaignTypes: {\n\t\t\t\t\t\t\tSMART_CAMPAIGN: [\"TRACK\", \"ALBUM\", \"PLAYLIST\"],\n\t\t\t\t\t\t\tYOUTUBE: [\"VIDEO\"],\n\t\t\t\t\t\t},\n\t\t\t\t\t\tcontentTypes: [\"TRACK\", \"ALBUM\", \"PLAYLIST\", \"VIDEO\"],\n\t\t\t\t\t}),\n\t\t\t\t\turi: uri.href,\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t);\n\n\tconst countryTargetingResource = async (uri: URL) => ({\n\t\tcontents: [\n\t\t\t{\n\t\t\t\tmimeType: \"application/json\",\n\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\tagentGuidance:\n\t\t\t\t\t\t\"Always choose a campaign type before suggesting target countries. Smart Campaign and YouTube country catalogs are different.\",\n\t\t\t\t\tsmartCampaigns: {\n\t\t\t\t\t\tmeaning:\n\t\t\t\t\t\t\t\"Spotify-focused Smart Campaign markets supported by Dynamoi's Meta campaign workflow.\",\n\t\t\t\t\t\tsource: \"SMART_CAMPAIGN_COUNTRIES\",\n\t\t\t\t\t\ttool: \"dynamoi_list_available_countries\",\n\t\t\t\t\t\ttoolInput: { campaignType: \"SMART_CAMPAIGN\" },\n\t\t\t\t\t},\n\t\t\t\t\tyoutubeCampaigns: {\n\t\t\t\t\t\tmeaning:\n\t\t\t\t\t\t\t\"Google Ads geo targets for YouTube campaign deployment and localization.\",\n\t\t\t\t\t\tsource: \"GOOGLE_ADS_COUNTRIES\",\n\t\t\t\t\t\ttool: \"dynamoi_list_available_countries\",\n\t\t\t\t\t\ttoolInput: { campaignType: \"YOUTUBE\" },\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t\turi: uri.href,\n\t\t\t},\n\t\t],\n\t});\n\n\tserver.registerResource(\n\t\t\"platform-country-targeting\",\n\t\t\"dynamoi://platform/country-targeting\",\n\t\t{\n\t\t\tdescription:\n\t\t\t\t\"Explains Smart Campaign vs YouTube country-targeting catalogs.\",\n\t\t\tmimeType: \"application/json\",\n\t\t\ttitle: \"Country Targeting\",\n\t\t},\n\t\tcountryTargetingResource,\n\t);\n\n\tserver.registerResource(\n\t\t\"platform-supported-countries\",\n\t\t\"dynamoi://platform/supported-countries\",\n\t\t{\n\t\t\tdescription:\n\t\t\t\t\"Legacy alias for country-targeting guidance. Use dynamoi://platform/country-targeting for the canonical resource.\",\n\t\t\tmimeType: \"application/json\",\n\t\t\ttitle: \"Supported Countries\",\n\t\t},\n\t\tcountryTargetingResource,\n\t);\n\n\tserver.registerResource(\n\t\t\"smart-links-free-plan\",\n\t\t\"dynamoi://smart-links/free-plan\",\n\t\t{\n\t\t\tdescription:\n\t\t\t\t\"Canonical explanation of Dynamoi's free Smart Links plan and how it differs from paid managed advertising.\",\n\t\t\tmimeType: \"application/json\",\n\t\t\ttitle: \"Free Smart Links\",\n\t\t},\n\t\tasync (uri) => ({\n\t\t\tcontents: [\n\t\t\t\t{\n\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\t\tfree: true,\n\t\t\t\t\t\tincluded: [\n\t\t\t\t\t\t\t\"Unlimited free Smart Links for supported Spotify artist, album, and track URLs\",\n\t\t\t\t\t\t\t\"Artist hub pages for catalog-level Smart Links\",\n\t\t\t\t\t\t\t\"Smart Link analytics\",\n\t\t\t\t\t\t\t\"Artist-level themes\",\n\t\t\t\t\t\t\t\"Validated Meta, TikTok, and Google Ads pixel IDs\",\n\t\t\t\t\t\t\t\"Artist-level public availability controls\",\n\t\t\t\t\t\t],\n\t\t\t\t\t\tnoCatch:\n\t\t\t\t\t\t\t\"No per-link fee for Smart Link creation or management. High-popularity or unverifiable artist links may stay unpublished in verification hold until Dynamoi can verify the client relationship.\",\n\t\t\t\t\t\tpaidSeparately:\n\t\t\t\t\t\t\t\"Managed advertising campaigns and ad budgets are separate paid products.\",\n\t\t\t\t\t}),\n\t\t\t\t\turi: uri.href,\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t);\n\n\tserver.registerResource(\n\t\t\"smart-links-capabilities\",\n\t\t\"dynamoi://smart-links/capabilities\",\n\t\t{ mimeType: \"application/json\", title: \"Smart Link Capabilities\" },\n\t\tasync (uri) => ({\n\t\t\tcontents: [\n\t\t\t\t{\n\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\t\tartistCatalogWorkflow:\n\t\t\t\t\t\t\t\"Use dynamoi_create_smart_links_from_spotify_artist for Spotify artist URLs when the user wants the artist hub, catalog import, or all links. The tool creates/returns a starter link immediately and starts the background catalog import so the user does not need the dashboard.\",\n\t\t\t\t\t\tcreationInputs: {\n\t\t\t\t\t\t\tsupportedSpotifyKinds: [\"artist\", \"album\", \"track\"],\n\t\t\t\t\t\t\tunsupportedToday: [\"playlist\"],\n\t\t\t\t\t\t},\n\t\t\t\t\t\tmutableFields: {\n\t\t\t\t\t\t\tartistLevel: [\n\t\t\t\t\t\t\t\t\"defaultTheme\",\n\t\t\t\t\t\t\t\t\"metaPixelId\",\n\t\t\t\t\t\t\t\t\"tiktokPixelId\",\n\t\t\t\t\t\t\t\t\"googleAdsConversionId\",\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\tperLink: [\"customDescription\"],\n\t\t\t\t\t\t},\n\t\t\t\t\t\tpixelPolicy:\n\t\t\t\t\t\t\t\"Only validated pixel IDs are accepted. Arbitrary JavaScript, tag snippets, and script URLs are not supported.\",\n\t\t\t\t\t\tthemes: [\"classic\", \"brutalist\", \"aurora\", \"cinematic\"],\n\t\t\t\t\t}),\n\t\t\t\t\turi: uri.href,\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t);\n\n\tserver.registerResource(\n\t\t\"business-free-vs-paid\",\n\t\t\"dynamoi://business/free-vs-paid\",\n\t\t{\n\t\t\tdescription:\n\t\t\t\t\"Clear boundary between free Dynamoi Smart Links and paid managed advertising.\",\n\t\t\tmimeType: \"application/json\",\n\t\t\ttitle: \"Free Smart Links vs Paid Campaigns\",\n\t\t},\n\t\tasync (uri) => ({\n\t\t\tcontents: [\n\t\t\t\t{\n\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\t\tagentGuidance:\n\t\t\t\t\t\t\t\"Do not imply that a Smart Link creates an ad campaign. Do not imply that campaign budgets are free.\",\n\t\t\t\t\t\tfreeSmartLinks: {\n\t\t\t\t\t\t\tclaim:\n\t\t\t\t\t\t\t\t\"Smart Links are free to create and manage. High-popularity or unverifiable artist links may require verification before public publishing.\",\n\t\t\t\t\t\t\tuseFor:\n\t\t\t\t\t\t\t\t\"Spotify landing pages, public release links, link sharing, basic link analytics, artist-level themes, and validated pixel IDs.\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\tmanagedAdvertising: {\n\t\t\t\t\t\t\tpaid: true,\n\t\t\t\t\t\t\tpricing:\n\t\t\t\t\t\t\t\t\"Billing and payment setup happen in the Dynamoi dashboard, outside ChatGPT.\",\n\t\t\t\t\t\t\tuseFor:\n\t\t\t\t\t\t\t\t\"Managed Meta and Google ad campaigns for Spotify promotion and YouTube channel growth.\",\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t\t\t\turi: uri.href,\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t);\n\n\tserver.registerResource(\n\t\t\"smart-links-agent-guide\",\n\t\t\"dynamoi://smart-links/agent-guide\",\n\t\t{\n\t\t\tdescription:\n\t\t\t\t\"How agents should answer Smart Link questions using Dynamoi MCP tools.\",\n\t\t\tmimeType: \"application/json\",\n\t\t\ttitle: \"Smart Link Agent Guide\",\n\t\t},\n\t\tasync (uri) => ({\n\t\t\tcontents: [\n\t\t\t\t{\n\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\t\tanswerWith: [\n\t\t\t\t\t\t\t\"artist hub URL when present\",\n\t\t\t\t\t\t\t\"release title\",\n\t\t\t\t\t\t\t\"artist name\",\n\t\t\t\t\t\t\t\"public URL\",\n\t\t\t\t\t\t\t\"public status\",\n\t\t\t\t\t\t\t\"one next action when relevant\",\n\t\t\t\t\t\t],\n\t\t\t\t\t\tavoidByDefault: [\n\t\t\t\t\t\t\t\"internal UUIDs\",\n\t\t\t\t\t\t\t\"database model names\",\n\t\t\t\t\t\t\t\"workflow IDs\",\n\t\t\t\t\t\t\t\"provider implementation details\",\n\t\t\t\t\t\t],\n\t\t\t\t\t\twhenToUse:\n\t\t\t\t\t\t\t\"Use Smart Link tools when the user asks for free release links, artist hubs, full-catalog Spotify landing pages, streaming landing pages, Spotify link pages, Smart Link analytics, themes, pixels, public status, or public URLs.\",\n\t\t\t\t\t}),\n\t\t\t\t\turi: uri.href,\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t);\n\n\tserver.registerResource(\n\t\t\"mcp-tool-answering-rules\",\n\t\t\"dynamoi://mcp/tool-answering-rules\",\n\t\t{\n\t\t\tdescription:\n\t\t\t\t\"General answer rules for Dynamoi MCP tools so agents stop after useful results.\",\n\t\t\tmimeType: \"application/json\",\n\t\t\ttitle: \"MCP Tool Answering Rules\",\n\t\t},\n\t\tasync (uri) => ({\n\t\t\tcontents: [\n\t\t\t\t{\n\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\t\temptyStateRule:\n\t\t\t\t\t\t\t\"Always call dynamoi_get_account_overview first for routing. If list_artists, list_campaigns, list_smart_links, or search return empty for a brand-new user, do not respond 'no records found' as a terminal answer; consult dynamoi_get_account_overview.recommendedNextActions or dynamoi://playbooks/onboarding-tree.\",\n\t\t\t\t\t\tgenericAdvice:\n\t\t\t\t\t\t\t\"Answer generic music marketing questions directly unless the user asks about their Dynamoi account or asks Dynamoi to take an action.\",\n\t\t\t\t\t\tstopRule:\n\t\t\t\t\t\t\t\"If a read tool already returns the requested fact in summary form, answer the user instead of chaining more read tools.\",\n\t\t\t\t\t\tuserFacingFields:\n\t\t\t\t\t\t\t\"Prefer names, public URLs, statuses, money display values, and next actions over internal IDs.\",\n\t\t\t\t\t\twriteRule:\n\t\t\t\t\t\t\t\"Before write tools, confirm what will change. After success, answer from the returned record.\",\n\t\t\t\t\t}),\n\t\t\t\t\turi: uri.href,\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t);\n\n\tregisterPlaybookResources(server);\n\n\tserver.registerResource(\n\t\t\"music-marketing-when-to-use-dynamoi\",\n\t\t\"dynamoi://music-marketing/when-to-use-dynamoi\",\n\t\t{\n\t\t\tdescription:\n\t\t\t\t\"When an assistant should use Dynamoi account tools versus answering music marketing questions natively.\",\n\t\t\tmimeType: \"application/json\",\n\t\t\ttitle: \"When To Use Dynamoi\",\n\t\t},\n\t\tasync (uri) => ({\n\t\t\tcontents: [\n\t\t\t\t{\n\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\t\tanswerNativelyFor: [\n\t\t\t\t\t\t\t\"general promotion strategy\",\n\t\t\t\t\t\t\t\"songwriting, branding, release-planning, or content ideas\",\n\t\t\t\t\t\t\t\"music marketing education that does not require the user's Dynamoi data\",\n\t\t\t\t\t\t],\n\t\t\t\t\t\tuseToolsFor: [\n\t\t\t\t\t\t\t\"finding the user's artists, campaigns, Smart Links, billing, platform connections, or analytics\",\n\t\t\t\t\t\t\t\"creating or editing free Smart Links\",\n\t\t\t\t\t\t\t\"confirmed campaign mutations such as pause, resume, budget update, or launch workflow\",\n\t\t\t\t\t\t],\n\t\t\t\t\t}),\n\t\t\t\t\turi: uri.href,\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t);\n\n\tserver.registerResource(\n\t\t\"platform-campaign-statuses\",\n\t\t\"dynamoi://platform/campaign-statuses\",\n\t\t{ mimeType: \"application/json\", title: \"Campaign Statuses\" },\n\t\tasync (uri) => ({\n\t\t\tcontents: [\n\t\t\t\t{\n\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\t\tstatuses: [\n\t\t\t\t\t\t\t\"AWAITING_SMART_LINK\",\n\t\t\t\t\t\t\t\"CONTENT_VALIDATION\",\n\t\t\t\t\t\t\t\"DEPLOYING\",\n\t\t\t\t\t\t\t\"READY_FOR_REVIEW\",\n\t\t\t\t\t\t\t\"ACTIVE\",\n\t\t\t\t\t\t\t\"PAUSED\",\n\t\t\t\t\t\t\t\"SUBSCRIPTION_PAUSED\",\n\t\t\t\t\t\t\t\"FAILED\",\n\t\t\t\t\t\t\t\"ARCHIVED\",\n\t\t\t\t\t\t\t\"ENDED\",\n\t\t\t\t\t\t],\n\t\t\t\t\t}),\n\t\t\t\t\turi: uri.href,\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t);\n\n\t// Dynamic resources: lightweight equivalents to get_* tools\n\tserver.registerResource(\n\t\t\"artist-resource\",\n\t\tnew ResourceTemplate(\"dynamoi://artist/{artistId}\", {\n\t\t\tlist: async () => ({ resources: [] }),\n\t\t}),\n\t\t{ mimeType: \"application/json\", title: \"Artist\" },\n\t\tasync (uri, variables) => {\n\t\t\tconst artistId = variables[\"artistId\"];\n\t\t\tconst parsed = z.string().uuid().safeParse(artistId);\n\t\t\tif (!parsed.success) {\n\t\t\t\treturn {\n\t\t\t\t\tcontents: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\t\t\t\tmessage: \"Invalid artistId\",\n\t\t\t\t\t\t\t\tstatus: \"error\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\turi: uri.href,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst envelope = await adapter.getArtist({\n\t\t\t\tartistId: parsed.data,\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tcontents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\t\ttext: JSON.stringify(envelope),\n\t\t\t\t\t\turi: uri.href,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t},\n\t);\n\n\tserver.registerResource(\n\t\t\"campaign-resource\",\n\t\tnew ResourceTemplate(\"dynamoi://campaign/{campaignId}\", {\n\t\t\tlist: async () => ({ resources: [] }),\n\t\t}),\n\t\t{ mimeType: \"application/json\", title: \"Campaign\" },\n\t\tasync (uri, variables) => {\n\t\t\tconst campaignId = variables[\"campaignId\"];\n\t\t\tconst parsed = z.string().uuid().safeParse(campaignId);\n\t\t\tif (!parsed.success) {\n\t\t\t\treturn {\n\t\t\t\t\tcontents: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\t\t\t\tmessage: \"Invalid campaignId\",\n\t\t\t\t\t\t\t\tstatus: \"error\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\turi: uri.href,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst envelope = await adapter.getCampaign({\n\t\t\t\tcampaignId: parsed.data,\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tcontents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\t\ttext: JSON.stringify(envelope),\n\t\t\t\t\t\turi: uri.href,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t},\n\t);\n\n\tserver.registerResource(\n\t\t\"smart-link-resource\",\n\t\tnew ResourceTemplate(\"dynamoi://smart-link/{playLinkId}\", {\n\t\t\tlist: async () => ({ resources: [] }),\n\t\t}),\n\t\t{ mimeType: \"application/json\", title: \"Smart Link\" },\n\t\tasync (uri, variables) => {\n\t\t\tconst playLinkId = variables[\"playLinkId\"];\n\t\t\tconst parsed = z.string().uuid().safeParse(playLinkId);\n\t\t\tif (!parsed.success) {\n\t\t\t\treturn {\n\t\t\t\t\tcontents: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\t\t\t\tmessage: \"Invalid playLinkId\",\n\t\t\t\t\t\t\t\tstatus: \"error\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\turi: uri.href,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst envelope = await adapter.getSmartLink({\n\t\t\t\tplayLinkId: parsed.data,\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tcontents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\t\ttext: JSON.stringify(envelope),\n\t\t\t\t\t\turi: uri.href,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t},\n\t);\n\n\tserver.registerResource(\n\t\t\"smart-link-artist-settings-resource\",\n\t\tnew ResourceTemplate(\"dynamoi://artist/{artistId}/smart-link-settings\", {\n\t\t\tlist: async () => ({ resources: [] }),\n\t\t}),\n\t\t{ mimeType: \"application/json\", title: \"Smart Link Artist Settings\" },\n\t\tasync (uri, variables) => {\n\t\t\tconst artistId = variables[\"artistId\"];\n\t\t\tconst parsed = z.string().uuid().safeParse(artistId);\n\t\t\tif (!parsed.success) {\n\t\t\t\treturn {\n\t\t\t\t\tcontents: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\t\t\t\tmessage: \"Invalid artistId\",\n\t\t\t\t\t\t\t\tstatus: \"error\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\turi: uri.href,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst envelope = await adapter.getSmartLinkArtistSettings({\n\t\t\t\tartistId: parsed.data,\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tcontents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\t\ttext: JSON.stringify(envelope),\n\t\t\t\t\t\turi: uri.href,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t},\n\t);\n}\n",
13
- "import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\n\nexport function registerPlaybookResources(server: McpServer) {\n\tserver.registerResource(\n\t\t\"playbook-spotify-artist\",\n\t\t\"dynamoi://playbooks/spotify-artist\",\n\t\t{\n\t\t\tdescription:\n\t\t\t\t\"Persona playbook: how to convert a Spotify artist user from auth-grant to first activated Smart Link.\",\n\t\t\tmimeType: \"application/json\",\n\t\t\ttitle: \"Playbook: Spotify Artist\",\n\t\t},\n\t\tasync (uri) => ({\n\t\t\tcontents: [\n\t\t\t\t{\n\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\t\tfastestPath:\n\t\t\t\t\t\t\t\"Ask the user for their Spotify artist URL, then call dynamoi_create_smart_links_from_spotify_artist with that URL. Return the artist hub URL plus the starter Smart Link URL. Catalog import continues in the background.\",\n\t\t\t\t\t\tfreePlanReminder:\n\t\t\t\t\t\t\t\"Free Smart Links have no per-link fee for creation or management. High-popularity or unverifiable artist links may stay unpublished in verification hold until Dynamoi can verify the client relationship. Creating a Smart Link does not create a paid campaign or spend ad budget.\",\n\t\t\t\t\t\tmarginCopyGuard:\n\t\t\t\t\t\t\t\"Never describe Dynamoi's pricing in terms that imply pass-through or zero overhead. Do not quote plan prices, campaign credits, daily campaign-spend billing, or checkout details in ChatGPT; billing setup belongs in the Dynamoi dashboard. The internal media-spend margin is not part of any client-facing copy.\",\n\t\t\t\t\t\tpersona:\n\t\t\t\t\t\t\t\"Independent musician or small artist with at least one Spotify release. Goal: increase Spotify streams.\",\n\t\t\t\t\t\tsampleScript:\n\t\t\t\t\t\t\t\"Drop your Spotify artist link and I'll set up your free Dynamoi hub in about 30 seconds. We'll get all your releases on one shareable page, then we can talk about whether you want to promote any of them.\",\n\t\t\t\t\t\ttalkingPoints: {\n\t\t\t\t\t\t\tdifferentiatorComparison: {\n\t\t\t\t\t\t\t\tclaim:\n\t\t\t\t\t\t\t\t\t\"Linkfire, Feature.fm, and Hypeddit are primarily link and landing-page tools. Dynamoi starts with free Smart Links, then uses the same artist and link data to launch managed Meta campaigns from chat.\",\n\t\t\t\t\t\t\t\ttrigger:\n\t\t\t\t\t\t\t\t\t\"User asks how Dynamoi differs from link-in-bio or Smart Link products.\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\thesitationReassurance: {\n\t\t\t\t\t\t\t\tclaim:\n\t\t\t\t\t\t\t\t\t\"Managed advertising billing is completed in the Dynamoi dashboard. In ChatGPT, keep the flow focused on Smart Links, readiness, platform connections, and campaign management after billing setup is complete.\",\n\t\t\t\t\t\t\t\ttrigger:\n\t\t\t\t\t\t\t\t\t\"User hesitates about price, commitment, or whether the first month is enough to test.\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tpostLaunchExpectations: {\n\t\t\t\t\t\t\t\tclaim:\n\t\t\t\t\t\t\t\t\t\"After launch, expect 7-14 days of learning while delivery shifts by country and creative. CPC and save-rate trends are usually more useful than same-day results.\",\n\t\t\t\t\t\t\t\ttrigger:\n\t\t\t\t\t\t\t\t\t\"Immediately after a successful launch_campaign call or when the user asks when results should show.\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tsmartLinkPixelSeed: {\n\t\t\t\t\t\t\t\tclaim:\n\t\t\t\t\t\t\t\t\t\"Publishing a Smart Link can create first-party click and pixel signals before ad spend begins, which gives future Meta and Google campaigns a cleaner starting signal.\",\n\t\t\t\t\t\t\t\ttrigger:\n\t\t\t\t\t\t\t\t\t\"Smart Link user has no campaign yet or asks why a free Smart Link matters before ads.\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tsocialSideEffect: {\n\t\t\t\t\t\t\t\tclaim:\n\t\t\t\t\t\t\t\t\t\"Smart Campaigns run on Meta, so campaigns optimized for Spotify saves can also create Instagram engagement such as profile visits, likes, and follows as a side effect.\",\n\t\t\t\t\t\t\t\ttrigger:\n\t\t\t\t\t\t\t\t\t\"User mentions Instagram, social media growth, or followers while discussing Spotify promotion.\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tupsellAfterStarter:\n\t\t\t\t\t\t\t\"Once they have a hub URL, the natural next ask is 'would you like to promote this release on Meta Ads?' which routes to dynamoi_get_campaign_readiness, dynamoi_start_meta_connection if Meta is missing, then dynamoi_launch_campaign for a Smart Campaign.\",\n\t\t\t\t\t}),\n\t\t\t\t\turi: uri.href,\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t);\n\n\tserver.registerResource(\n\t\t\"playbook-youtube-creator\",\n\t\t\"dynamoi://playbooks/youtube-creator\",\n\t\t{\n\t\t\tdescription:\n\t\t\t\t\"Persona playbook: how to introduce a YouTube creator to Dynamoi's revenue-per-view optimization advantage.\",\n\t\t\tmimeType: \"application/json\",\n\t\t\ttitle: \"Playbook: YouTube Creator\",\n\t\t},\n\t\tasync (uri) => ({\n\t\t\tcontents: [\n\t\t\t\t{\n\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\t\tchannelLinkingPath:\n\t\t\t\t\t\t\t\"Call dynamoi_start_youtube_channel_link for the target artist, give the user the returned Google authorization URL, then poll dynamoi_get_platform_status for that artist with the returned onboardingAttemptId and onboardingFlow=youtube after the return page sends them back to chat. The completion field is platforms.youtube.connected.\",\n\t\t\t\t\t\tdifferentiator:\n\t\t\t\t\t\t\t\"Dynamoi is the only ad platform that optimizes YouTube ad spend against AdSense revenue per country. Most ad tools optimize for views; Dynamoi optimizes for views that make money. The system explores small bids in new markets, scales countries where viewer revenue is strong, and pauses countries that cannot cover their costs.\",\n\t\t\t\t\t\tpersona:\n\t\t\t\t\t\t\t\"Channel owner of any niche (music, education, gaming, vlog, podcast, tutorial, product reviews) who wants subscriber growth that pays back via AdSense.\",\n\t\t\t\t\t\tpostLinkingFlow:\n\t\t\t\t\t\t\t\"After channel link, call dynamoi_get_campaign_readiness for a YouTube growth campaign. Mention that ad copy is internationalized per market for lower cost and that campaigns require playlists so each paid view drives sustained organic views downstream.\",\n\t\t\t\t\t\tsampleScript:\n\t\t\t\t\t\t\t\"Most YouTube ad systems optimize for raw views. Dynamoi merges your AdSense revenue with ad cost data to optimize bids per country based on real viewer revenue, so you grow toward viewers who actually monetize. I can start the YouTube channel link from here, then we can plan your first campaign.\",\n\t\t\t\t\t\ttalkingPoints: {\n\t\t\t\t\t\t\tdifferentiatorComparison: {\n\t\t\t\t\t\t\t\tclaim:\n\t\t\t\t\t\t\t\t\t\"Most creator ad tools optimize for views or subscribers. Dynamoi compares ad cost with AdSense revenue by country so delivery can favor viewers who are more likely to pay back over time.\",\n\t\t\t\t\t\t\t\ttrigger:\n\t\t\t\t\t\t\t\t\t\"User asks how YouTube campaigns differ from normal Google Ads or creator-growth services.\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\thesitationReassurance: {\n\t\t\t\t\t\t\t\tclaim:\n\t\t\t\t\t\t\t\t\t\"Managed advertising billing is completed in the Dynamoi dashboard. In ChatGPT, keep the flow focused on channel linking, readiness, and campaign management after billing setup is complete.\",\n\t\t\t\t\t\t\t\ttrigger:\n\t\t\t\t\t\t\t\t\t\"User expresses pricing concern or asks whether they can test without a long commitment.\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tplaylistWaterfall: {\n\t\t\t\t\t\t\t\tclaim:\n\t\t\t\t\t\t\t\t\t\"Playlist promotion sends viewers into a sequence, so one paid view can lead to additional organic views across related videos and channel-wide subscriber growth.\",\n\t\t\t\t\t\t\t\ttrigger:\n\t\t\t\t\t\t\t\t\t\"User asks whether campaigns can help subscribers or the whole channel instead of one video.\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tpostLaunchExpectations: {\n\t\t\t\t\t\t\t\tclaim:\n\t\t\t\t\t\t\t\t\t\"After launch, expect 7-14 days of learning while country bids, view quality, and attribution settle. Subscriber and revenue trends usually lag the first paid views.\",\n\t\t\t\t\t\t\t\ttrigger:\n\t\t\t\t\t\t\t\t\t\"Immediately after a successful YouTube launch or when the user asks when results should show.\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t\t\t\turi: uri.href,\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t);\n\n\tserver.registerResource(\n\t\t\"playbook-label-or-manager\",\n\t\t\"dynamoi://playbooks/label-or-manager\",\n\t\t{\n\t\t\tdescription:\n\t\t\t\t\"Persona playbook: how to onboard a label, manager, or anyone running a roster of multiple artists.\",\n\t\t\tmimeType: \"application/json\",\n\t\t\ttitle: \"Playbook: Label or Manager\",\n\t\t},\n\t\tasync (uri) => ({\n\t\t\tcontents: [\n\t\t\t\t{\n\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\t\tbillingNote:\n\t\t\t\t\t\t\t\"Consolidated billing across all artists in the organization. No per-seat charge, no per-artist fee.\",\n\t\t\t\t\t\tpersona:\n\t\t\t\t\t\t\t\"Label owner, manager, or distributor handling more than one artist. Goal: oversee promotion across a roster from one account.\",\n\t\t\t\t\t\trolesNote:\n\t\t\t\t\t\t\t\"Dynamoi supports admin, editor, and viewer roles at organization and artist level. Editors can mutate everything except admin management; viewers are read-only.\",\n\t\t\t\t\t\tsampleScript:\n\t\t\t\t\t\t\t\"Dynamoi handles rosters: organizations with admin/editor/viewer roles, consolidated billing, and per-artist permissions. To start, create your first artist with a Spotify URL, then invite your team. We can layer in more artists from the same organization once you have one running.\",\n\t\t\t\t\t\tsetupSequence: [\n\t\t\t\t\t\t\t\"If they have one artist ready: route to dynamoi://playbooks/spotify-artist for that first artist.\",\n\t\t\t\t\t\t\t\"After the first artist is set up, mention team invites are managed in the dashboard at /dashboard/settings/organization (no MCP tool yet).\",\n\t\t\t\t\t\t\t\"Cross-artist analytics are available via dynamoi_get_artist_analytics per artist; a roster-wide rollup is dashboard-only.\",\n\t\t\t\t\t\t],\n\t\t\t\t\t\ttalkingPoints: {\n\t\t\t\t\t\t\tconsolidatedRoster: {\n\t\t\t\t\t\t\t\tclaim:\n\t\t\t\t\t\t\t\t\t\"One organization can hold multiple artists with admin, editor, and viewer roles, while campaign launch and billing state stay visible per artist.\",\n\t\t\t\t\t\t\t\ttrigger:\n\t\t\t\t\t\t\t\t\t\"User says they manage more than one artist or asks whether a label/manager workflow is supported.\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tdifferentiatorComparison: {\n\t\t\t\t\t\t\t\tclaim:\n\t\t\t\t\t\t\t\t\t\"Traditional Smart Link tools stop at links and analytics. Dynamoi keeps those free, then lets a roster operator move from link to managed campaign launch in the same assistant thread.\",\n\t\t\t\t\t\t\t\ttrigger:\n\t\t\t\t\t\t\t\t\t\"User compares Dynamoi to Linkfire, Feature.fm, Hypeddit, or a label marketing stack.\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\thesitationReassurance: {\n\t\t\t\t\t\t\t\tclaim:\n\t\t\t\t\t\t\t\t\t\"Managed advertising billing is completed in the Dynamoi dashboard. In ChatGPT, keep the flow focused on roster setup, readiness checks, and campaign management after billing setup is complete.\",\n\t\t\t\t\t\t\t\ttrigger:\n\t\t\t\t\t\t\t\t\t\"User asks whether billing scales per seat or wants to test with one artist first.\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t\t\t\turi: uri.href,\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t);\n\n\tserver.registerResource(\n\t\t\"playbook-onboarding-tree\",\n\t\t\"dynamoi://playbooks/onboarding-tree\",\n\t\t{\n\t\t\tdescription:\n\t\t\t\t\"Decision tree for routing a brand-new MCP user to the right persona playbook based on their first reply.\",\n\t\t\tmimeType: \"application/json\",\n\t\t\ttitle: \"Playbook: Onboarding Decision Tree\",\n\t\t},\n\t\tasync (uri) => ({\n\t\t\tcontents: [\n\t\t\t\t{\n\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\t\tnodes: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdo: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tmatch: \"Spotify artist\",\n\t\t\t\t\t\t\t\t\t\trouteTo: \"dynamoi://playbooks/spotify-artist\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tmatch: \"YouTube creator\",\n\t\t\t\t\t\t\t\t\t\trouteTo: \"dynamoi://playbooks/youtube-creator\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tmatch: \"Label / manager / multiple artists\",\n\t\t\t\t\t\t\t\t\t\trouteTo: \"dynamoi://playbooks/label-or-manager\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\tif: \"state.hasAnyArtist === false\",\n\t\t\t\t\t\t\t\tquestion:\n\t\t\t\t\t\t\t\t\t\"Are you a Spotify artist, a YouTube creator, or running a label/managing a roster?\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdo: \"Offer dynamoi_create_smart_link_from_spotify or dynamoi_create_smart_links_from_spotify_artist for the fastest visible win.\",\n\t\t\t\t\t\t\t\tif: \"state.hasAnyArtist === true && state.hasAnySmartLink === false\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdo: \"Offer dynamoi_get_campaign_readiness to validate launch inputs before creating anything.\",\n\t\t\t\t\t\t\t\tif: \"state.hasAnyArtist === true && state.hasAnyActiveCampaign === false\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdo: \"Tell the user managed-advertising billing setup must happen in the Dynamoi dashboard, not through a ChatGPT checkout link. After they start or restore billing there, poll dynamoi_get_billing for that artist to confirm billing is active.\",\n\t\t\t\t\t\t\t\tif: \"state.hasAnyArtist === true && billing is the launch blocker\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdo: \"Offer dynamoi_start_meta_connection for the target artist, then poll dynamoi_get_platform_status for that artist with the returned onboardingAttemptId and onboardingFlow=meta after Meta returns them to chat. The completion field is platforms.meta.status.\",\n\t\t\t\t\t\t\t\tif: \"state.hasAnyArtist === true && user wants Spotify Smart Campaigns && state.hasAnyConnectedMeta === false\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdo: \"Offer dynamoi_start_youtube_channel_link for the target artist, then poll dynamoi_get_platform_status for that artist with the returned onboardingAttemptId and onboardingFlow=youtube after Google returns them to chat. The completion field is platforms.youtube.connected.\",\n\t\t\t\t\t\t\t\tif: \"state.hasAnyArtist === true && user wants YouTube growth && state.hasAnyConnectedYoutube === false\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdo: \"Ask whether they want a performance summary, a new campaign, or to update an existing campaign.\",\n\t\t\t\t\t\t\t\tif: \"state.hasAnyActiveCampaign === true\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\tsource:\n\t\t\t\t\t\t\t\"This tree mirrors dynamoi_get_account_overview.recommendedNextActions. Use either; the tree is for explaining the plan to the user, the array is for deciding the next tool call.\",\n\t\t\t\t\t\ttalkingPoints: {\n\t\t\t\t\t\t\tcreatorFirstChoice: {\n\t\t\t\t\t\t\t\tclaim:\n\t\t\t\t\t\t\t\t\t\"Spotify artists should start from a Spotify artist URL; YouTube creators should start by linking a channel; labels and managers should pick one artist as the first setup path.\",\n\t\t\t\t\t\t\t\ttrigger:\n\t\t\t\t\t\t\t\t\t\"Brand-new user has no artists and asks what to do first.\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tpostLaunchExpectations: {\n\t\t\t\t\t\t\t\tclaim:\n\t\t\t\t\t\t\t\t\t\"Campaigns need 7-14 days of learning before judging performance. Early reads should focus on blockers, delivery status, spend, CPC, and whether attribution is flowing.\",\n\t\t\t\t\t\t\t\ttrigger:\n\t\t\t\t\t\t\t\t\t\"User asks what happens after launch or whether a first-day result is good or bad.\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tsmartLinkBeforeAds: {\n\t\t\t\t\t\t\t\tclaim:\n\t\t\t\t\t\t\t\t\t\"A free Smart Link is the fastest visible setup step because it produces a public asset, starts catalog context, and creates a natural handoff into campaign readiness.\",\n\t\t\t\t\t\t\t\ttrigger:\n\t\t\t\t\t\t\t\t\t\"User has an artist but no Smart Link or asks why the assistant recommends links before ads.\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t\t\t\turi: uri.href,\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t);\n}\n",
14
- "import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport * as z from \"zod/v4\";\nimport type { ResultEnvelope } from \"../types\";\nimport { AnyOutputEnvelopeSchema } from \"./output-schemas\";\n\nexport const SMART_LINK_THEME_PREVIEW_RESOURCE_URI =\n\t\"ui://dynamoi/smart-link-theme-preview-v1.html\";\n\nconst SampleTextSchema = z.string().trim().min(1).max(80);\n\nconst DynamoiPreviewSmartLinkThemesInputSchema = z\n\t.object({\n\t\tartistName: SampleTextSchema.optional(),\n\t\treleaseTitle: SampleTextSchema.optional(),\n\t})\n\t.strict();\n\nexport type SmartLinkThemePreviewData = {\n\tartistName: string;\n\treleaseTitle: string;\n\tsummary: string;\n\tthemes: Array<{\n\t\taccentColor: string;\n\t\tbackgroundColor: string;\n\t\tdescription: string;\n\t\tid: \"classic\" | \"brutalist\" | \"aurora\" | \"cinematic\";\n\t\tname: string;\n\t\ttextColor: string;\n\t}>;\n\twidgetResourceUri: typeof SMART_LINK_THEME_PREVIEW_RESOURCE_URI;\n};\n\nexport const SMART_LINK_THEME_PREVIEW_TOOL_DEFINITION = {\n\tdescription:\n\t\t\"Use this when the user asks what Dynamoi Smart Link pages can look like, wants to compare Smart Link themes, or asks to preview the available themes before creating or updating a free Smart Link. This is a read-only visual preview and does not create, publish, update, or promote a Smart Link.\",\n\tdestructiveHint: false,\n\tname: \"dynamoi_preview_smart_link_themes\",\n\topenWorldHint: false,\n\toutputSchema: AnyOutputEnvelopeSchema,\n\treadOnlyHint: true,\n\tschema: DynamoiPreviewSmartLinkThemesInputSchema,\n\ttitle: \"Preview Smart Link Themes\",\n} as const;\n\nexport function previewSmartLinkThemes(\n\trawInput: unknown,\n): ResultEnvelope<SmartLinkThemePreviewData> {\n\tconst input = DynamoiPreviewSmartLinkThemesInputSchema.parse(rawInput ?? {});\n\tconst artistName = input.artistName ?? \"Dynamoi Artist\";\n\tconst releaseTitle = input.releaseTitle ?? \"New Single\";\n\tconst themes: SmartLinkThemePreviewData[\"themes\"] = [\n\t\t{\n\t\t\taccentColor: \"#2ef2a2\",\n\t\t\tbackgroundColor: \"#f8f6ef\",\n\t\t\tdescription:\n\t\t\t\t\"Clean editorial layout for release pages that should feel calm and polished.\",\n\t\t\tid: \"classic\",\n\t\t\tname: \"Classic\",\n\t\t\ttextColor: \"#171717\",\n\t\t},\n\t\t{\n\t\t\taccentColor: \"#ffe45c\",\n\t\t\tbackgroundColor: \"#111111\",\n\t\t\tdescription:\n\t\t\t\t\"Bold, poster-like treatment for artists who want sharp contrast and direct calls to action.\",\n\t\t\tid: \"brutalist\",\n\t\t\tname: \"Brutalist\",\n\t\t\ttextColor: \"#f5f5f5\",\n\t\t},\n\t\t{\n\t\t\taccentColor: \"#73f7ff\",\n\t\t\tbackgroundColor: \"#12172f\",\n\t\t\tdescription:\n\t\t\t\t\"Color-rich gradient atmosphere for pop, electronic, and high-energy releases.\",\n\t\t\tid: \"aurora\",\n\t\t\tname: \"Aurora\",\n\t\t\ttextColor: \"#f8fbff\",\n\t\t},\n\t\t{\n\t\t\taccentColor: \"#ffb36b\",\n\t\t\tbackgroundColor: \"#191512\",\n\t\t\tdescription:\n\t\t\t\t\"Moody cover-forward layout for cinematic, intimate, or premium release moments.\",\n\t\t\tid: \"cinematic\",\n\t\t\tname: \"Cinematic\",\n\t\t\ttextColor: \"#fff6eb\",\n\t\t},\n\t];\n\n\treturn {\n\t\tdata: {\n\t\t\tartistName,\n\t\t\treleaseTitle,\n\t\t\tsummary:\n\t\t\t\t\"Dynamoi Smart Links support four visual themes: Classic, Brutalist, Aurora, and Cinematic.\",\n\t\t\tthemes,\n\t\t\twidgetResourceUri: SMART_LINK_THEME_PREVIEW_RESOURCE_URI,\n\t\t},\n\t\tstatus: \"success\",\n\t};\n}\n\nconst SMART_LINK_THEME_PREVIEW_HTML = `\n<div class=\"shell\">\n\t<header>\n\t\t<p class=\"eyebrow\">Smart Link themes</p>\n\t\t<h1 id=\"title\">New Single</h1>\n\t\t<p id=\"artist\">Dynamoi Artist</p>\n\t</header>\n\t<section id=\"themes\" class=\"themes\" aria-label=\"Smart Link theme previews\"></section>\n</div>\n<script>\nconst fallback = {\n\tartistName: \"Dynamoi Artist\",\n\treleaseTitle: \"New Single\",\n\tthemes: [\n\t\t{ id: \"classic\", name: \"Classic\", description: \"Clean editorial layout for release pages that should feel calm and polished.\", backgroundColor: \"#f8f6ef\", textColor: \"#171717\", accentColor: \"#2ef2a2\" },\n\t\t{ id: \"brutalist\", name: \"Brutalist\", description: \"Bold, poster-like treatment for artists who want sharp contrast and direct calls to action.\", backgroundColor: \"#111111\", textColor: \"#f5f5f5\", accentColor: \"#ffe45c\" },\n\t\t{ id: \"aurora\", name: \"Aurora\", description: \"Color-rich gradient atmosphere for pop, electronic, and high-energy releases.\", backgroundColor: \"#12172f\", textColor: \"#f8fbff\", accentColor: \"#73f7ff\" },\n\t\t{ id: \"cinematic\", name: \"Cinematic\", description: \"Moody cover-forward layout for cinematic, intimate, or premium release moments.\", backgroundColor: \"#191512\", textColor: \"#fff6eb\", accentColor: \"#ffb36b\" }\n\t]\n};\nfunction normalize(output) {\n\tconst candidate = output?.data ?? output?.structuredContent?.data ?? output?.structuredContent ?? output;\n\treturn candidate?.themes ? candidate : fallback;\n}\nfunction render(output) {\n\tconst data = normalize(output);\n\tdocument.getElementById(\"title\").textContent = data.releaseTitle ?? fallback.releaseTitle;\n\tdocument.getElementById(\"artist\").textContent = data.artistName ?? fallback.artistName;\n\tconst themes = Array.isArray(data.themes) ? data.themes : fallback.themes;\n\tconst allowedThemeIds = new Set([\"classic\", \"brutalist\", \"aurora\", \"cinematic\"]);\n\tdocument.getElementById(\"themes\").replaceChildren(...themes.map((theme) => {\n\t\tconst article = document.createElement(\"article\");\n\t\tarticle.className = \"theme\";\n\t\tif (allowedThemeIds.has(theme.id)) article.classList.add(\"theme-\" + theme.id);\n\t\tarticle.style.backgroundColor = theme.backgroundColor;\n\t\tarticle.style.color = theme.textColor;\n\n\t\tconst cover = document.createElement(\"div\");\n\t\tcover.className = \"cover\";\n\t\tcover.style.backgroundColor = theme.accentColor;\n\t\tcover.append(document.createElement(\"span\"));\n\n\t\tconst copy = document.createElement(\"div\");\n\t\tcopy.className = \"theme-copy\";\n\t\tconst name = document.createElement(\"h2\");\n\t\tname.textContent = theme.name;\n\t\tconst description = document.createElement(\"p\");\n\t\tdescription.textContent = theme.description;\n\t\tcopy.append(name, description);\n\n\t\tconst cta = document.createElement(\"span\");\n\t\tcta.className = \"preview-cta\";\n\t\tcta.style.borderColor = theme.accentColor;\n\t\tcta.style.color = theme.textColor;\n\t\tcta.textContent = \"Listen on Spotify\";\n\t\tarticle.append(cover, copy, cta);\n\t\treturn article;\n\t}));\n}\nrender(window.openai?.toolOutput);\nwindow.addEventListener(\"openai:set_globals\", (event) => {\n\trender(event.detail?.globals?.toolOutput ?? window.openai?.toolOutput);\n}, { passive: true });\n</script>\n<style>\n:root {\n\tcolor-scheme: light dark;\n\tfont-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif;\n}\n* { box-sizing: border-box; }\nbody { margin: 0; }\n.shell {\n\tbackground: #f4f1e8;\n\tcolor: #151515;\n\tmin-height: 100vh;\n\tpadding: 18px;\n}\nheader {\n\tdisplay: grid;\n\tgap: 3px;\n\tmargin: 0 0 14px;\n}\n.eyebrow {\n\tcolor: #5f675f;\n\tfont-size: 12px;\n\tfont-weight: 700;\n\tletter-spacing: 0;\n\tmargin: 0;\n\ttext-transform: uppercase;\n}\nh1 {\n\tfont-size: 28px;\n\tline-height: 1;\n\tmargin: 0;\n}\nheader p:last-child {\n\tcolor: #59605a;\n\tfont-size: 14px;\n\tmargin: 0;\n}\n.themes {\n\tdisplay: grid;\n\tgap: 12px;\n\tgrid-template-columns: repeat(2, minmax(0, 1fr));\n}\n.theme {\n\tborder-radius: 8px;\n\tdisplay: grid;\n\tgap: 10px;\n\tmin-height: 232px;\n\toverflow: hidden;\n\tpadding: 12px;\n}\n.cover {\n\taspect-ratio: 1;\n\tborder-radius: 6px;\n\tdisplay: grid;\n\toverflow: hidden;\n\tplace-items: center;\n}\n.cover span {\n\tbackground: rgba(255, 255, 255, 0.62);\n\tborder: 1px solid rgba(0, 0, 0, 0.08);\n\tborder-radius: 999px;\n\tdisplay: block;\n\theight: 54%;\n\twidth: 54%;\n}\n.theme-aurora .cover {\n\tbackground: linear-gradient(135deg, #73f7ff, #ff6bd6 58%, #f6ff87) !important;\n}\n.theme-cinematic .cover {\n\tbackground: radial-gradient(circle at 48% 32%, #ffb36b, #7b3f2b 52%, #191512 76%) !important;\n}\n.theme h2 {\n\tfont-size: 18px;\n\tline-height: 1.1;\n\tmargin: 0 0 4px;\n}\n.theme p {\n\tfont-size: 12px;\n\tline-height: 1.35;\n\tmargin: 0;\n\topacity: 0.78;\n}\n.preview-cta {\n\tbackground: transparent;\n\tborder: 1px solid currentColor;\n\tborder-radius: 999px;\n\tfont: inherit;\n\tfont-size: 12px;\n\tfont-weight: 700;\n\tmin-height: 34px;\n\tpadding: 6px 10px;\n\twidth: 100%;\n}\n@media (max-width: 520px) {\n\t.shell { padding: 14px; }\n\t.themes { grid-template-columns: 1fr; }\n\th1 { font-size: 24px; }\n\t.theme {\n\t\tgrid-template-columns: 82px minmax(0, 1fr);\n\t\tmin-height: 0;\n\t}\n\t.cover { grid-row: span 2; }\n\t.preview-cta { grid-column: 2; }\n}\n</style>\n`.trim();\n\nexport function registerSmartLinkThemePreviewResource(server: McpServer) {\n\tserver.registerResource(\n\t\t\"smart-link-theme-preview\",\n\t\tSMART_LINK_THEME_PREVIEW_RESOURCE_URI,\n\t\t{\n\t\t\tdescription:\n\t\t\t\t\"Visual preview for the four Dynamoi Smart Link page themes.\",\n\t\t\tmimeType: \"text/html;profile=mcp-app\",\n\t\t\ttitle: \"Smart Link Theme Preview\",\n\t\t},\n\t\tasync () => ({\n\t\t\tcontents: [\n\t\t\t\t{\n\t\t\t\t\t_meta: {\n\t\t\t\t\t\tui: {\n\t\t\t\t\t\t\tcsp: {\n\t\t\t\t\t\t\t\tconnectDomains: [],\n\t\t\t\t\t\t\t\tresourceDomains: [],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tdomain: \"https://dynamoi.com\",\n\t\t\t\t\t\t\tprefersBorder: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tmimeType: \"text/html;profile=mcp-app\",\n\t\t\t\t\ttext: SMART_LINK_THEME_PREVIEW_HTML,\n\t\t\t\t\turi: SMART_LINK_THEME_PREVIEW_RESOURCE_URI,\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t);\n}\n",
15
- "import * as z from \"zod/v4\";\nimport {\n\tAnyOutputEnvelopeSchema,\n\tCreateSmartLinkFromSpotifyOutputEnvelopeSchema,\n\tCreateSmartLinksFromSpotifyArtistOutputEnvelopeSchema,\n\tListSmartLinksOutputEnvelopeSchema,\n} from \"./output-schemas\";\nimport {\n\tClientRequestIdSchema,\n\tDateRangeSchema,\n\tRequiredClientRequestIdSchema,\n\tToolFormatSchema,\n\tUserIntentSummarySchema,\n} from \"./shared-schemas\";\n\nconst SmartLinkStatusFiltersSchema = {\n\tclaimStatus: z\n\t\t.enum([\n\t\t\t\"auto_approved\",\n\t\t\t\"pending_ops_review\",\n\t\t\t\"verification_deferred\",\n\t\t\t\"approved_by_ops\",\n\t\t\t\"rejected\",\n\t\t])\n\t\t.optional(),\n\tpublishState: z.enum([\"published\", \"unpublished\"]).optional(),\n\trenderState: z.enum([\"queued\", \"rendering\", \"rendered\", \"failed\"]).optional(),\n} as const;\n\nconst SmartLinkThemeSchema = z.enum([\n\t\"classic\",\n\t\"brutalist\",\n\t\"aurora\",\n\t\"cinematic\",\n]);\nconst LegacySmartLinkIncludeSchema = z.array(\n\tz.enum([\"analytics\", \"artist_settings\"]),\n);\n\nexport function normalizeLegacySmartLinkInclude(rawInput: unknown) {\n\tif (!rawInput || typeof rawInput !== \"object\" || Array.isArray(rawInput)) {\n\t\treturn rawInput;\n\t}\n\tconst input = rawInput as Record<string, unknown>;\n\tif (!Object.hasOwn(input, \"include\")) {\n\t\treturn rawInput;\n\t}\n\n\tconst legacyInclude = LegacySmartLinkIncludeSchema.safeParse(\n\t\tinput[\"include\"],\n\t);\n\tif (!legacyInclude.success) {\n\t\treturn rawInput;\n\t}\n\n\tconst { include: _include, ...normalized } = input;\n\tif (\n\t\tnormalized[\"includeAnalytics\"] === undefined &&\n\t\tlegacyInclude.data.includes(\"analytics\")\n\t) {\n\t\tnormalized[\"includeAnalytics\"] = true;\n\t}\n\tif (\n\t\tnormalized[\"includeArtistSettings\"] === undefined &&\n\t\tlegacyInclude.data.includes(\"artist_settings\")\n\t) {\n\t\tnormalized[\"includeArtistSettings\"] = true;\n\t}\n\treturn normalized;\n}\n\nexport const DynamoiCreateSmartLinkFromSpotifyInputSchema = z\n\t.object({\n\t\tartistId: z.string().uuid(),\n\t\tclientRequestId: RequiredClientRequestIdSchema.optional(),\n\t\tcustomDescription: z.string().trim().max(500).optional(),\n\t\tformat: ToolFormatSchema.optional(),\n\t\tspotifyUrl: z.string().trim().min(1).max(500),\n\t\tuserIntentSummary: UserIntentSummarySchema,\n\t})\n\t.strict();\n\nexport const DynamoiCreateSmartLinksFromSpotifyArtistInputSchema = z\n\t.object({\n\t\tartistId: z.string().uuid().optional(),\n\t\tclientRequestId: RequiredClientRequestIdSchema.optional(),\n\t\tformat: ToolFormatSchema.optional(),\n\t\tspotifyArtistUrl: z.string().trim().min(1).max(500),\n\t\tuserIntentSummary: UserIntentSummarySchema,\n\t})\n\t.strict();\n\nexport const DynamoiListSmartLinksInputSchema = z\n\t.object({\n\t\tartistId: z.string().uuid(),\n\t\tcursor: z.string().optional(),\n\t\tformat: ToolFormatSchema.optional(),\n\t\tlimit: z.number().int().min(1).max(50).optional(),\n\t\tquery: z.string().trim().max(120).optional(),\n\t\t...SmartLinkStatusFiltersSchema,\n\t})\n\t.strict();\n\nconst DynamoiGetSmartLinkInputShape = {\n\tartistId: z.string().uuid().optional(),\n\tdateRange: DateRangeSchema.optional(),\n\tformat: ToolFormatSchema.optional(),\n\tgranularity: z.enum([\"TOTAL\", \"DAILY\"]).optional(),\n\tincludeAnalytics: z.boolean().optional(),\n\tincludeArtistSettings: z.boolean().optional(),\n\tincludeBreakdowns: z.boolean().optional(),\n\tplayLinkId: z.string().uuid().optional(),\n\tspotifyUrl: z.string().trim().min(1).max(500).optional(),\n} as const;\n\nfunction validateDynamoiGetSmartLinkInput(\n\tdata: z.infer<z.ZodObject<typeof DynamoiGetSmartLinkInputShape>>,\n\tctx: z.RefinementCtx,\n) {\n\tconst settingsOnly =\n\t\tdata.includeArtistSettings === true &&\n\t\t!data.playLinkId &&\n\t\t!data.spotifyUrl &&\n\t\tBoolean(data.artistId);\n\tif (\n\t\t!(data.playLinkId || (data.artistId && data.spotifyUrl) || settingsOnly)\n\t) {\n\t\tctx.addIssue({\n\t\t\tcode: \"custom\",\n\t\t\tmessage:\n\t\t\t\t\"Provide playLinkId, artistId with spotifyUrl, or artistId with includeArtistSettings=true\",\n\t\t\tpath: [\"playLinkId\"],\n\t\t});\n\t}\n\tif (\n\t\t(data.dateRange || data.granularity || data.includeBreakdowns) &&\n\t\tdata.includeAnalytics !== true\n\t) {\n\t\tctx.addIssue({\n\t\t\tcode: \"custom\",\n\t\t\tmessage:\n\t\t\t\t\"dateRange, granularity, and includeBreakdowns require includeAnalytics=true\",\n\t\t\tpath: [\"includeAnalytics\"],\n\t\t});\n\t}\n}\n\nconst StrictDynamoiGetSmartLinkInputSchema = z\n\t.object(DynamoiGetSmartLinkInputShape)\n\t.strict()\n\t.superRefine(validateDynamoiGetSmartLinkInput);\n\nexport const DynamoiGetSmartLinkInputSchema =\n\tStrictDynamoiGetSmartLinkInputSchema;\n\nexport function parseDynamoiGetSmartLinkInput(rawInput: unknown) {\n\treturn StrictDynamoiGetSmartLinkInputSchema.parse(\n\t\tnormalizeLegacySmartLinkInclude(rawInput),\n\t);\n}\n\nexport const DynamoiGetSmartLinkAnalyticsInputSchema = z\n\t.object({\n\t\tdateRange: DateRangeSchema.optional(),\n\t\tformat: ToolFormatSchema.optional(),\n\t\tgranularity: z.enum([\"TOTAL\", \"DAILY\"]).optional(),\n\t\tincludeBreakdowns: z.boolean().optional(),\n\t\tplayLinkId: z.string().uuid(),\n\t})\n\t.strict();\n\nexport const DynamoiGetSmartLinkArtistSettingsInputSchema = z\n\t.object({\n\t\tartistId: z.string().uuid(),\n\t\tformat: ToolFormatSchema.optional(),\n\t})\n\t.strict();\n\nexport const DynamoiUpdateSmartLinkInputSchema = z\n\t.object({\n\t\taction: z.enum([\"update_description\", \"update_artist_settings\"]),\n\t\tartistId: z.string().uuid().optional(),\n\t\tclientRequestId: ClientRequestIdSchema,\n\t\tcustomDescription: z.string().max(500).nullable().optional(),\n\t\texpectedUpdatedAt: z.string().datetime().optional(),\n\t\tgoogleAdsConversionId: z.string().trim().max(32).nullable().optional(),\n\t\tmetaPixelId: z.string().trim().max(32).nullable().optional(),\n\t\tplayLinkId: z.string().uuid().optional(),\n\t\ttheme: SmartLinkThemeSchema.optional(),\n\t\ttiktokPixelId: z.string().trim().max(32).nullable().optional(),\n\t\tuserIntentSummary: UserIntentSummarySchema,\n\t})\n\t.strict()\n\t.superRefine((data, ctx) => {\n\t\tif (\n\t\t\tdata.action === \"update_description\" &&\n\t\t\tdata.customDescription === undefined\n\t\t) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tmessage:\n\t\t\t\t\t\"customDescription is required when action is update_description\",\n\t\t\t\tpath: [\"customDescription\"],\n\t\t\t});\n\t\t}\n\t\tif (data.action !== \"update_artist_settings\" && !data.playLinkId) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tmessage: \"playLinkId is required when action is update_description\",\n\t\t\t\tpath: [\"playLinkId\"],\n\t\t\t});\n\t\t}\n\t\tif (data.action === \"update_artist_settings\") {\n\t\t\tif (!data.artistId) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tmessage: \"artistId is required when action is update_artist_settings\",\n\t\t\t\t\tpath: [\"artistId\"],\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (\n\t\t\t\tdata.theme === undefined &&\n\t\t\t\tdata.metaPixelId === undefined &&\n\t\t\t\tdata.tiktokPixelId === undefined &&\n\t\t\t\tdata.googleAdsConversionId === undefined\n\t\t\t) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tmessage: \"Provide at least one setting to update\",\n\t\t\t\t\tpath: [\"theme\"],\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\tif (data.action !== \"update_artist_settings\") {\n\t\t\tfor (const field of [\n\t\t\t\t\"artistId\",\n\t\t\t\t\"googleAdsConversionId\",\n\t\t\t\t\"metaPixelId\",\n\t\t\t\t\"theme\",\n\t\t\t\t\"tiktokPixelId\",\n\t\t\t] as const) {\n\t\t\t\tif (data[field] !== undefined) {\n\t\t\t\t\tctx.addIssue({\n\t\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\t\tmessage: `${field} is only valid for update_artist_settings`,\n\t\t\t\t\t\tpath: [field],\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\nexport const DynamoiUpdateSmartLinkArtistSettingsInputSchema = z\n\t.object({\n\t\tartistId: z.string().uuid(),\n\t\tclientRequestId: ClientRequestIdSchema,\n\t\tgoogleAdsConversionId: z.string().trim().max(32).nullable().optional(),\n\t\tmetaPixelId: z.string().trim().max(32).nullable().optional(),\n\t\ttheme: SmartLinkThemeSchema.optional(),\n\t\ttiktokPixelId: z.string().trim().max(32).nullable().optional(),\n\t\tuserIntentSummary: UserIntentSummarySchema,\n\t})\n\t.strict()\n\t.superRefine((data, ctx) => {\n\t\tif (\n\t\t\tdata.theme === undefined &&\n\t\t\tdata.metaPixelId === undefined &&\n\t\t\tdata.tiktokPixelId === undefined &&\n\t\t\tdata.googleAdsConversionId === undefined\n\t\t) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tmessage: \"Provide at least one setting to update\",\n\t\t\t\tpath: [\"theme\"],\n\t\t\t});\n\t\t}\n\t});\n\nexport const PHASE_4_TOOL_DEFINITIONS = [\n\t{\n\t\tdescription:\n\t\t\t\"Use this when the user wants to create one free Dynamoi Smart Link from a Spotify album or track URL/URI, or a single starter release from a Spotify artist URL. For full-catalog artist imports or artist hub requests, prefer dynamoi_create_smart_links_from_spotify_artist. Smart Links are free to create and manage. High-popularity or unverifiable artist links may stay unpublished in verification hold until Dynamoi can verify the client relationship. 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; if customDescription is provided, update that Smart Link's public description. In the final answer, lead with the public URL and do not expose internal IDs unless asked.\",\n\t\tdestructiveHint: true,\n\t\tidempotentHint: true,\n\t\tname: \"dynamoi_create_smart_link_from_spotify\",\n\t\topenWorldHint: true,\n\t\toutputSchema: CreateSmartLinkFromSpotifyOutputEnvelopeSchema,\n\t\treadOnlyHint: false,\n\t\tschema: DynamoiCreateSmartLinkFromSpotifyInputSchema,\n\t\ttitle: \"Create Free Smart Link from Spotify\",\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"Use this when the user gives a Spotify artist URL and wants Dynamoi to create, import, or refresh free Smart Links for the artist catalog and return the artist hub. If the signed-in user has no Dynamoi artist yet, omit artistId so Dynamoi can create the first artist from the Spotify artist profile. This starts the background catalog import so the user does not need to open the dashboard. Smart Links are free to create and manage. High-popularity or unverifiable artist catalog links may stay unpublished in verification hold until Dynamoi can verify the client relationship. This does not create a paid ad campaign. In the final answer, lead with the artist hub URL and current public Smart Link URLs; do not expose internal IDs unless asked.\",\n\t\tdestructiveHint: true,\n\t\tidempotentHint: true,\n\t\tname: \"dynamoi_create_smart_links_from_spotify_artist\",\n\t\topenWorldHint: true,\n\t\toutputSchema: CreateSmartLinksFromSpotifyArtistOutputEnvelopeSchema,\n\t\treadOnlyHint: false,\n\t\tschema: DynamoiCreateSmartLinksFromSpotifyArtistInputSchema,\n\t\ttitle: \"Create Free Smart Links for Spotify Artist\",\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"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. In the final answer, show public URLs and avoid internal IDs unless asked. If empty for an artist with connected Spotify, suggest dynamoi_create_smart_links_from_spotify_artist for catalog import or dynamoi_create_smart_link_from_spotify for one release instead of stopping at 'no Smart Links yet'.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_list_smart_links\",\n\t\topenWorldHint: false,\n\t\toutputSchema: ListSmartLinksOutputEnvelopeSchema,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiListSmartLinksInputSchema,\n\t\ttitle: \"List Smart Links\",\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"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. Set includeAnalytics=true for visit/click analytics and includeArtistSettings=true for artist-level theme/pixel settings. In the final answer, lead with the public URL and do not expose internal IDs unless asked.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_get_smart_link\",\n\t\topenWorldHint: false,\n\t\toutputSchema: AnyOutputEnvelopeSchema,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiGetSmartLinkInputSchema,\n\t\ttitle: \"Get Smart Link\",\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"Use this when the user wants to change one Smart Link's public description or update artist-level Smart Link theme/pixel settings. Set action to update_description or update_artist_settings. Public availability is artist-wide in the dashboard; this tool does not publish or unpublish individual links. Theme-only updates switch instantly; description or pixel changes may queue background rendering.\",\n\t\tdestructiveHint: true,\n\t\tidempotentHint: true,\n\t\tname: \"dynamoi_update_smart_link\",\n\t\topenWorldHint: true,\n\t\toutputSchema: AnyOutputEnvelopeSchema,\n\t\treadOnlyHint: false,\n\t\tschema: DynamoiUpdateSmartLinkInputSchema,\n\t\ttitle: \"Update Smart Link\",\n\t},\n] as const;\n",
5
+ "import * as z from \"zod/v4\";\nimport type { ResultEnvelope } from \"../types\";\nimport { AnyOutputEnvelopeSchema } from \"./output-schemas\";\n\n// Company facts mirror the canonical /about page\n// (apps/public-static/src/components/marketing/about-v3/AboutPageV3.astro).\nconst DYNAMOI_ABOUT_INTRO =\n\t\"Dynamoi is a music marketing platform founded in 2021 by Trevor Loucks. It runs managed Meta and YouTube ad campaigns, music distribution, and royalty analytics for independent artists, labels, managers, and YouTube creators, alongside free Smart Links and analytics. An artist can go from a Spotify URL to a shareable release page, a running campaign, or a distribution application in one place: Dynamoi brings the whole artist lifecycle (distribution, campaigns, and royalties) into one system.\";\n\nconst DYNAMOI_ABOUT_COMPANY = `## Company\n\n- **Founded** — 2021, by Trevor Loucks (Founder & CEO).\n- **Headquarters** — Sioux Falls, South Dakota, United States.\n- **Operating model** — Dynamoi is operated by humans, assisted by AI. People make the decisions and are accountable for every campaign and support reply; AI assists with ad creative, campaign monitoring, reporting, and routine tasks.\n- **Support** — email support@dynamoi.com. The Dynamoi team replies within 24 hours.`;\n\nconst DYNAMOI_ABOUT_CAMPAIGN_NOTE =\n\t\"Campaigns run on Dynamoi's own managed Meta and Google ad infrastructure, so artists do not need their own Business Manager, pixels, or ad accounts. They reach real people through official ad networks, never bots, fake streams, click farms, or paid playlist placement. Results vary by campaign and are never guaranteed.\";\n\nconst DYNAMOI_ABOUT_SMART_LINKS_BULLET =\n\t\"- **Free Smart Links** — create and manage Smart Links and artist hubs from Spotify artist, album, or track URLs at no cost. Link analytics, custom themes, validated pixel IDs, and team seats are included. High-popularity or unverifiable artist links may stay unpublished in verification hold until Dynamoi can verify the client relationship.\";\n\nconst DYNAMOI_ABOUT_YOUTUBE_BULLET =\n\t\"- **YouTube campaigns** — managed Google Ads campaigns for YouTube channel growth. Dynamoi optimizes ad spend against AdSense revenue per country, so delivery favors audiences that actually monetize.\";\n\nconst DYNAMOI_ABOUT_DISTRIBUTION_GATE =\n\t\"Dynamoi scores five requirements before an application can be submitted — including an established audience (at least 10,000 monthly Spotify listeners) and identity verification — and approval is not guaranteed.\";\n\nconst DYNAMOI_ABOUT_GETTING_STARTED = `## How to get started\n\n1. Sign in at https://dynamoi.com.\n2. Connect your Spotify artist profile.\n3. Create a free Smart Link for a release.`;\n\nexport const DYNAMOI_ABOUT_MARKDOWN = `# About Dynamoi\n\n${DYNAMOI_ABOUT_INTRO}\n\n## What Dynamoi offers\n\n${DYNAMOI_ABOUT_SMART_LINKS_BULLET}\n- **Managed Smart Campaigns** — Dynamoi runs Meta ad campaigns that promote Spotify tracks, albums, and playlists.\n${DYNAMOI_ABOUT_YOUTUBE_BULLET}\n- **Music distribution** — an opt-in product that delivers releases to 100+ stores including Spotify, Apple Music, Amazon Music, YouTube Music, TikTok, Deezer, and Tidal. The artist keeps 90% of Net Receipts (Dynamoi keeps 10%), there are no upfront release fees, and Content ID is included. Optional publishing administration is available to distribution clients for 10% of Net Receipts. ${DYNAMOI_ABOUT_DISTRIBUTION_GATE}\n- **YouTube promotion Shop** — one-off YouTube promotion purchases without a subscription, for users who do not want managed advertising.\n\n${DYNAMOI_ABOUT_CAMPAIGN_NOTE}\n\n${DYNAMOI_ABOUT_COMPANY}\n\n${DYNAMOI_ABOUT_GETTING_STARTED}\n\n## Pricing\n\nSmart Links are free. Starter is $25/month with a $50 launch campaign credit, and campaign budgets start at $10/day. There are no contracts: pause between releases or cancel anytime and keep your free tools. Managed advertising and distribution are paid products — see current plans and pricing at https://dynamoi.com/pricing.`;\n\n// Directory-profile variant: no pricing, plans, or Shop purchase lines, so the\n// review-safe surface never advertises spend or checkout paths.\nexport const DYNAMOI_ABOUT_DIRECTORY_MARKDOWN = `# About Dynamoi\n\n${DYNAMOI_ABOUT_INTRO}\n\n## What Dynamoi offers\n\n${DYNAMOI_ABOUT_SMART_LINKS_BULLET}\n- **Managed Smart Campaigns** — Dynamoi runs Meta ad campaigns that promote Spotify tracks, albums, and playlists.\n${DYNAMOI_ABOUT_YOUTUBE_BULLET}\n- **Music distribution** — an opt-in product that delivers releases to 100+ stores including Spotify, Apple Music, Amazon Music, YouTube Music, TikTok, Deezer, and Tidal. ${DYNAMOI_ABOUT_DISTRIBUTION_GATE}\n\n${DYNAMOI_ABOUT_CAMPAIGN_NOTE}\n\n${DYNAMOI_ABOUT_COMPANY}\n\n${DYNAMOI_ABOUT_GETTING_STARTED}`;\n\nconst DYNAMOI_ABOUT_SUMMARY =\n\t\"Dynamoi is a music marketing platform founded in 2021 by Trevor Loucks and based in Sioux Falls, South Dakota: free Smart Links and analytics, managed Meta Smart Campaigns and YouTube campaigns, a YouTube promotion Shop, and opt-in distribution to 100+ stores. Operated by humans, assisted by AI. Starter is $25/month with a $50 launch campaign credit, and campaign budgets start at $10/day. Sign in at dynamoi.com, connect Spotify, and create a free Smart Link to start. Pricing: https://dynamoi.com/pricing. Support: support@dynamoi.com (replies within 24 hours).\";\n\nconst DYNAMOI_ABOUT_DIRECTORY_SUMMARY =\n\t\"Dynamoi is a music marketing platform founded in 2021 by Trevor Loucks and based in Sioux Falls, South Dakota: free Smart Links and analytics, managed Meta Smart Campaigns and YouTube campaigns, and opt-in distribution to 100+ stores. Operated by humans, assisted by AI. Sign in at dynamoi.com, connect Spotify, and create a free Smart Link to start. Support: support@dynamoi.com (replies within 24 hours).\";\n\nexport const DYNAMOI_ABOUT_RESOURCE = {\n\tdescription:\n\t\t\"Canonical About Dynamoi overview: what Dynamoi is, who it is for, free Smart Links, managed Smart Campaigns, YouTube campaigns, distribution, company facts, support, and how to get started.\",\n\tmimeType: \"text/markdown\",\n\tname: \"dynamoi_about\",\n\ttitle: \"About Dynamoi\",\n\turi: \"dynamoi://about\",\n} as const;\n\nexport const DYNAMOI_ABOUT_TOOL_DEFINITION = {\n\tdescription:\n\t\t\"Use this when the user asks what Dynamoi is, who it is for, or what it offers — including before sign-in or before choosing a tool. Returns the canonical About Dynamoi text plus a short structured summary covering free Smart Links, managed Smart Campaigns, YouTube campaigns, distribution, company facts, support, and getting started. This is read-only product information, not account data.\",\n\tdestructiveHint: false,\n\tidempotentHint: true,\n\tname: \"dynamoi_about\",\n\topenWorldHint: false,\n\toutputSchema: AnyOutputEnvelopeSchema,\n\treadOnlyHint: true,\n\tschema: z.object({}).strict(),\n\ttitle: \"About Dynamoi\",\n} as const;\n\nexport function getDynamoiAbout(options?: {\n\ttoolProfile?: \"full\" | \"directory\" | undefined;\n}): ResultEnvelope<{\n\tlinks: {\n\t\tdashboard: string;\n\t\tpricing?: string;\n\t\tsignIn: string;\n\t\tsupport: string;\n\t};\n\tmarkdown: string;\n\tsummary: string;\n}> {\n\t// Fail closed: the pricing/Shop-bearing variant requires an explicit full profile.\n\tconst isFull = options?.toolProfile === \"full\";\n\treturn {\n\t\tdata: {\n\t\t\tlinks: {\n\t\t\t\tdashboard: \"https://dynamoi.com/dashboard\",\n\t\t\t\t...(isFull ? { pricing: \"https://dynamoi.com/pricing\" } : {}),\n\t\t\t\tsignIn: \"https://dynamoi.com\",\n\t\t\t\tsupport: \"mailto:support@dynamoi.com\",\n\t\t\t},\n\t\t\tmarkdown: isFull\n\t\t\t\t? DYNAMOI_ABOUT_MARKDOWN\n\t\t\t\t: DYNAMOI_ABOUT_DIRECTORY_MARKDOWN,\n\t\t\tsummary: isFull ? DYNAMOI_ABOUT_SUMMARY : DYNAMOI_ABOUT_DIRECTORY_SUMMARY,\n\t\t},\n\t\tstatus: \"success\",\n\t};\n}\n",
6
+ "import * as z from \"zod/v4\";\n\nconst ResultErrorCodeSchema = z.enum([\n\t\"ACCOUNT_READ_ONLY\",\n\t\"INVALID_SPOTIFY_SOURCE\",\n\t\"CAPABILITY_REQUIRED\",\n\t\"INSUFFICIENT_SCOPE\",\n\t\"STATE_CONFLICT\",\n\t\"QUOTE_CHANGED\",\n\t\"RATE_LIMITED\",\n\t\"OUTPUT_INVALID\",\n\t\"UNKNOWN_EFFECT\",\n]);\n\nconst ResultNextActionSchema = z\n\t.object({\n\t\tfield: z.string().trim().min(1).max(120).optional(),\n\t\tkind: z.enum([\"provide_input\", \"read_status\", \"reconnect\", \"handoff\"]),\n\t\treason: z.string().trim().min(1).max(240).optional(),\n\t})\n\t.strict();\n\n/** Optional, additive recovery metadata for error envelopes. */\nexport const ResultErrorRecoverySchema = z\n\t.object({\n\t\tcode: ResultErrorCodeSchema.optional(),\n\t\tfield: z.string().trim().min(1).max(120).optional(),\n\t\tnextAction: ResultNextActionSchema.optional(),\n\t\tprerequisite: z.string().trim().min(1).max(240).optional(),\n\t\tretryAfterSeconds: z.number().int().min(0).max(86_400).optional(),\n\t\tretryable: z.boolean().optional(),\n\t})\n\t.strict();\n\n/**\n * Retryable recovery is reserved for a bounded rate-limit wait. Producers are\n * responsible for confirming that retrying their operation is safe to repeat.\n */\nexport function addRecoverySafetyIssues(\n\tvalue: z.infer<typeof ResultErrorRecoverySchema>,\n\tcontext: z.RefinementCtx,\n) {\n\tif (value.retryAfterSeconds !== undefined && value.retryable !== true) {\n\t\tcontext.addIssue({\n\t\t\tcode: \"custom\",\n\t\t\tmessage: \"Retry timing requires retryable=true.\",\n\t\t\tpath: [\"retryAfterSeconds\"],\n\t\t});\n\t}\n\tif (value.retryable !== true) {\n\t\treturn;\n\t}\n\tif (value.code !== \"RATE_LIMITED\") {\n\t\tcontext.addIssue({\n\t\t\tcode: \"custom\",\n\t\t\tmessage: \"Only RATE_LIMITED results may be retryable.\",\n\t\t\tpath: [\"retryable\"],\n\t\t});\n\t}\n\tif (value.retryAfterSeconds === undefined || value.retryAfterSeconds <= 0) {\n\t\tcontext.addIssue({\n\t\t\tcode: \"custom\",\n\t\t\tmessage: \"Retryable results require a positive retryAfterSeconds value.\",\n\t\t\tpath: [\"retryAfterSeconds\"],\n\t\t});\n\t}\n}\n\nconst RESULT_ERROR_RECOVERY_FIELDS = [\n\t\"code\",\n\t\"field\",\n\t\"nextAction\",\n\t\"prerequisite\",\n\t\"retryable\",\n\t\"retryAfterSeconds\",\n] as const;\n\nconst MoneyDisplayOutputSchema = z\n\t.object({\n\t\tamountUsd: z.number(),\n\t\tformatted: z.string(),\n\t})\n\t.strict();\n\nfunction createOutputEnvelopeSchema(\n\tdataSchema: z.ZodType,\n\toptions?: { allowPartial?: boolean },\n) {\n\tconst statuses = options?.allowPartial\n\t\t? ([\"success\", \"partial_success\", \"error\"] as const)\n\t\t: ([\"success\", \"error\"] as const);\n\treturn z\n\t\t.object({\n\t\t\tdata: dataSchema.optional(),\n\t\t\tkind: z\n\t\t\t\t.enum([\"validation\", \"business\", \"platform\", \"unknown\"])\n\t\t\t\t.optional(),\n\t\t\tmessage: z.string().optional(),\n\t\t\t...ResultErrorRecoverySchema.shape,\n\t\t\tstatus: z.enum(statuses),\n\t\t})\n\t\t.strict()\n\t\t.superRefine((value, context) => {\n\t\t\tif (value.status === \"error\" && !value.message) {\n\t\t\t\tcontext.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tmessage: \"Error tool results require a message.\",\n\t\t\t\t\tpath: [\"message\"],\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (value.status !== \"error\" && value.data === undefined) {\n\t\t\t\tcontext.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tmessage: \"Successful tool results require data.\",\n\t\t\t\t\tpath: [\"data\"],\n\t\t\t\t});\n\t\t\t}\n\t\t\tconst valueRecord = value as Record<string, unknown>;\n\t\t\tif (value.status !== \"error\") {\n\t\t\t\tfor (const field of RESULT_ERROR_RECOVERY_FIELDS) {\n\t\t\t\t\tif (valueRecord[field] !== undefined) {\n\t\t\t\t\t\tcontext.addIssue({\n\t\t\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\t\t\tmessage: \"Recovery metadata is only valid on error results.\",\n\t\t\t\t\t\t\tpath: [field],\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\taddRecoverySafetyIssues(value, context);\n\t\t});\n}\n\nconst AnyToolDataOutputSchema = z.object({}).passthrough();\n\nconst MediaAssetSummaryOutputSchema = z\n\t.object({\n\t\taspectRatio: z.string().optional(),\n\t\tcreatedAt: z.string(),\n\t\tfileName: z.string().optional(),\n\t\tfileType: z.string(),\n\t\theight: z.number().optional(),\n\t\tid: z.string(),\n\t\turl: z.string().optional(),\n\t\turlExpiresAt: z.string().optional(),\n\t\twidth: z.number().optional(),\n\t})\n\t.strict();\n\nconst ListMediaAssetsDataOutputSchema = z\n\t.object({\n\t\tassets: z.array(MediaAssetSummaryOutputSchema),\n\t\tnextCursor: z.string().optional(),\n\t})\n\t.strict();\n\nconst ListMediaAssetsSummaryOutputSchema = z\n\t.object({\n\t\tnextCursor: z.string().optional(),\n\t\tsummary: z.string(),\n\t\ttotalCount: z.number(),\n\t})\n\t.strict();\n\nconst SmartLinkStatusSchemas = {\n\tclaimStatus: z.enum([\n\t\t\"auto_approved\",\n\t\t\"pending_ops_review\",\n\t\t\"verification_deferred\",\n\t\t\"approved_by_ops\",\n\t\t\"rejected\",\n\t]),\n\tpublishState: z.enum([\"published\", \"unpublished\"]),\n\trenderState: z.enum([\"queued\", \"rendering\", \"rendered\", \"failed\"]),\n\ttakedownStatus: z.enum([\"none\", \"active\", \"resolved\"]),\n\ttheme: z.enum([\"classic\", \"brutalist\", \"aurora\", \"cinematic\"]),\n};\n\nconst SmartLinkSummaryOutputSchema = z\n\t.object({\n\t\tartistHubUrl: z.string(),\n\t\tartistId: z.string(),\n\t\tartistName: z.string(),\n\t\tclaimStatus: SmartLinkStatusSchemas.claimStatus,\n\t\tcreatedAt: z.string(),\n\t\tid: z.string(),\n\t\tisPublic: z.boolean(),\n\t\tlocalizedPublicUrls: z.array(z.string()).optional(),\n\t\tpublicUrl: z.string(),\n\t\tpublishState: SmartLinkStatusSchemas.publishState,\n\t\treleaseSlug: z.string(),\n\t\treleaseTitle: z.string(),\n\t\treleaseType: z.string(),\n\t\trenderState: SmartLinkStatusSchemas.renderState,\n\t\tspotifyUrl: z.string().nullable(),\n\t\ttakedownStatus: SmartLinkStatusSchemas.takedownStatus,\n\t\ttheme: SmartLinkStatusSchemas.theme,\n\t\tupdatedAt: z.string(),\n\t})\n\t.strict();\n\nconst SmartLinkDetailsOutputSchema = SmartLinkSummaryOutputSchema.extend({\n\tactionRequired: z.array(z.string()).optional(),\n\tcustomDescription: z.string().nullable(),\n\tnextActions: z.array(z.string()),\n\toriginalSpotifyUrl: z.string().nullable(),\n\tsummary: z.string(),\n\twarnings: z.array(z.string()).optional(),\n}).strict();\n\nconst ListSmartLinksDataOutputSchema = z\n\t.object({\n\t\tnextCursor: z.string().optional(),\n\t\tsmartLinks: z.array(SmartLinkSummaryOutputSchema),\n\t})\n\t.strict();\n\nconst ListSmartLinksSummaryOutputSchema = z\n\t.object({\n\t\tnextCursor: z.string().optional(),\n\t\tsummary: z.string(),\n\t\ttotalCount: z.number(),\n\t})\n\t.strict();\n\nconst AvailableCountryOutputSchema = z\n\t.object({\n\t\tcode: z.string(),\n\t\tdominantLanguage: z.string().optional(),\n\t\tgoogleAdsId: z.number(),\n\t\tname: z.string(),\n\t})\n\t.strict();\n\nconst ListAvailableCountriesDataOutputSchema = z\n\t.object({\n\t\tcampaignType: z.enum([\"SMART_CAMPAIGN\", \"YOUTUBE\"]),\n\t\tcountries: z.array(AvailableCountryOutputSchema),\n\t\tnextCursor: z.string().optional(),\n\t\tnotes: z.array(z.string()),\n\t\tsource: z.enum([\"SMART_CAMPAIGN_COUNTRIES\", \"GOOGLE_ADS_COUNTRIES\"]),\n\t\ttotalCount: z.number(),\n\t})\n\t.strict();\n\nconst SummaryCountOutputSchema = z\n\t.object({\n\t\tnextCursor: z.string().optional(),\n\t\tsummary: z.string(),\n\t\ttotalCount: z.number(),\n\t})\n\t.strict();\n\nconst SummaryWarningsActionsOutputSchema = z\n\t.object({\n\t\tactionRequired: z.array(z.string()).optional(),\n\t\tsummary: z.string(),\n\t\twarnings: z.array(z.string()).optional(),\n\t})\n\t.strict();\n\nconst NormalizedTargetingOutputSchema = z.union([\n\tz.object({ mode: z.literal(\"GLOBAL\") }).strict(),\n\tz\n\t\t.object({\n\t\t\tcountries: z.array(\n\t\t\t\tz.object({ code: z.string(), name: z.string() }).strict(),\n\t\t\t),\n\t\t\tmode: z.literal(\"COUNTRIES\"),\n\t\t})\n\t\t.strict(),\n]);\n\nconst GetCampaignReadinessDataOutputSchema = z\n\t.object({\n\t\tartistId: z.string(),\n\t\tartistName: z.string(),\n\t\tblockingIssues: z.array(z.string()),\n\t\tcampaignType: z.enum([\"SMART_CAMPAIGN\", \"YOUTUBE\"]),\n\t\tisReady: z.boolean(),\n\t\tmissingInputs: z.array(z.string()),\n\t\tnormalizedTargeting: NormalizedTargetingOutputSchema,\n\t\trecommendedNextAction: z.string(),\n\t\twarnings: z.array(z.string()),\n\t})\n\t.strict();\n\nconst CreateSmartLinkFromSpotifyDataOutputSchema =\n\tSmartLinkDetailsOutputSchema.extend({\n\t\toutcome: z.enum([\"created\", \"existing\"]),\n\t\tworkflowWarning: z.string().nullable(),\n\t}).strict();\n\nconst CreateSmartLinksFromSpotifyArtistDataOutputSchema = z\n\t.object({\n\t\tartistCreatedFromSpotify: z.boolean().optional(),\n\t\tartistHubUrl: z.string(),\n\t\tartistId: z.string(),\n\t\tartistName: z.string(),\n\t\tcatalogImportStatus: z.enum([\"started\", \"start_failed\"]),\n\t\tcurrentSmartLinkCount: z.number(),\n\t\texistingCount: z.number(),\n\t\tinitialSmartLink: SmartLinkSummaryOutputSchema.nullable(),\n\t\tnewlyAvailableCount: z.number(),\n\t\tnextActions: z.array(z.string()),\n\t\tsmartLinks: z.array(SmartLinkSummaryOutputSchema),\n\t\tspotifyArtistUrl: z.string(),\n\t\tsummary: z.string(),\n\t\twarnings: z.array(z.string()).optional(),\n\t})\n\t.strict();\n\nconst LaunchCampaignDataOutputSchema = z\n\t.object({\n\t\tbudget: MoneyDisplayOutputSchema,\n\t\tbudgetType: z.enum([\"DAILY\", \"TOTAL\"]),\n\t\tcampaignType: z.enum([\"SMART_CAMPAIGN\", \"YOUTUBE\"]),\n\t\tcontentTitle: z.string(),\n\t\tdeliveryState: z.enum([\"ACTIVE\", \"PENDING_REVIEW\", \"CONTENT_VALIDATION\"]),\n\t\tid: z.string(),\n\t\tisLive: z.boolean(),\n\t\tnextSteps: z.array(z.string()),\n\t\tplatforms: z.array(z.string()),\n\t\tstatus: z.string(),\n\t\tsummary: z.string(),\n\t\twarnings: z.array(z.string()).optional(),\n\t})\n\t.strict();\n\nexport const AnyOutputEnvelopeSchema = createOutputEnvelopeSchema(\n\tAnyToolDataOutputSchema,\n\t{ allowPartial: true },\n);\n\nexport const ListMediaAssetsOutputEnvelopeSchema = createOutputEnvelopeSchema(\n\tz.union([\n\t\tListMediaAssetsDataOutputSchema,\n\t\tListMediaAssetsSummaryOutputSchema,\n\t]),\n);\n\nexport const LaunchCampaignOutputEnvelopeSchema = createOutputEnvelopeSchema(\n\tLaunchCampaignDataOutputSchema,\n);\n\nexport const ListAvailableCountriesOutputEnvelopeSchema =\n\tcreateOutputEnvelopeSchema(\n\t\tz.union([ListAvailableCountriesDataOutputSchema, SummaryCountOutputSchema]),\n\t);\n\nexport const GetCampaignReadinessOutputEnvelopeSchema =\n\tcreateOutputEnvelopeSchema(\n\t\tz.union([\n\t\t\tGetCampaignReadinessDataOutputSchema,\n\t\t\tSummaryWarningsActionsOutputSchema,\n\t\t]),\n\t);\n\nexport const CreateSmartLinkFromSpotifyOutputEnvelopeSchema =\n\tcreateOutputEnvelopeSchema(CreateSmartLinkFromSpotifyDataOutputSchema);\n\nexport const CreateSmartLinksFromSpotifyArtistOutputEnvelopeSchema =\n\tcreateOutputEnvelopeSchema(CreateSmartLinksFromSpotifyArtistDataOutputSchema);\n\nexport const ListSmartLinksOutputEnvelopeSchema = createOutputEnvelopeSchema(\n\tz.union([ListSmartLinksDataOutputSchema, ListSmartLinksSummaryOutputSchema]),\n);\n",
7
+ "import {\n\ttype CacheHint,\n\ttype CallToolResult,\n\tMcpServer,\n\ttype ServerOptions,\n\ttype Tool,\n} from \"@modelcontextprotocol/server\";\nimport * as z from \"zod/v4\";\nimport {\n\tDYNAMOI_BETTER_AUTH_MCP_SCOPES,\n\tDYNAMOI_MCP_TOOL_SCOPES,\n} from \"../auth/protected-resource\";\nimport type {\n\tApplyForDistributionData,\n\tCreateSmartLinkFromSpotifyData,\n\tCreateSmartLinksFromSpotifyArtistData,\n\tGetArtistAnalyticsJsonData,\n\tGetArtistAnalyticsSummaryData,\n\tGetArtistData,\n\tGetArtistSummaryData,\n\tGetBillingData,\n\tGetBillingSummaryData,\n\tGetCampaignData,\n\tGetCampaignReadinessData,\n\tGetCampaignReadinessSummaryData,\n\tGetCampaignSummaryData,\n\tGetCurrentUserData,\n\tGetCurrentUserSummaryData,\n\tGetDistributionApplicationData,\n\tGetPlatformStatusData,\n\tGetPlatformStatusSummaryData,\n\tGetSmartLinkData,\n\tGetSmartLinkSummaryData,\n\tLaunchCampaignData,\n\tListArtistsData,\n\tListArtistsSummaryData,\n\tListAvailableCountriesData,\n\tListAvailableCountriesSummaryData,\n\tListCampaignsJsonData,\n\tListCampaignsSummaryData,\n\tListMediaAssetsData,\n\tListMediaAssetsSummaryData,\n\tListSmartLinksData,\n\tListSmartLinksSummaryData,\n\tResultEnvelope,\n\tSearchData,\n\tSearchSummaryData,\n\tSmartLinkSettingsData,\n\tStartMetaConnectionData,\n\tStartYoutubeChannelLinkData,\n\tUpdateCampaignData,\n\tUpdateSmartLinkArtistSettingsData,\n\tUpdateSmartLinkData,\n} from \"../types\";\nimport { DYNAMOI_MCP_VERSION } from \"../version\";\nimport {\n\tDYNAMOI_ABOUT_DIRECTORY_MARKDOWN,\n\tDYNAMOI_ABOUT_MARKDOWN,\n\tDYNAMOI_ABOUT_RESOURCE,\n\tDYNAMOI_ABOUT_TOOL_DEFINITION,\n\tgetDynamoiAbout,\n} from \"./about\";\nimport { DISTRIBUTION_TOOL_DEFINITIONS } from \"./distribution-tools\";\nimport {\n\tDYNAMOI_CHATGPT_APP_INSTRUCTIONS,\n\tDYNAMOI_MCP_INSTRUCTIONS,\n} from \"./instructions\";\nimport type { OpenAiFetchData, OpenAiSearchData } from \"./openai-tools\";\nimport { ResultErrorRecoverySchema } from \"./output-schemas\";\nimport { registerDynamoiPrompts } from \"./prompts\";\nimport { registerDynamoiResources } from \"./resources\";\nimport {\n\ttype DynamoiShopCheckoutData,\n\ttype DynamoiShopQuoteData,\n\tSHOP_TOOL_DEFINITIONS,\n} from \"./shop-tools\";\nimport {\n\tpreviewSmartLinkThemes,\n\tregisterSmartLinkThemePreviewResource,\n\tSMART_LINK_THEME_PREVIEW_RESOURCE_URI,\n\tSMART_LINK_THEME_PREVIEW_TOOL_DEFINITION,\n} from \"./smart-link-theme-preview\";\nimport { PHASE_4_TOOL_DEFINITIONS } from \"./smart-link-tools\";\nimport {\n\tPHASE_1_TOOL_DEFINITIONS,\n\tPHASE_2_TOOL_DEFINITIONS,\n\tPHASE_ONBOARDING_TOOL_DEFINITIONS,\n} from \"./tools\";\nimport { PHASE_3_TOOL_DEFINITIONS } from \"./workflow-tools\";\n\ntype DynamoiToolSecurityScheme =\n\t| { scopes: string[]; type: \"oauth2\" }\n\t| { type: \"noauth\" };\n\n/** A tool that needs no scopes is public and callable before sign-in. */\nfunction buildDynamoiToolSecuritySchemes(\n\tscopes: readonly string[],\n): DynamoiToolSecurityScheme[] {\n\treturn scopes.length === 0\n\t\t? [{ type: \"noauth\" }]\n\t\t: [{ scopes: [...scopes], type: \"oauth2\" }];\n}\n\ntype DynamoiToolMetadata = {\n\tsecuritySchemes: ReturnType<typeof buildDynamoiToolSecuritySchemes>;\n\tui?: { resourceUri: string };\n\t\"openai/outputTemplate\"?: string;\n};\n\ntype DynamoiToolAnnotations = {\n\tdestructiveHint: boolean;\n\tidempotentHint?: boolean;\n\topenWorldHint: boolean;\n\treadOnlyHint: boolean;\n};\n\nconst DescriptiveEntitySchema = z\n\t.object({\n\t\tid: z.string().optional(),\n\t\tname: z.string().optional(),\n\t\tpublicUrl: z.string().optional(),\n\t\tsummary: z.string().optional(),\n\t})\n\t.passthrough();\n\nconst DIRECTORY_DESCRIPTIVE_DATA_SCHEMAS = {\n\tdynamoi_get_account_overview: z\n\t\t.object({\n\t\t\tartistCount: z.number().optional(),\n\t\t\tartists: z\n\t\t\t\t.object({\n\t\t\t\t\tcount: z.number(),\n\t\t\t\t\tsummaries: z.array(DescriptiveEntitySchema),\n\t\t\t\t})\n\t\t\t\t.optional(),\n\t\t\torganizationCount: z.number().optional(),\n\t\t\trecommendedNextActions: z.array(z.string()).optional(),\n\t\t\tstate: z.object({}).passthrough().optional(),\n\t\t\tsummary: z.string().optional(),\n\t\t\tuser: z.object({ name: z.string().optional() }).optional(),\n\t\t})\n\t\t.passthrough(),\n\tdynamoi_get_artist_analytics: z\n\t\t.object({\n\t\t\tartistId: z.string().optional(),\n\t\t\tartistName: z.string().optional(),\n\t\t\tdateRange: z.object({ end: z.string(), start: z.string() }).optional(),\n\t\t\tsummary: z.string().optional(),\n\t\t})\n\t\t.passthrough(),\n\tdynamoi_get_campaign: DescriptiveEntitySchema.extend({\n\t\tartistId: z.string().optional(),\n\t\tcontentTitle: z.string().optional(),\n\t\tnextActions: z.array(z.string()).optional(),\n\t\tstatus: z.string().optional(),\n\t}).passthrough(),\n\tdynamoi_get_platform_status: z\n\t\t.object({\n\t\t\tartistId: z.string().optional(),\n\t\t\tartistName: z.string().optional(),\n\t\t\tplatforms: z.object({}).passthrough().optional(),\n\t\t\tsummary: z.string().optional(),\n\t\t})\n\t\t.passthrough(),\n\tdynamoi_get_smart_link: DescriptiveEntitySchema.extend({\n\t\tartistId: z.string().optional(),\n\t\tartistName: z.string().optional(),\n\t\tnextActions: z.array(z.string()).optional(),\n\t\tpublishState: z.string().optional(),\n\t\treleaseTitle: z.string().optional(),\n\t\ttheme: z.string().optional(),\n\t}).passthrough(),\n\tdynamoi_list_artists: z\n\t\t.object({\n\t\t\tartists: z.array(DescriptiveEntitySchema).optional(),\n\t\t\tnextCursor: z.string().optional(),\n\t\t\tsummary: z.string().optional(),\n\t\t\ttotalCount: z.number().optional(),\n\t\t})\n\t\t.passthrough(),\n\tdynamoi_list_campaigns: z\n\t\t.object({\n\t\t\tcampaigns: z.array(DescriptiveEntitySchema).optional(),\n\t\t\tnextCursor: z.string().optional(),\n\t\t\tsummary: z.string().optional(),\n\t\t\ttotalCount: z.number().optional(),\n\t\t})\n\t\t.passthrough(),\n\tdynamoi_preview_smart_link_themes: z\n\t\t.object({\n\t\t\tartistName: z.string(),\n\t\t\treleaseTitle: z.string(),\n\t\t\tthemes: z.array(DescriptiveEntitySchema),\n\t\t})\n\t\t.passthrough(),\n\tdynamoi_search: z\n\t\t.object({\n\t\t\tnextCursor: z.string().optional(),\n\t\t\tresults: z.array(DescriptiveEntitySchema).optional(),\n\t\t\tsummary: z.string().optional(),\n\t\t\ttotalCount: z.number().optional(),\n\t\t})\n\t\t.passthrough(),\n\tdynamoi_update_smart_link: DescriptiveEntitySchema.extend({\n\t\tartistId: z.string().optional(),\n\t\tartistName: z.string().optional(),\n\t\tdefaultTheme: z.string().optional(),\n\t\trenderQueuedCount: z.number().optional(),\n\t\trenderWarning: z.string().nullable().optional(),\n\t}).passthrough(),\n\tfetch: DescriptiveEntitySchema,\n\tsearch: z\n\t\t.object({ results: z.array(DescriptiveEntitySchema).optional() })\n\t\t.passthrough(),\n} as const;\n\nfunction getAdvertisedToolOutputSchema(options: {\n\tcanonical: z.ZodType;\n\ttoolName: string;\n\ttoolProfile: DynamoiMcpToolProfile;\n}) {\n\tif (options.toolProfile !== \"directory\") {\n\t\treturn options.canonical;\n\t}\n\tconst dataSchema =\n\t\tDIRECTORY_DESCRIPTIVE_DATA_SCHEMAS[\n\t\t\toptions.toolName as keyof typeof DIRECTORY_DESCRIPTIVE_DATA_SCHEMAS\n\t\t];\n\tif (!dataSchema) {\n\t\treturn options.canonical;\n\t}\n\treturn z\n\t\t.object({\n\t\t\tdata: dataSchema.optional(),\n\t\t\tkind: z.string().optional(),\n\t\t\tmessage: z.string().optional(),\n\t\t\t...ResultErrorRecoverySchema.shape,\n\t\t\tstatus: z.enum([\"success\", \"partial_success\", \"error\"]),\n\t\t})\n\t\t.passthrough();\n}\n\nfunction getDynamoiToolOAuthScopes(\n\ttoolName: keyof typeof DYNAMOI_MCP_TOOL_SCOPES,\n\tproviderScopes: readonly string[],\n): readonly string[] {\n\tconst requiredScopes = DYNAMOI_MCP_TOOL_SCOPES[toolName];\n\tconst missingScopes = requiredScopes.filter(\n\t\t(scope) => !providerScopes.includes(scope),\n\t);\n\tif (missingScopes.length > 0) {\n\t\tthrow new Error(\n\t\t\t`MCP provider does not support ${toolName} scopes: ${missingScopes.join(\", \")}`,\n\t\t);\n\t}\n\treturn requiredScopes;\n}\n\n/**\n * `directory` is the review-safe catalog for agent-directory clients;\n * `full` is every tool. The host selects the profile from the verified\n * OAuth client identity.\n */\nexport type DynamoiMcpToolProfile = \"full\" | \"directory\";\n\ntype DynamoiToolDefinition =\n\t| typeof DYNAMOI_ABOUT_TOOL_DEFINITION\n\t| (typeof PHASE_1_TOOL_DEFINITIONS)[number]\n\t| (typeof PHASE_ONBOARDING_TOOL_DEFINITIONS)[number]\n\t| (typeof PHASE_2_TOOL_DEFINITIONS)[number]\n\t| (typeof PHASE_3_TOOL_DEFINITIONS)[number]\n\t| (typeof PHASE_4_TOOL_DEFINITIONS)[number]\n\t| (typeof DISTRIBUTION_TOOL_DEFINITIONS)[number]\n\t| (typeof SHOP_TOOL_DEFINITIONS)[number]\n\t| typeof SMART_LINK_THEME_PREVIEW_TOOL_DEFINITION;\n\nconst DYNAMOI_TOOL_DEFINITIONS = [\n\tDYNAMOI_ABOUT_TOOL_DEFINITION,\n\t...PHASE_1_TOOL_DEFINITIONS,\n\t...PHASE_ONBOARDING_TOOL_DEFINITIONS,\n\t...PHASE_2_TOOL_DEFINITIONS,\n\t...PHASE_3_TOOL_DEFINITIONS,\n\t...DISTRIBUTION_TOOL_DEFINITIONS,\n\t...SHOP_TOOL_DEFINITIONS,\n\tSMART_LINK_THEME_PREVIEW_TOOL_DEFINITION,\n\t...PHASE_4_TOOL_DEFINITIONS,\n] as const satisfies readonly DynamoiToolDefinition[];\n\nconst MUTATING_TOOL_NAMES = new Set<string>(\n\tDYNAMOI_TOOL_DEFINITIONS.filter((definition) => !definition.readOnlyHint).map(\n\t\t(definition) => definition.name,\n\t),\n);\n\nconst DIRECTORY_EXCLUDED_TOOL_NAMES = new Set<string>([\n\t\"dynamoi_shop_create_checkout\",\n\t\"dynamoi_shop_get_quote\",\n\t\"dynamoi_get_billing\",\n\t\"dynamoi_get_campaign_readiness\",\n\t\"dynamoi_launch_campaign\",\n\t\"dynamoi_list_available_countries\",\n\t\"dynamoi_list_media_assets\",\n\t\"dynamoi_start_meta_connection\",\n\t\"dynamoi_start_youtube_channel_link\",\n\t\"dynamoi_update_campaign\",\n]);\n\nexport function getDynamoiToolDefinitions(options?: {\n\ttoolProfile?: DynamoiMcpToolProfile;\n}): DynamoiToolDefinition[] {\n\tconst definitions = [...DYNAMOI_TOOL_DEFINITIONS];\n\t// Fail closed: only an explicit full profile gets the whole catalog.\n\tif (options?.toolProfile === \"full\") {\n\t\treturn definitions;\n\t}\n\treturn definitions.filter(\n\t\t(definition) => !DIRECTORY_EXCLUDED_TOOL_NAMES.has(definition.name),\n\t);\n}\n\nexport type Phase3Adapter = {\n\tapplyForDistribution(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<ApplyForDistributionData>>;\n\tgetCurrentUser(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<GetCurrentUserData | GetCurrentUserSummaryData>>;\n\tgetDistributionApplication(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<GetDistributionApplicationData>>;\n\tlistArtists(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<ListArtistsData | ListArtistsSummaryData>>;\n\tsearch(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<SearchData | SearchSummaryData>>;\n\topenAiSearch(input: unknown): Promise<ResultEnvelope<OpenAiSearchData>>;\n\topenAiFetch(input: unknown): Promise<ResultEnvelope<OpenAiFetchData>>;\n\tgetArtist(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<GetArtistData | GetArtistSummaryData>>;\n\tgetArtistAnalytics(\n\t\tinput: unknown,\n\t): Promise<\n\t\tResultEnvelope<GetArtistAnalyticsJsonData | GetArtistAnalyticsSummaryData>\n\t>;\n\tlistCampaigns(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<ListCampaignsJsonData | ListCampaignsSummaryData>>;\n\tgetCampaign(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<GetCampaignData | GetCampaignSummaryData>>;\n\tgetBilling(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<GetBillingData | GetBillingSummaryData>>;\n\tstartMetaConnection(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<StartMetaConnectionData>>;\n\tgetPlatformStatus(\n\t\tinput: unknown,\n\t): Promise<\n\t\tResultEnvelope<GetPlatformStatusData | GetPlatformStatusSummaryData>\n\t>;\n\tstartYoutubeChannelLink(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<StartYoutubeChannelLinkData>>;\n\tlistAvailableCountries(\n\t\tinput: unknown,\n\t): Promise<\n\t\tResultEnvelope<\n\t\t\tListAvailableCountriesData | ListAvailableCountriesSummaryData\n\t\t>\n\t>;\n\tgetCampaignReadiness(\n\t\tinput: unknown,\n\t): Promise<\n\t\tResultEnvelope<GetCampaignReadinessData | GetCampaignReadinessSummaryData>\n\t>;\n\tupdateCampaign(input: unknown): Promise<ResultEnvelope<UpdateCampaignData>>;\n\tlistMediaAssets(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<ListMediaAssetsData | ListMediaAssetsSummaryData>>;\n\tlaunchCampaign(input: unknown): Promise<ResultEnvelope<LaunchCampaignData>>;\n\tcreateSmartLinkFromSpotify(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<CreateSmartLinkFromSpotifyData>>;\n\tcreateSmartLinksFromSpotifyArtist(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<CreateSmartLinksFromSpotifyArtistData>>;\n\tlistSmartLinks(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<ListSmartLinksData | ListSmartLinksSummaryData>>;\n\tgetSmartLink(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<GetSmartLinkData | GetSmartLinkSummaryData>>;\n\tgetSmartLinkArtistSettings(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<SmartLinkSettingsData>>;\n\tupdateSmartLink(\n\t\tinput: unknown,\n\t): Promise<\n\t\tResultEnvelope<UpdateSmartLinkData | UpdateSmartLinkArtistSettingsData>\n\t>;\n\tshopGetQuote(input: unknown): Promise<ResultEnvelope<DynamoiShopQuoteData>>;\n\tshopCreateCheckout(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<DynamoiShopCheckoutData>>;\n};\n\ntype DynamoiToolName = (typeof DYNAMOI_TOOL_DEFINITIONS)[number][\"name\"];\ntype DynamoiToolDispatcher = (\n\tadapter: Phase3Adapter,\n\tinput: unknown,\n\ttoolProfile?: DynamoiMcpToolProfile,\n) => Promise<ResultEnvelope<unknown>>;\n\ntype ErrorRecoveryMetadata = Partial<\n\tOmit<\n\t\tExtract<ResultEnvelope<never>, { status: \"error\" }>,\n\t\t\"message\" | \"status\"\n\t>\n>;\n\ntype NormalizedEnvelope = object | string | number | boolean | null | undefined;\n\nconst RECOVERY_METADATA_FIELDS = [\n\t\"code\",\n\t\"field\",\n\t\"nextAction\",\n\t\"prerequisite\",\n\t\"retryable\",\n\t\"retryAfterSeconds\",\n] as const;\n\nconst SPOTIFY_SOURCE_ERROR_MESSAGES = new Set([\n\t\"Paste a valid Spotify artist, album, or track URL.\",\n\t\"Paste a Spotify artist, album, or track URL.\",\n\t\"Open the Spotify artist profile, then copy the Spotify link.\",\n\t\"Spotify URL is missing a valid Spotify ID.\",\n\t\"Paste the public Spotify artist link, not the Spotify for Artists dashboard page.\",\n\t\"Spotify link did not resolve to a Spotify artist, album, or track URL.\",\n\t\"Spotify link redirected too many times.\",\n\t\"Spotify link could not be opened. Paste the full Spotify URL instead.\",\n]);\n\nconst SPOTIFY_ARTIST_CATALOG_ERROR_MESSAGES = new Set([\n\t\"Use a Spotify artist URL for full-catalog Smart Link import. For album or track URLs, use dynamoi_create_smart_link_from_spotify.\",\n]);\n\nconst REVIEWER_WRITE_TOOL_NAMES = new Set([\n\t\"dynamoi_apply_for_distribution\",\n\t\"dynamoi_create_smart_link_from_spotify\",\n\t\"dynamoi_create_smart_links_from_spotify_artist\",\n\t\"dynamoi_launch_campaign\",\n\t\"dynamoi_start_meta_connection\",\n\t\"dynamoi_start_youtube_channel_link\",\n\t\"dynamoi_update_campaign\",\n\t\"dynamoi_update_smart_link\",\n]);\n\nconst SHOP_RATE_LIMIT_RETRY_AFTER_SECONDS = {\n\tcheckout: 10 * 60,\n\tquote: 60,\n} as const;\n\nconst SHOP_RATE_LIMIT_ERROR_PATTERNS = {\n\tcheckout:\n\t\t/^Too many Shop checkout requests\\. Try again in ([1-9]\\d*) seconds\\.$/,\n\tquote: /^Too many Shop quote requests\\. Try again in ([1-9]\\d*) seconds\\.$/,\n} as const;\n\nfunction mapShopRateLimitRecovery(\n\ttoolName: string,\n\tmessage: string,\n): ErrorRecoveryMetadata | undefined {\n\tconst kind =\n\t\ttoolName === \"dynamoi_shop_get_quote\"\n\t\t\t? \"quote\"\n\t\t\t: toolName === \"dynamoi_shop_create_checkout\"\n\t\t\t\t? \"checkout\"\n\t\t\t\t: undefined;\n\tif (!kind) {\n\t\treturn undefined;\n\t}\n\n\tconst match = SHOP_RATE_LIMIT_ERROR_PATTERNS[kind].exec(message);\n\tif (!match || match[0] !== message) {\n\t\treturn undefined;\n\t}\n\tconst retryAfterSeconds = Number(match[1]);\n\tif (\n\t\t!Number.isSafeInteger(retryAfterSeconds) ||\n\t\tretryAfterSeconds < 1 ||\n\t\tretryAfterSeconds > SHOP_RATE_LIMIT_RETRY_AFTER_SECONDS[kind]\n\t) {\n\t\treturn undefined;\n\t}\n\treturn {\n\t\tcode: \"RATE_LIMITED\",\n\t\tretryAfterSeconds,\n\t\tretryable: true,\n\t};\n}\n\nfunction mapKnownErrorRecovery(\n\ttoolName: string,\n\tkind: unknown,\n\tmessage: string,\n): ErrorRecoveryMetadata | undefined {\n\tif (kind === \"unknown\" && MUTATING_TOOL_NAMES.has(toolName)) {\n\t\treturn {\n\t\t\tcode: \"UNKNOWN_EFFECT\",\n\t\t\tnextAction: {\n\t\t\t\tkind: \"read_status\",\n\t\t\t\treason:\n\t\t\t\t\t\"Inspect the existing operation or resource identity before retrying.\",\n\t\t\t},\n\t\t\tprerequisite:\n\t\t\t\t\"The existing operation or resource identity must be inspected before replaying.\",\n\t\t\tretryable: false,\n\t\t};\n\t}\n\tif (kind !== \"business\") {\n\t\treturn undefined;\n\t}\n\tconst shopRateLimitRecovery = mapShopRateLimitRecovery(toolName, message);\n\tif (shopRateLimitRecovery) {\n\t\treturn shopRateLimitRecovery;\n\t}\n\tif (\n\t\tREVIEWER_WRITE_TOOL_NAMES.has(toolName) &&\n\t\tmessage === \"Reviewer accounts are read-only in MCP.\"\n\t) {\n\t\treturn {\n\t\t\tcode: \"ACCOUNT_READ_ONLY\",\n\t\t\tnextAction: {\n\t\t\t\tkind: \"handoff\",\n\t\t\t\treason: \"Use an authorized non-reviewer account for this write.\",\n\t\t\t},\n\t\t\tprerequisite: \"A non-reviewer account with write access is required.\",\n\t\t\tretryable: false,\n\t\t};\n\t}\n\n\tconst isSingleReleaseSpotifyTool =\n\t\ttoolName === \"dynamoi_create_smart_link_from_spotify\";\n\tconst isArtistCatalogSpotifyTool =\n\t\ttoolName === \"dynamoi_create_smart_links_from_spotify_artist\";\n\tif (\n\t\t(isSingleReleaseSpotifyTool || isArtistCatalogSpotifyTool) &&\n\t\t(SPOTIFY_SOURCE_ERROR_MESSAGES.has(message) ||\n\t\t\t(isArtistCatalogSpotifyTool &&\n\t\t\t\tSPOTIFY_ARTIST_CATALOG_ERROR_MESSAGES.has(message)))\n\t) {\n\t\tconst field = isArtistCatalogSpotifyTool\n\t\t\t? \"spotifyArtistUrl\"\n\t\t\t: \"spotifyUrl\";\n\t\tconst expectedInput = isArtistCatalogSpotifyTool\n\t\t\t? \"Provide a public Spotify artist URL.\"\n\t\t\t: \"Provide a public Spotify artist, album, or track URL.\";\n\t\treturn {\n\t\t\tcode: \"INVALID_SPOTIFY_SOURCE\",\n\t\t\tfield,\n\t\t\tnextAction: {\n\t\t\t\tfield,\n\t\t\t\tkind: \"provide_input\",\n\t\t\t\treason: expectedInput,\n\t\t\t},\n\t\t\tprerequisite: expectedInput,\n\t\t\tretryable: false,\n\t\t};\n\t}\n\n\tif (\n\t\ttoolName === \"dynamoi_update_smart_link\" &&\n\t\tmessage ===\n\t\t\t\"Smart Link changed since it was last read. Read it again before updating.\"\n\t) {\n\t\treturn {\n\t\t\tcode: \"STATE_CONFLICT\",\n\t\t\tfield: \"expectedUpdatedAt\",\n\t\t\tnextAction: {\n\t\t\t\tkind: \"read_status\",\n\t\t\t\treason:\n\t\t\t\t\t\"Read the existing Smart Link again, then resubmit only with its current state.\",\n\t\t\t},\n\t\t\tprerequisite: \"Read the Smart Link before updating it.\",\n\t\t\tretryable: false,\n\t\t};\n\t}\n\n\tif (\n\t\ttoolName === \"dynamoi_shop_create_checkout\" &&\n\t\tmessage ===\n\t\t\t\"The Shop quote changed. Get a new quote before creating checkout.\"\n\t) {\n\t\treturn {\n\t\t\tcode: \"QUOTE_CHANGED\",\n\t\t\tfield: \"expectedTotal\",\n\t\t\tnextAction: {\n\t\t\t\tfield: \"expectedTotal\",\n\t\t\t\tkind: \"provide_input\",\n\t\t\t\treason:\n\t\t\t\t\t\"Get a fresh quote, ask the user to confirm its total, then submit with that total and the same requestId.\",\n\t\t\t},\n\t\t\tprerequisite:\n\t\t\t\t\"Get a fresh Shop quote and obtain renewed user confirmation for its total before creating checkout.\",\n\t\t\tretryable: false,\n\t\t};\n\t}\n\n\treturn undefined;\n}\n\nfunction normalizeKnownErrorRecovery(\n\tenvelope: unknown,\n\ttoolName: string,\n): NormalizedEnvelope {\n\tif (\n\t\tenvelope === null ||\n\t\tenvelope === undefined ||\n\t\ttypeof envelope === \"string\" ||\n\t\ttypeof envelope === \"number\" ||\n\t\ttypeof envelope === \"boolean\"\n\t) {\n\t\treturn envelope;\n\t}\n\tif (typeof envelope !== \"object\" || Array.isArray(envelope)) {\n\t\treturn typeof envelope === \"object\" ? envelope : null;\n\t}\n\tconst record = envelope as Record<string, unknown>;\n\tif (record[\"status\"] !== \"error\") {\n\t\treturn record;\n\t}\n\tconst message = record[\"message\"];\n\tif (\n\t\tRECOVERY_METADATA_FIELDS.some((field) => record[field] !== undefined) ||\n\t\ttypeof message !== \"string\"\n\t) {\n\t\treturn record;\n\t}\n\tconst recovery = mapKnownErrorRecovery(toolName, record[\"kind\"], message);\n\treturn recovery ? { ...record, ...recovery } : envelope;\n}\n\nconst DYNAMOI_TOOL_DISPATCHERS = {\n\tdynamoi_about: (_adapter, _input, toolProfile) =>\n\t\tPromise.resolve(getDynamoiAbout({ toolProfile })),\n\tdynamoi_apply_for_distribution: (adapter, input) =>\n\t\tadapter.applyForDistribution(input),\n\tdynamoi_create_smart_link_from_spotify: (adapter, input) =>\n\t\tadapter.createSmartLinkFromSpotify(input),\n\tdynamoi_create_smart_links_from_spotify_artist: (adapter, input) =>\n\t\tadapter.createSmartLinksFromSpotifyArtist(input),\n\tdynamoi_get_account_overview: (adapter, input) =>\n\t\tadapter.getCurrentUser(input),\n\tdynamoi_get_artist_analytics: (adapter, input) =>\n\t\tadapter.getArtistAnalytics(input),\n\tdynamoi_get_billing: (adapter, input) => adapter.getBilling(input),\n\tdynamoi_get_campaign: (adapter, input) => adapter.getCampaign(input),\n\tdynamoi_get_campaign_readiness: (adapter, input) =>\n\t\tadapter.getCampaignReadiness(input),\n\tdynamoi_get_distribution_application: (adapter, input) =>\n\t\tadapter.getDistributionApplication(input),\n\tdynamoi_get_platform_status: (adapter, input) =>\n\t\tadapter.getPlatformStatus(input),\n\tdynamoi_get_smart_link: (adapter, input) => adapter.getSmartLink(input),\n\tdynamoi_launch_campaign: (adapter, input) => adapter.launchCampaign(input),\n\tdynamoi_list_artists: (adapter, input) => adapter.listArtists(input),\n\tdynamoi_list_available_countries: (adapter, input) =>\n\t\tadapter.listAvailableCountries(input),\n\tdynamoi_list_campaigns: (adapter, input) => adapter.listCampaigns(input),\n\tdynamoi_list_media_assets: (adapter, input) => adapter.listMediaAssets(input),\n\tdynamoi_list_smart_links: (adapter, input) => adapter.listSmartLinks(input),\n\tdynamoi_preview_smart_link_themes: (_adapter, input) =>\n\t\tPromise.resolve(previewSmartLinkThemes(input)),\n\tdynamoi_search: (adapter, input) => adapter.search(input),\n\tdynamoi_shop_create_checkout: (adapter, input) =>\n\t\tadapter.shopCreateCheckout(input),\n\tdynamoi_shop_get_quote: (adapter, input) => adapter.shopGetQuote(input),\n\tdynamoi_start_meta_connection: (adapter, input) =>\n\t\tadapter.startMetaConnection(input),\n\tdynamoi_start_youtube_channel_link: (adapter, input) =>\n\t\tadapter.startYoutubeChannelLink(input),\n\tdynamoi_update_campaign: (adapter, input) => adapter.updateCampaign(input),\n\tdynamoi_update_smart_link: (adapter, input) => adapter.updateSmartLink(input),\n\tfetch: (adapter, input) => adapter.openAiFetch(input),\n\tsearch: (adapter, input) => adapter.openAiSearch(input),\n} satisfies Record<DynamoiToolName, DynamoiToolDispatcher>;\n\nfunction snapshotForObserver(value: unknown) {\n\ttry {\n\t\treturn structuredClone(value);\n\t} catch {\n\t\tif (\n\t\t\tvalue === null ||\n\t\t\t(typeof value !== \"object\" && typeof value !== \"function\")\n\t\t) {\n\t\t\treturn value;\n\t\t}\n\t\ttry {\n\t\t\tif (value instanceof Error) {\n\t\t\t\tconst snapshot = new Error(\n\t\t\t\t\t\"The thrown error could not be cloned for observation.\",\n\t\t\t\t);\n\t\t\t\ttry {\n\t\t\t\t\tconst name = value.name;\n\t\t\t\t\tif (typeof name === \"string\") {\n\t\t\t\t\t\tsnapshot.name = name;\n\t\t\t\t\t}\n\t\t\t\t} catch {\n\t\t\t\t\t// Keep the fallback snapshot isolated if a custom error accessor throws.\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\tconst message = value.message;\n\t\t\t\t\tif (typeof message === \"string\") {\n\t\t\t\t\t\tsnapshot.message = message;\n\t\t\t\t\t}\n\t\t\t\t} catch {\n\t\t\t\t\t// Keep the fallback snapshot isolated if a custom error accessor throws.\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\tconst stack = value.stack;\n\t\t\t\t\tif (typeof stack === \"string\") {\n\t\t\t\t\t\tsnapshot.stack = stack;\n\t\t\t\t\t}\n\t\t\t\t} catch {\n\t\t\t\t\t// Keep the fallback snapshot isolated if a custom error accessor throws.\n\t\t\t\t}\n\t\t\t\treturn snapshot;\n\t\t\t}\n\t\t} catch {\n\t\t\t// Fall through to a static object for arbitrary uncloneable values.\n\t\t}\n\t\treturn {\n\t\t\tkind: \"unknown\",\n\t\t\tmessage: \"The thrown value could not be cloned for observation.\",\n\t\t};\n\t}\n}\n\nexport function asTextResult(envelope: unknown) {\n\tconst isToolError =\n\t\tBoolean(envelope) &&\n\t\ttypeof envelope === \"object\" &&\n\t\t(envelope as { status?: unknown }).status === \"error\";\n\tconst plainText = (() => {\n\t\tif (!envelope || typeof envelope !== \"object\") {\n\t\t\treturn JSON.stringify(envelope);\n\t\t}\n\n\t\tconst status = (envelope as { status?: unknown }).status;\n\t\tif (status === \"error\") {\n\t\t\tconst message = (envelope as { message?: unknown }).message;\n\t\t\treturn typeof message === \"string\" && message.trim().length > 0\n\t\t\t\t? message\n\t\t\t\t: JSON.stringify(envelope);\n\t\t}\n\n\t\tconst data = (envelope as { data?: unknown }).data;\n\t\tif (data && typeof data === \"object\") {\n\t\t\tconst summary = (data as { summary?: unknown }).summary;\n\t\t\tif (typeof summary === \"string\" && summary.trim().length > 0) {\n\t\t\t\treturn summary;\n\t\t\t}\n\t\t}\n\n\t\treturn JSON.stringify(envelope);\n\t})();\n\n\ttype McpToolCallResult = {\n\t\tcontent: Array<{ text: string; type: \"text\" }>;\n\t\tstructuredContent: Record<string, unknown>;\n\t\tisError?: boolean;\n\t};\n\n\tconst result: McpToolCallResult = {\n\t\tcontent: [{ text: plainText, type: \"text\" as const }],\n\t\tstructuredContent: envelope as Record<string, unknown>,\n\t};\n\tif (isToolError) {\n\t\tresult.isError = true;\n\t}\n\n\treturn result;\n}\n\nexport function asValidatedTextResult(options: {\n\tenvelope: unknown;\n\toutputSchema: z.ZodType;\n\ttoolName: string;\n}) {\n\tconst envelope = normalizeKnownErrorRecovery(\n\t\toptions.envelope,\n\t\toptions.toolName,\n\t);\n\tconst parsed = options.outputSchema.safeParse(envelope);\n\tif (!parsed.success) {\n\t\treturn asTextResult({\n\t\t\tcode: \"OUTPUT_INVALID\",\n\t\t\tkind: \"validation\",\n\t\t\tmessage: `Tool ${options.toolName} returned an invalid result shape.`,\n\t\t\tnextAction: {\n\t\t\t\tkind: \"read_status\",\n\t\t\t\treason: \"Inspect the existing operation identity before retrying.\",\n\t\t\t},\n\t\t\tprerequisite:\n\t\t\t\t\"The existing operation or resource identity must be inspected before replaying.\",\n\t\t\tretryable: false,\n\t\t\tstatus: \"error\",\n\t\t} satisfies ResultEnvelope<never>);\n\t}\n\treturn asTextResult(envelope);\n}\n\n// Lists vary by the caller's authorization, so clients may reuse them briefly\n// but never share them across principals.\nconst PRIVATE_LIST_CACHE_HINT: CacheHint = {\n\tcacheScope: \"private\",\n\tttlMs: 60_000,\n};\n\nconst DYNAMOI_CACHE_HINTS: NonNullable<ServerOptions[\"cacheHints\"]> = {\n\t\"prompts/list\": PRIVATE_LIST_CACHE_HINT,\n\t\"resources/list\": PRIVATE_LIST_CACHE_HINT,\n\t\"resources/templates/list\": PRIVATE_LIST_CACHE_HINT,\n\t\"server/discover\": PRIVATE_LIST_CACHE_HINT,\n\t\"tools/list\": PRIVATE_LIST_CACHE_HINT,\n};\n\ntype JsonSchemaObject = Record<string, unknown>;\n\nfunction isObjectShapedJsonSchema(schema: JsonSchemaObject): boolean {\n\tif (schema[\"type\"] !== undefined) {\n\t\treturn schema[\"type\"] === \"object\";\n\t}\n\tif (\n\t\t[\n\t\t\t\"properties\",\n\t\t\t\"patternProperties\",\n\t\t\t\"additionalProperties\",\n\t\t\t\"required\",\n\t\t].some((key) => key in schema)\n\t) {\n\t\treturn true;\n\t}\n\treturn [\"oneOf\", \"anyOf\", \"allOf\"].some((key) => {\n\t\tconst members = schema[key];\n\t\treturn (\n\t\t\tArray.isArray(members) &&\n\t\t\tmembers.length > 0 &&\n\t\t\tmembers.every(\n\t\t\t\t(member) =>\n\t\t\t\t\ttypeof member === \"object\" &&\n\t\t\t\t\tmember !== null &&\n\t\t\t\t\tisObjectShapedJsonSchema(member as JsonSchemaObject),\n\t\t\t)\n\t\t);\n\t});\n}\n\n/** The JSON Schema the SDK would advertise, without the `$schema` dialect key. */\nfunction toAdvertisedJsonSchema(\n\tschema: z.ZodType,\n\tio: \"input\" | \"output\",\n): JsonSchemaObject {\n\t// Some MCP clients reject schemas that carry `$schema`; it is informational.\n\tconst { $schema: _dialect, ...jsonSchema } = z.toJSONSchema(schema, {\n\t\tio,\n\t\ttarget: \"draft-2020-12\",\n\t}) as JsonSchemaObject;\n\treturn jsonSchema[\"type\"] === undefined &&\n\t\t(io === \"input\" || isObjectShapedJsonSchema(jsonSchema))\n\t\t? { type: \"object\", ...jsonSchema }\n\t\t: jsonSchema;\n}\n\ntype AdvertisedTool = Tool & {\n\tsecuritySchemes: DynamoiToolMetadata[\"securitySchemes\"];\n};\n\nexport function createDynamoiMcpServer(options: {\n\tadapter: Phase3Adapter;\n\t/**\n\t * Runs before a tool dispatches. A returned result answers the call\n\t * instead, for example an OAuth step-up challenge the host detected.\n\t */\n\tauthorizeToolCall?: (toolName: string) => CallToolResult | undefined;\n\tonToolCall?: (input: {\n\t\tdurationMs: number;\n\t\terror?: unknown;\n\t\tresult?: unknown;\n\t\ttoolName: string;\n\t}) => Promise<void> | void;\n\toauthScopes?: readonly string[];\n\ttoolProfile?: DynamoiMcpToolProfile;\n\twebsiteUrl?: string;\n}): McpServer {\n\tconst toolProfile = options.toolProfile ?? \"directory\";\n\tconst server = new McpServer(\n\t\t{\n\t\t\tname: \"dynamoi\",\n\t\t\tversion: DYNAMOI_MCP_VERSION,\n\t\t\twebsiteUrl: options.websiteUrl ?? \"https://dynamoi.com\",\n\t\t},\n\t\t{\n\t\t\tcacheHints: DYNAMOI_CACHE_HINTS,\n\t\t\t// Every request builds a fresh server, so lists never change mid-connection.\n\t\t\tcapabilities: {\n\t\t\t\tresources: { listChanged: false },\n\t\t\t\ttools: { listChanged: false },\n\t\t\t\t...(toolProfile === \"full\" ? { prompts: { listChanged: false } } : {}),\n\t\t\t},\n\t\t\tinstructions:\n\t\t\t\ttoolProfile === \"directory\"\n\t\t\t\t\t? DYNAMOI_CHATGPT_APP_INSTRUCTIONS\n\t\t\t\t\t: DYNAMOI_MCP_INSTRUCTIONS,\n\t\t},\n\t);\n\n\tconst advertisedTools: AdvertisedTool[] = [];\n\tfor (const def of getDynamoiToolDefinitions({ toolProfile })) {\n\t\tconst title = def.title;\n\t\tconst dispatcher = DYNAMOI_TOOL_DISPATCHERS[def.name];\n\t\tconst idempotentHint =\n\t\t\t\"idempotentHint\" in def && typeof def.idempotentHint === \"boolean\"\n\t\t\t\t? def.idempotentHint\n\t\t\t\t: undefined;\n\t\tconst meta: DynamoiToolMetadata = {\n\t\t\tsecuritySchemes: buildDynamoiToolSecuritySchemes(\n\t\t\t\tgetDynamoiToolOAuthScopes(\n\t\t\t\t\tdef.name,\n\t\t\t\t\toptions.oauthScopes ?? DYNAMOI_BETTER_AUTH_MCP_SCOPES,\n\t\t\t\t),\n\t\t\t),\n\t\t};\n\t\tif (def.name === \"dynamoi_preview_smart_link_themes\") {\n\t\t\tmeta[\"openai/outputTemplate\"] = SMART_LINK_THEME_PREVIEW_RESOURCE_URI;\n\t\t\tmeta.ui = { resourceUri: SMART_LINK_THEME_PREVIEW_RESOURCE_URI };\n\t\t}\n\t\tconst annotations: DynamoiToolAnnotations = {\n\t\t\tdestructiveHint: def.destructiveHint,\n\t\t\topenWorldHint: def.openWorldHint,\n\t\t\treadOnlyHint: def.readOnlyHint,\n\t\t};\n\t\tif (typeof idempotentHint === \"boolean\") {\n\t\t\tannotations.idempotentHint = idempotentHint;\n\t\t}\n\t\tconst outputSchema = getAdvertisedToolOutputSchema({\n\t\t\tcanonical: def.outputSchema,\n\t\t\ttoolName: def.name,\n\t\t\ttoolProfile,\n\t\t});\n\t\tadvertisedTools.push({\n\t\t\t_meta: meta,\n\t\t\tannotations,\n\t\t\tdescription: def.description,\n\t\t\tinputSchema: toAdvertisedJsonSchema(\n\t\t\t\tdef.schema,\n\t\t\t\t\"input\",\n\t\t\t) as Tool[\"inputSchema\"],\n\t\t\tname: def.name,\n\t\t\toutputSchema: toAdvertisedJsonSchema(\n\t\t\t\toutputSchema,\n\t\t\t\t\"output\",\n\t\t\t) as Tool[\"outputSchema\"],\n\t\t\tsecuritySchemes: meta.securitySchemes,\n\t\t\ttitle,\n\t\t});\n\t\tserver.registerTool(\n\t\t\tdef.name,\n\t\t\t{\n\t\t\t\t_meta: meta,\n\t\t\t\tannotations,\n\t\t\t\tdescription: def.description,\n\t\t\t\tinputSchema: def.schema,\n\t\t\t\toutputSchema,\n\t\t\t\ttitle,\n\t\t\t},\n\t\t\tasync (input: unknown) => {\n\t\t\t\tconst denied = options.authorizeToolCall?.(def.name);\n\t\t\t\tif (denied) {\n\t\t\t\t\treturn denied;\n\t\t\t\t}\n\t\t\t\tconst startedAt = Date.now();\n\t\t\t\ttry {\n\t\t\t\t\tconst envelope = await dispatcher(\n\t\t\t\t\t\toptions.adapter,\n\t\t\t\t\t\tinput,\n\t\t\t\t\t\ttoolProfile,\n\t\t\t\t\t);\n\t\t\t\t\tconst finalized = asValidatedTextResult({\n\t\t\t\t\t\tenvelope,\n\t\t\t\t\t\toutputSchema: def.outputSchema,\n\t\t\t\t\t\ttoolName: def.name,\n\t\t\t\t\t});\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait options.onToolCall?.({\n\t\t\t\t\t\t\tdurationMs: Date.now() - startedAt,\n\t\t\t\t\t\t\tresult: snapshotForObserver(finalized.structuredContent),\n\t\t\t\t\t\t\ttoolName: def.name,\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t// Observability must never change a tool result.\n\t\t\t\t\t}\n\t\t\t\t\treturn finalized;\n\t\t\t\t} catch (error) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait options.onToolCall?.({\n\t\t\t\t\t\t\tdurationMs: Date.now() - startedAt,\n\t\t\t\t\t\t\terror: snapshotForObserver(error),\n\t\t\t\t\t\t\ttoolName: def.name,\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t// Preserve the dispatcher failure when observability also fails.\n\t\t\t\t\t}\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t},\n\t\t);\n\t}\n\n\t// OpenAI reads per-tool auth from a top-level `securitySchemes` field that\n\t// the SDK's generated list omits, so this server advertises the final tool\n\t// shape itself. Both eras and both response modes serve the same list.\n\tserver.server.removeRequestHandler(\"tools/list\");\n\tserver.server.setRequestHandler(\"tools/list\", () => ({\n\t\ttools: advertisedTools,\n\t}));\n\n\tserver.registerResource(\n\t\tDYNAMOI_ABOUT_RESOURCE.name,\n\t\tDYNAMOI_ABOUT_RESOURCE.uri,\n\t\t{\n\t\t\tcacheHint: { cacheScope: \"public\", ttlMs: 60 * 60 * 1000 },\n\t\t\tdescription: DYNAMOI_ABOUT_RESOURCE.description,\n\t\t\tmimeType: DYNAMOI_ABOUT_RESOURCE.mimeType,\n\t\t\ttitle: DYNAMOI_ABOUT_RESOURCE.title,\n\t\t},\n\t\tasync (uri) => ({\n\t\t\tcontents: [\n\t\t\t\t{\n\t\t\t\t\tmimeType: DYNAMOI_ABOUT_RESOURCE.mimeType,\n\t\t\t\t\ttext:\n\t\t\t\t\t\ttoolProfile === \"directory\"\n\t\t\t\t\t\t\t? DYNAMOI_ABOUT_DIRECTORY_MARKDOWN\n\t\t\t\t\t\t\t: DYNAMOI_ABOUT_MARKDOWN,\n\t\t\t\t\turi: uri.href,\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t);\n\tregisterSmartLinkThemePreviewResource(server);\n\n\tif (toolProfile === \"full\") {\n\t\tregisterDynamoiPrompts(server);\n\t\tregisterDynamoiResources(server, options.adapter);\n\t}\n\n\treturn server;\n}\n",
8
+ "// This identifier is replaced at build time by the package build script.\n// The source fallback keeps dashboard runtime imports from leaking a placeholder.\ndeclare const __DYNAMOI_MCP_VERSION__: string | undefined;\n\nconst BUNDLED_DYNAMOI_MCP_VERSION =\n\ttypeof __DYNAMOI_MCP_VERSION__ === \"string\" ? __DYNAMOI_MCP_VERSION__ : \"\";\n\nexport const DYNAMOI_MCP_VERSION =\n\tBUNDLED_DYNAMOI_MCP_VERSION.length > 0 &&\n\t!BUNDLED_DYNAMOI_MCP_VERSION.includes(\"__\")\n\t\t? BUNDLED_DYNAMOI_MCP_VERSION\n\t\t: \"1.0.1\";\n",
9
+ "import * as z from \"zod/v4\";\nimport { AnyOutputEnvelopeSchema } from \"./output-schemas\";\nexport const DynamoiGetDistributionApplicationInputSchema = z\n\t.object({\n\t\tartistId: z.string().uuid(),\n\t})\n\t.strict();\n\nexport const DynamoiApplyForDistributionInputSchema = z\n\t.object({\n\t\tadultSignerAttestation: z.literal(true),\n\t\tapplicantCountry: z.string().trim().length(2),\n\t\tartistId: z.string().uuid(),\n\t\tconfirmApplicationSubmission: z.literal(true),\n\t\tpayoutCountry: z.string().trim().length(2),\n\t\ttaxResidencyCountry: z.string().trim().length(2),\n\t\tuserIntentSummary: z.string().trim().min(1).max(500),\n\t})\n\t.strict();\n\nexport const DISTRIBUTION_TOOL_DEFINITIONS = [\n\t{\n\t\tdescription:\n\t\t\t\"Use this when the user asks whether an artist qualifies for Dynamoi music distribution, wants the five application requirements, or wants the status of an existing distribution application. It checks Spotify connection, at least 1,000 Spotify followers, at least 10,000 verified Soundcharts monthly listeners, connected Facebook Page plus Instagram professional identity, and a connected YouTube channel. Meeting all five requirements permits an application but never guarantees approval. When the connection tools are available, use purpose=distribution_identity for missing Meta or YouTube identity; otherwise tell the user: 'You can do this in the Dynamoi dashboard at https://dynamoi.com/dashboard.' Identity connections do not require advertising billing.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_get_distribution_application\",\n\t\topenWorldHint: false,\n\t\toutputSchema: AnyOutputEnvelopeSchema,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiGetDistributionApplicationInputSchema,\n\t\ttitle: \"Check Distribution Application\",\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"Submit an artist's application for Dynamoi music distribution after the user explicitly asks to apply and all five eligibility requirements are met. This records an application for manual review; it does not approve distribution, accept an agreement, submit a release, transfer rights, configure splits or tax forms, or deliver music to stores. All three valid ISO 3166-1 alpha-2 country or territory codes, an adult signer attestation, confirmApplicationSubmission=true, and a concise userIntentSummary are required. Country, tax, payout, sanctions, and provider-delivery checks remain manual progression gates after intake; a valid code does not imply approval. Repeated submission is idempotent for an active application.\",\n\t\tdestructiveHint: false,\n\t\tidempotentHint: true,\n\t\tname: \"dynamoi_apply_for_distribution\",\n\t\topenWorldHint: true,\n\t\toutputSchema: AnyOutputEnvelopeSchema,\n\t\treadOnlyHint: false,\n\t\tschema: DynamoiApplyForDistributionInputSchema,\n\t\ttitle: \"Apply for Music Distribution\",\n\t},\n] as const;\n",
10
+ "export const DYNAMOI_MCP_INSTRUCTIONS = `\nDynamoi is a music marketing platform for independent artists, labels, managers, and YouTube creators. It combines free Smart Links and analytics with managed Meta Smart Campaigns, managed YouTube campaigns, a one-off YouTube promotion Shop, and opt-in music distribution to 100+ stores. Call dynamoi_about or read dynamoi://about for the canonical product and pricing overview.\n\nYou are operating Dynamoi's tools on behalf of the authenticated user. Smart Links\nare free to create and manage. High-popularity or unverifiable artist links may\nstay unpublished in verification hold until Dynamoi can verify the client\nrelationship. Managed advertising and ad budgets are separate paid campaign\nservices.\n\n=== Session Start Routine ===\n\nUse dynamoi_get_account_overview for an explicit account overview, uncertain account context, or onboarding guidance. When the request already identifies the relevant artist, campaign, or Smart Link, use the targeted tool directly. Resolve ambiguous identities before acting. Treat recommendedNextActions as suggestions within the user's request and current permissions, not authorization for additional writes.\n\nRoute by state from dynamoi_get_account_overview:\n\n- state.hasAnyArtist === false: This is a brand-new user. Ask whether they are a Spotify artist, a YouTube creator, or a label/manager.\n - Spotify artist with a URL → call dynamoi_create_smart_links_from_spotify_artist immediately to create their free hub. Read dynamoi://playbooks/spotify-artist for scripted phrasing.\n - YouTube creator → read dynamoi://playbooks/youtube-creator and explain Dynamoi's revenue-per-view optimization advantage before asking whether they want to link the channel. If yes, call dynamoi_start_youtube_channel_link.\n - Label or manager with a roster → read dynamoi://playbooks/label-or-manager for the multi-artist setup walkthrough.\n\n- state.hasAnyArtist === true && state.hasAnySmartLink === false: The fastest visible win is a free Smart Link. Offer dynamoi_create_smart_link_from_spotify (single release) or dynamoi_create_smart_links_from_spotify_artist (full catalog) before campaign tools.\n\n- state.hasAnyArtist === true && state.hasAnyActiveCampaign === false: Offer dynamoi_get_campaign_readiness to validate launch inputs without creating anything.\n\n- state.hasAnyArtist === true && billing blocks a launch: managed-advertising billing setup is not available through this MCP surface. Tell the user: \"You can do this in the Dynamoi dashboard at https://dynamoi.com/dashboard.\" After they start or restore billing there, poll dynamoi_get_billing for the target artist to confirm billing is active.\n\n- state.hasAnyArtist === true && state.hasAnyConnectedMeta === false and the user wants Spotify Smart Campaigns: only offer dynamoi_start_meta_connection after billing is active. If the tool returns billing_required, route the user to dashboard billing first. If it returns billing_check_unavailable, retry shortly instead of treating the user as unpaid. After Meta browser return, poll dynamoi_get_platform_status for the target artist with the returned onboardingAttemptId and onboardingFlow=meta. Treat platforms.meta.status as complete when it is oauth_complete, partnership_pending, or partnership_active.\n\n- state.hasAnyArtist === true && state.hasAnyConnectedYoutube === false and the user wants YouTube growth: offer dynamoi_start_youtube_channel_link, then poll dynamoi_get_platform_status for the target artist with the returned onboardingAttemptId and onboardingFlow=youtube after the browser return page sends them back to chat. Treat the connection as complete when platforms.youtube.connected is true.\n\nFor a known empty account, use account overview to explain supported onboarding. Otherwise, use roster or search when it resolves missing identity. Apply the state-based suggestions only when setup is needed or the user asks for guidance; do not force an unrelated onboarding detour.\n\n=== End Session Start Routine ===\n\nPrinciples:\n- Be accurate. If uncertain, ask a clarifying question before acting.\n- 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.\n- 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.\n- 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.\n- Use \\`dynamoi_get_account_overview\\` when account orientation is needed, not as a prerequisite for every account-related task. Do not use it before unrelated advice; each targeted operation still enforces resource access.\n- When a requested action is not available through this MCP surface — billing or subscription setup, plan changes, payment, or other dashboard-only steps — tell the user: \"You can do this in the Dynamoi dashboard at https://dynamoi.com/dashboard.\"\n- Never claim you changed something unless the tool returned an actual mutation result.\n- Prefer read tools first before write tools. For writes, confirm intent and restate\n what will change.\n- After a successful write tool call, answer directly from the returned record instead of chaining more tools just to restate the result.\n- If you truly need a follow-up read after a successful write, use format=summary when available and then stop to answer the user.\n- When a user asks for a daily breakdown, pass granularity=DAILY on the analytics tool call.\n- When a user asks for a written rollup, strongest campaign, or review-ready analytics summary, prefer format=summary on the analytics tool call.\n- If a read tool already returned the requested answer in summary form, answer the user directly instead of chaining more read tools.\n- 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_links_from_spotify_artist for Spotify artist URLs when the user wants the artist hub, full catalog, or all Smart Links. Use dynamoi_create_smart_link_from_spotify for a single album or track URL. Do not imply that creating a Smart Link creates a paid campaign.\n- When answering from Smart Link tools, lead with the artist hub URL when present, then public release URLs, release title, artist name, status, and next action. Do not include internal UUIDs unless the user explicitly asks for IDs or you need an ID for a follow-up tool call.\n- Smart Link pixel tools accept validated pixel IDs only. Do not ask for arbitrary JavaScript, tag-manager snippets, or script code.\n- When the user asks about music distribution, call dynamoi_get_distribution_application before making eligibility claims. Treat its five scored requirements as authoritative. Applicant country, tax-residency country, payout country, and the adult signer attestation are required submission fields, but they are not additional eligibility-score requirements.\n- For missing Meta or YouTube distribution identity, use purpose=distribution_identity on the relevant connection tool when that tool is available. These least-privilege identity flows do not require advertising billing. Never substitute the advertising flow.\n- Call dynamoi_apply_for_distribution only after the user explicitly asks to submit, confirms the application, provides valid ISO country or territory fields, and attests that the signer is an adult. Submission starts manual review; country, tax, payout, sanctions, and provider-delivery gates still decide progression. It never implies approval, agreement acceptance, release submission, rights clearance, store delivery, royalty setup, or payout readiness.\n- Money values are shown in USD as presented in Dynamoi.\n- Budget minimums: $10/day (daily), $50 total (Smart Campaign), $50 total (YouTube).\n- Shop tools are a separate one-off purchase surface for YouTube promotion, independent of managed-advertising billing. Use dynamoi_shop_get_quote for a read-only Shop estimate. Use dynamoi_shop_create_checkout only after explicit user intent to create an unpaid Stripe Checkout Session. Re-quote when the tool reports a changed amount. Never describe Checkout creation as payment, an order, or campaign launch.\n- Product and pricing details are available as MCP resources. Keep runtime answers\n focused on the user's account data and requested action.\n\nCommon workflows:\n- Discovery: use dynamoi_get_account_overview for an explicit overview or uncertain\n account context. When the artist or campaign is already identified, call its\n targeted read directly. Use dynamoi_list_artists, dynamoi_search, or\n dynamoi_list_campaigns to resolve missing or ambiguous identity, then read the\n resolved resource.\n- 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.\n- Diagnose stuck campaign: dynamoi_get_campaign → dynamoi_get_platform_status →\n propose next steps\n- Pause/resume: dynamoi_get_campaign (confirm) → dynamoi_update_campaign with action=pause or action=resume; a resume that needs card funding also requires the funding-consent fields (see the tool description).\n- Budget update: dynamoi_get_campaign (confirm) → dynamoi_update_campaign with action=update_budget\n- Launch: dynamoi_list_media_assets → dynamoi_launch_campaign. DAILY budgets require the\n user's funding consent (authorizeAutomaticDailyFunding plus the exact consent fields);\n TOTAL budgets use existing credit.\n- Free Smart Link artist catalog creation: dynamoi_create_smart_links_from_spotify_artist; omit artistId for a brand-new user with no Dynamoi artist yet\n- Free Smart Link single-release creation: call dynamoi_create_smart_link_from_spotify\n directly when the artist and release are identified; resolve missing artist\n access first when needed.\n- Smart Link analytics/settings: call dynamoi_get_smart_link directly when the\n Smart Link is identified; use dynamoi_list_smart_links only to resolve a\n missing or ambiguous link, then set includeAnalytics=true or\n includeArtistSettings=true as requested.\n- Distribution: dynamoi_get_distribution_application → satisfy missing identity requirements with purpose=distribution_identity when available → collect required country fields and adult attestation → explicit confirmation → dynamoi_apply_for_distribution\n- 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.\n- Shop one-off promotion: dynamoi_shop_get_quote → explicit user confirmation → dynamoi_shop_create_checkout. The returned URL is an unpaid handoff; the user completes payment outside MCP and no Shop order exists until Dynamoi verifies settlement.\n`.trim();\n\nexport const DYNAMOI_CHATGPT_APP_INSTRUCTIONS = `\nDynamoi is a music marketing platform for independent artists, labels, managers, and YouTube creators. It combines free Smart Links and analytics with managed Meta Smart Campaigns, managed YouTube campaigns, and opt-in music distribution to 100+ stores. Call dynamoi_about for the canonical product overview.\n\nYou are operating Dynamoi's tools on behalf of the authenticated user. This\nsurface is review-safe: it does not expose billing, subscription or plan setup,\ncampaign launch or budget tools, external OAuth connection starters, Shop\ncheckout, or any purchase flow. When the user asks to buy, subscribe, launch a\npaid campaign, connect Meta or YouTube, or change a live campaign, explain that\nthe action is not available through this surface and tell them: \"You can do this\nin the Dynamoi dashboard at https://dynamoi.com/dashboard.\" Do not create or\nsurface a purchase or checkout URL. Use the available read tools afterward to\ncheck existing status, analytics, and setup state.\n\nPrinciples:\n- Answer general marketing, songwriting, lyrics, or social-media advice natively\n unless the user explicitly asks about their Dynamoi account, artists, campaigns,\n analytics, or Smart Links.\n- Do not call Dynamoi tools just to \"check context\" for generic advice.\n- For an explicit account overview or uncertain account context, use\n dynamoi_get_account_overview. If the request identifies the artist, campaign,\n or Smart Link, use its targeted read directly; resolve missing or ambiguous\n identity with the relevant roster or search tool first.\n- For artist rosters, use dynamoi_list_artists.\n- For an identified campaign, call dynamoi_get_campaign directly. Use\n dynamoi_list_campaigns to resolve a missing or ambiguous campaign, and use\n dynamoi_get_artist_analytics when the user asks for artist performance.\n These tools are read-only.\n- For music distribution, use dynamoi_get_distribution_application to explain the exact\n five requirements and current application status. Use dynamoi_apply_for_distribution\n only after explicit user confirmation and complete country/adult-attestation fields.\n An application starts manual review and never guarantees approval or distributes a release.\n- For free Smart Links, use dynamoi_create_smart_link_from_spotify,\n dynamoi_create_smart_links_from_spotify_artist, dynamoi_list_smart_links,\n dynamoi_get_smart_link, and dynamoi_update_smart_link.\n- When reading Smart Links, set includeAnalytics=true for visit/click analytics and\n includeArtistSettings=true for artist-level theme or pixel settings.\n- Smart Link pixel tools accept validated pixel IDs only. Do not ask for arbitrary\n JavaScript, tag-manager snippets, or script code.\n- Never claim you changed something unless the tool returned an actual mutation result.\n- For writes, confirm intent and restate what will change.\n- After a successful write tool call, answer directly from the returned record instead\n of chaining more tools just to restate the result.\n- When answering from Smart Link tools, lead with the artist hub URL when present,\n then public release URLs, release title, artist name, status, and next action. Do\n not include internal UUIDs unless the user explicitly asks for IDs or you need an ID\n for a follow-up tool call.\n`.trim();\n",
11
+ "import type { McpServer } from \"@modelcontextprotocol/server\";\nimport * as z from \"zod/v4\";\n\nfunction asTextPrompt(text: string) {\n\treturn {\n\t\tmessages: [\n\t\t\t{\n\t\t\t\tcontent: { text, type: \"text\" as const },\n\t\t\t\trole: \"user\" as const,\n\t\t\t},\n\t\t],\n\t};\n}\n\nexport function registerDynamoiPrompts(server: McpServer) {\n\tserver.registerPrompt(\n\t\t\"dynamoi_find_smart_link_url\",\n\t\t{\n\t\t\targsSchema: z.object({\n\t\t\t\tartistId: z.string().uuid().optional(),\n\t\t\t\tquery: z.string().trim().optional(),\n\t\t\t}),\n\t\t\tdescription:\n\t\t\t\t\"Find a user's free Smart Link URL and answer with public URLs, titles, and statuses.\",\n\t\t\ttitle: \"Find Smart Link URL\",\n\t\t},\n\t\t(args) =>\n\t\t\tasTextPrompt(\n\t\t\t\t[\n\t\t\t\t\t\"Find my Dynamoi Smart Link URL.\",\n\t\t\t\t\targs.artistId\n\t\t\t\t\t\t? `Artist ID: ${args.artistId}`\n\t\t\t\t\t\t: \"If no artistId is provided, use dynamoi_search or dynamoi_list_artists to identify the artist first.\",\n\t\t\t\t\targs.query ? `Search query: ${args.query}` : \"\",\n\t\t\t\t\t\"\",\n\t\t\t\t\t\"Use dynamoi_list_smart_links or dynamoi_search with type=smartlink.\",\n\t\t\t\t\t\"In the final answer, show the release title, artist, public URL, and status. Do not show internal IDs unless I ask for them.\",\n\t\t\t\t]\n\t\t\t\t\t.filter(Boolean)\n\t\t\t\t\t.join(\"\\n\"),\n\t\t\t),\n\t);\n\n\tserver.registerPrompt(\n\t\t\"dynamoi_explain_free_smart_links\",\n\t\t{\n\t\t\targsSchema: z.object({}),\n\t\t\tdescription:\n\t\t\t\t\"Explain Dynamoi free Smart Links and how they differ from paid managed advertising.\",\n\t\t\ttitle: \"Explain Free Smart Links\",\n\t\t},\n\t\t() =>\n\t\t\tasTextPrompt(\n\t\t\t\t[\n\t\t\t\t\t\"Explain Dynamoi free Smart Links.\",\n\t\t\t\t\t\"Use MCP resources if needed, especially dynamoi://smart-links/free-plan and dynamoi://business/free-vs-paid.\",\n\t\t\t\t\t\"Be clear: Smart Links are free to create and manage. High-popularity or unverifiable artist links may require verification before public publishing. Managed advertising and ad budgets are separate paid services.\",\n\t\t\t\t\t\"Do not inspect my account data unless I ask about my artists, links, campaigns, billing, or settings.\",\n\t\t\t\t].join(\"\\n\"),\n\t\t\t),\n\t);\n\n\tserver.registerPrompt(\n\t\t\"dynamoi_create_free_smart_link\",\n\t\t{\n\t\t\targsSchema: z.object({\n\t\t\t\tartistId: z.string().uuid().optional(),\n\t\t\t\tspotifyUrl: z.string().trim().optional(),\n\t\t\t}),\n\t\t\tdescription:\n\t\t\t\t\"Create free Smart Links from a Spotify artist, album, or track URL.\",\n\t\t\ttitle: \"Create Free Smart Link\",\n\t\t},\n\t\t(args) =>\n\t\t\tasTextPrompt(\n\t\t\t\t[\n\t\t\t\t\t\"Create a free Dynamoi Smart Link.\",\n\t\t\t\t\targs.artistId\n\t\t\t\t\t\t? `Artist ID: ${args.artistId}`\n\t\t\t\t\t\t: \"If no artistId is provided, list artists first and ask me which artist owns the link.\",\n\t\t\t\t\targs.spotifyUrl\n\t\t\t\t\t\t? `Spotify URL: ${args.spotifyUrl}`\n\t\t\t\t\t\t: \"Ask me for a Spotify artist, album, or track URL. Playlist URLs are not supported today.\",\n\t\t\t\t\t\"\",\n\t\t\t\t\t\"Smart Links are free to create and manage. High-popularity or unverifiable artist links may require verification before public publishing. This does not create a paid campaign.\",\n\t\t\t\t\t\"If the Spotify URL is an artist URL and I want my hub/catalog, use dynamoi_create_smart_links_from_spotify_artist. If it is an album or track URL, use dynamoi_create_smart_link_from_spotify.\",\n\t\t\t\t].join(\"\\n\"),\n\t\t\t),\n\t);\n\n\tserver.registerPrompt(\n\t\t\"dynamoi_audit_campaigns\",\n\t\t{\n\t\t\targsSchema: z.object({\n\t\t\t\tartistId: z.string().uuid().optional(),\n\t\t\t}),\n\t\t\tdescription:\n\t\t\t\t\"Audit an artist's campaigns and summarize what is working and what to fix next.\",\n\t\t\ttitle: \"Audit Campaigns\",\n\t\t},\n\t\t(args) =>\n\t\t\tasTextPrompt(\n\t\t\t\t[\n\t\t\t\t\t\"Audit my campaigns in Dynamoi.\",\n\t\t\t\t\targs.artistId\n\t\t\t\t\t\t? `Artist ID: ${args.artistId}`\n\t\t\t\t\t\t: \"If no artistId is provided, start by listing artists and ask me which one to audit.\",\n\t\t\t\t\t\"\",\n\t\t\t\t\t\"Steps:\",\n\t\t\t\t\t\"1. Use dynamoi_list_campaigns and dynamoi_get_campaign with includeAnalytics=true for the last 7-14 days when one campaign needs a deeper read.\",\n\t\t\t\t\t\"2. Identify any campaigns that are paused, failed, or stuck in a pre-active state and explain why using dynamoi_get_campaign and dynamoi_get_platform_status.\",\n\t\t\t\t\t\"3. Recommend 3-5 next actions with clear priorities.\",\n\t\t\t\t].join(\"\\n\"),\n\t\t\t),\n\t);\n\n\tserver.registerPrompt(\n\t\t\"dynamoi_release_launch_plan\",\n\t\t{\n\t\t\targsSchema: z.object({\n\t\t\t\tartistId: z.string().uuid().optional(),\n\t\t\t\tcontentTitle: z.string().trim().optional(),\n\t\t\t\tcontentType: z.enum([\"TRACK\", \"ALBUM\", \"PLAYLIST\", \"VIDEO\"]).optional(),\n\t\t\t}),\n\t\t\tdescription:\n\t\t\t\t\"Create a pragmatic release launch plan and propose a Dynamoi campaign setup.\",\n\t\t\ttitle: \"Release Launch Plan\",\n\t\t},\n\t\t(args) =>\n\t\t\tasTextPrompt(\n\t\t\t\t[\n\t\t\t\t\t\"Help me plan a release launch using Dynamoi.\",\n\t\t\t\t\targs.artistId\n\t\t\t\t\t\t? `Artist ID: ${args.artistId}`\n\t\t\t\t\t\t: \"If no artistId is provided, list artists first.\",\n\t\t\t\t\targs.contentType ? `Content type: ${args.contentType}` : \"\",\n\t\t\t\t\targs.contentTitle ? `Title: ${args.contentTitle}` : \"\",\n\t\t\t\t\t\"\",\n\t\t\t\t\t\"Ask any missing questions first (links, creative, budget, countries, dates).\",\n\t\t\t\t\t\"Then propose the simplest campaign plan that fits today’s supported platforms:\",\n\t\t\t\t\t\"- Smart Campaign (Meta) for Spotify releases\",\n\t\t\t\t\t\"- YouTube campaign for videos\",\n\t\t\t\t\t\"\",\n\t\t\t\t\t\"If we proceed to launch:\",\n\t\t\t\t\t\"- For Smart Campaign: use dynamoi_list_media_assets and then dynamoi_launch_campaign.\",\n\t\t\t\t\t\"- For YouTube: use dynamoi_launch_campaign with youtubeVideoId.\",\n\t\t\t\t]\n\t\t\t\t\t.filter(Boolean)\n\t\t\t\t\t.join(\"\\n\"),\n\t\t\t),\n\t);\n\n\tserver.registerPrompt(\n\t\t\"dynamoi_why_campaign_blocked\",\n\t\t{\n\t\t\targsSchema: z.object({\n\t\t\t\tcampaignId: z.string().uuid(),\n\t\t\t}),\n\t\t\tdescription:\n\t\t\t\t\"Diagnose why a campaign is blocked/stuck and recommend the next fix.\",\n\t\t\ttitle: \"Why Is My Campaign Blocked?\",\n\t\t},\n\t\t(args) =>\n\t\t\tasTextPrompt(\n\t\t\t\t[\n\t\t\t\t\t\"My campaign seems blocked or stuck. Diagnose it and tell me what to do next.\",\n\t\t\t\t\t`Campaign ID: ${args.campaignId}`,\n\t\t\t\t\t\"\",\n\t\t\t\t\t\"Steps:\",\n\t\t\t\t\t\"1. Use dynamoi_get_campaign with includeDeploymentStatus=true to inspect current status and blockers.\",\n\t\t\t\t\t\"2. Use dynamoi_get_platform_status for the artist to check Meta/Google connection state.\",\n\t\t\t\t\t\"3. If appropriate, suggest safe next actions and confirm before calling dynamoi_update_campaign.\",\n\t\t\t\t].join(\"\\n\"),\n\t\t\t),\n\t);\n}\n",
12
+ "import { type McpServer, ResourceTemplate } from \"@modelcontextprotocol/server\";\nimport * as z from \"zod/v4\";\nimport type { Phase3Adapter } from \"./create-server\";\nimport { registerPlaybookResources } from \"./playbook-resources\";\n\nexport function registerDynamoiResources(\n\tserver: McpServer,\n\tadapter: Phase3Adapter,\n) {\n\t// Static resources (small, cache-friendly reference data)\n\tserver.registerResource(\n\t\t\"platform-pricing\",\n\t\t\"dynamoi://platform/pricing\",\n\t\t{\n\t\t\tdescription:\n\t\t\t\t\"Dynamoi campaign setup guidance and campaign budget minimums.\",\n\t\t\tmimeType: \"application/json\",\n\t\t\ttitle: \"Pricing\",\n\t\t},\n\t\tasync (uri) => ({\n\t\t\tcontents: [\n\t\t\t\t{\n\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\t\tbudgetMinimums: {\n\t\t\t\t\t\t\tsmartCampaign: {\n\t\t\t\t\t\t\t\tdailyUsd: 10,\n\t\t\t\t\t\t\t\tnote: \"Meta Ads for Spotify promotion\",\n\t\t\t\t\t\t\t\ttotalUsd: 50,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyoutube: {\n\t\t\t\t\t\t\t\tdailyUsd: 10,\n\t\t\t\t\t\t\t\tnote: \"Google Ads for YouTube channel growth\",\n\t\t\t\t\t\t\t\ttotalUsd: 50,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tincludes:\n\t\t\t\t\t\t\t\"Free Smart Links, Smart Link analytics, custom themes, validated pixel IDs, team seats, and campaign landing pages where available\",\n\t\t\t\t\t\tmanagedAdvertising: {\n\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\"Managed advertising subscription and payment setup happen in the Dynamoi dashboard. This MCP server can check billing readiness after setup; it does not start subscriptions or collect payment for managed advertising.\",\n\t\t\t\t\t\t\tpaymentSetupLocation: \"Dynamoi dashboard\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\tnoContracts: true,\n\t\t\t\t\t}),\n\t\t\t\t\turi: uri.href,\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t);\n\n\tserver.registerResource(\n\t\t\"platform-content-types\",\n\t\t\"dynamoi://platform/content-types\",\n\t\t{ mimeType: \"application/json\", title: \"Content Types\" },\n\t\tasync (uri) => ({\n\t\t\tcontents: [\n\t\t\t\t{\n\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\t\tcampaignTypes: {\n\t\t\t\t\t\t\tSMART_CAMPAIGN: [\"TRACK\", \"ALBUM\", \"PLAYLIST\"],\n\t\t\t\t\t\t\tYOUTUBE: [\"VIDEO\"],\n\t\t\t\t\t\t},\n\t\t\t\t\t\tcontentTypes: [\"TRACK\", \"ALBUM\", \"PLAYLIST\", \"VIDEO\"],\n\t\t\t\t\t}),\n\t\t\t\t\turi: uri.href,\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t);\n\n\tconst countryTargetingResource = async (uri: URL) => ({\n\t\tcontents: [\n\t\t\t{\n\t\t\t\tmimeType: \"application/json\",\n\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\tagentGuidance:\n\t\t\t\t\t\t\"Always choose a campaign type before suggesting target countries. Smart Campaign and YouTube country catalogs are different.\",\n\t\t\t\t\tsmartCampaigns: {\n\t\t\t\t\t\tmeaning:\n\t\t\t\t\t\t\t\"Spotify-focused Smart Campaign markets supported by Dynamoi's Meta campaign workflow.\",\n\t\t\t\t\t\tsource: \"SMART_CAMPAIGN_COUNTRIES\",\n\t\t\t\t\t\ttool: \"dynamoi_list_available_countries\",\n\t\t\t\t\t\ttoolInput: { campaignType: \"SMART_CAMPAIGN\" },\n\t\t\t\t\t},\n\t\t\t\t\tyoutubeCampaigns: {\n\t\t\t\t\t\tmeaning:\n\t\t\t\t\t\t\t\"Google Ads geo targets for YouTube campaign deployment and localization.\",\n\t\t\t\t\t\tsource: \"GOOGLE_ADS_COUNTRIES\",\n\t\t\t\t\t\ttool: \"dynamoi_list_available_countries\",\n\t\t\t\t\t\ttoolInput: { campaignType: \"YOUTUBE\" },\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t\turi: uri.href,\n\t\t\t},\n\t\t],\n\t});\n\n\tserver.registerResource(\n\t\t\"platform-country-targeting\",\n\t\t\"dynamoi://platform/country-targeting\",\n\t\t{\n\t\t\tdescription:\n\t\t\t\t\"Explains Smart Campaign vs YouTube country-targeting catalogs.\",\n\t\t\tmimeType: \"application/json\",\n\t\t\ttitle: \"Country Targeting\",\n\t\t},\n\t\tcountryTargetingResource,\n\t);\n\n\tserver.registerResource(\n\t\t\"platform-supported-countries\",\n\t\t\"dynamoi://platform/supported-countries\",\n\t\t{\n\t\t\tdescription:\n\t\t\t\t\"Legacy alias for country-targeting guidance. Use dynamoi://platform/country-targeting for the canonical resource.\",\n\t\t\tmimeType: \"application/json\",\n\t\t\ttitle: \"Supported Countries\",\n\t\t},\n\t\tcountryTargetingResource,\n\t);\n\n\tserver.registerResource(\n\t\t\"smart-links-free-plan\",\n\t\t\"dynamoi://smart-links/free-plan\",\n\t\t{\n\t\t\tdescription:\n\t\t\t\t\"Canonical explanation of Dynamoi's free Smart Links plan and how it differs from paid managed advertising.\",\n\t\t\tmimeType: \"application/json\",\n\t\t\ttitle: \"Free Smart Links\",\n\t\t},\n\t\tasync (uri) => ({\n\t\t\tcontents: [\n\t\t\t\t{\n\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\t\tfree: true,\n\t\t\t\t\t\tincluded: [\n\t\t\t\t\t\t\t\"Unlimited free Smart Links for supported Spotify artist, album, and track URLs\",\n\t\t\t\t\t\t\t\"Artist hub pages for catalog-level Smart Links\",\n\t\t\t\t\t\t\t\"Smart Link analytics\",\n\t\t\t\t\t\t\t\"Artist-level themes\",\n\t\t\t\t\t\t\t\"Validated Meta, TikTok, and Google Ads pixel IDs\",\n\t\t\t\t\t\t\t\"Artist-level public availability controls\",\n\t\t\t\t\t\t],\n\t\t\t\t\t\tnoCatch:\n\t\t\t\t\t\t\t\"No per-link fee for Smart Link creation or management. High-popularity or unverifiable artist links may stay unpublished in verification hold until Dynamoi can verify the client relationship.\",\n\t\t\t\t\t\tpaidSeparately:\n\t\t\t\t\t\t\t\"Managed advertising campaigns and ad budgets are separate paid products.\",\n\t\t\t\t\t}),\n\t\t\t\t\turi: uri.href,\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t);\n\n\tserver.registerResource(\n\t\t\"smart-links-capabilities\",\n\t\t\"dynamoi://smart-links/capabilities\",\n\t\t{ mimeType: \"application/json\", title: \"Smart Link Capabilities\" },\n\t\tasync (uri) => ({\n\t\t\tcontents: [\n\t\t\t\t{\n\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\t\tartistCatalogWorkflow:\n\t\t\t\t\t\t\t\"Use dynamoi_create_smart_links_from_spotify_artist for Spotify artist URLs when the user wants the artist hub, catalog import, or all links. The tool creates/returns a starter link immediately and starts the background catalog import so the user does not need the dashboard.\",\n\t\t\t\t\t\tcreationInputs: {\n\t\t\t\t\t\t\tsupportedSpotifyKinds: [\"artist\", \"album\", \"track\"],\n\t\t\t\t\t\t\tunsupportedToday: [\"playlist\"],\n\t\t\t\t\t\t},\n\t\t\t\t\t\tmutableFields: {\n\t\t\t\t\t\t\tartistLevel: [\n\t\t\t\t\t\t\t\t\"defaultTheme\",\n\t\t\t\t\t\t\t\t\"metaPixelId\",\n\t\t\t\t\t\t\t\t\"tiktokPixelId\",\n\t\t\t\t\t\t\t\t\"googleAdsConversionId\",\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\tperLink: [\"customDescription\"],\n\t\t\t\t\t\t},\n\t\t\t\t\t\tpixelPolicy:\n\t\t\t\t\t\t\t\"Only validated pixel IDs are accepted. Arbitrary JavaScript, tag snippets, and script URLs are not supported.\",\n\t\t\t\t\t\tthemes: [\"classic\", \"brutalist\", \"aurora\", \"cinematic\"],\n\t\t\t\t\t}),\n\t\t\t\t\turi: uri.href,\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t);\n\n\tserver.registerResource(\n\t\t\"business-free-vs-paid\",\n\t\t\"dynamoi://business/free-vs-paid\",\n\t\t{\n\t\t\tdescription:\n\t\t\t\t\"Clear boundary between free Dynamoi Smart Links and paid managed advertising.\",\n\t\t\tmimeType: \"application/json\",\n\t\t\ttitle: \"Free Smart Links vs Paid Campaigns\",\n\t\t},\n\t\tasync (uri) => ({\n\t\t\tcontents: [\n\t\t\t\t{\n\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\t\tagentGuidance:\n\t\t\t\t\t\t\t\"Do not imply that a Smart Link creates an ad campaign. Do not imply that campaign budgets are free.\",\n\t\t\t\t\t\tfreeSmartLinks: {\n\t\t\t\t\t\t\tclaim:\n\t\t\t\t\t\t\t\t\"Smart Links are free to create and manage. High-popularity or unverifiable artist links may require verification before public publishing.\",\n\t\t\t\t\t\t\tuseFor:\n\t\t\t\t\t\t\t\t\"Spotify landing pages, public release links, link sharing, basic link analytics, artist-level themes, and validated pixel IDs.\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\tmanagedAdvertising: {\n\t\t\t\t\t\t\tpaid: true,\n\t\t\t\t\t\t\tpricing:\n\t\t\t\t\t\t\t\t\"Billing and payment setup happen in the Dynamoi dashboard.\",\n\t\t\t\t\t\t\tuseFor:\n\t\t\t\t\t\t\t\t\"Managed Meta and Google ad campaigns for Spotify promotion and YouTube channel growth.\",\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t\t\t\turi: uri.href,\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t);\n\n\tserver.registerResource(\n\t\t\"smart-links-agent-guide\",\n\t\t\"dynamoi://smart-links/agent-guide\",\n\t\t{\n\t\t\tdescription:\n\t\t\t\t\"How agents should answer Smart Link questions using Dynamoi MCP tools.\",\n\t\t\tmimeType: \"application/json\",\n\t\t\ttitle: \"Smart Link Agent Guide\",\n\t\t},\n\t\tasync (uri) => ({\n\t\t\tcontents: [\n\t\t\t\t{\n\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\t\tanswerWith: [\n\t\t\t\t\t\t\t\"artist hub URL when present\",\n\t\t\t\t\t\t\t\"release title\",\n\t\t\t\t\t\t\t\"artist name\",\n\t\t\t\t\t\t\t\"public URL\",\n\t\t\t\t\t\t\t\"public status\",\n\t\t\t\t\t\t\t\"one next action when relevant\",\n\t\t\t\t\t\t],\n\t\t\t\t\t\tavoidByDefault: [\n\t\t\t\t\t\t\t\"internal UUIDs\",\n\t\t\t\t\t\t\t\"database model names\",\n\t\t\t\t\t\t\t\"workflow IDs\",\n\t\t\t\t\t\t\t\"provider implementation details\",\n\t\t\t\t\t\t],\n\t\t\t\t\t\twhenToUse:\n\t\t\t\t\t\t\t\"Use Smart Link tools when the user asks for free release links, artist hubs, full-catalog Spotify landing pages, streaming landing pages, Spotify link pages, Smart Link analytics, themes, pixels, public status, or public URLs.\",\n\t\t\t\t\t}),\n\t\t\t\t\turi: uri.href,\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t);\n\n\tserver.registerResource(\n\t\t\"mcp-tool-answering-rules\",\n\t\t\"dynamoi://mcp/tool-answering-rules\",\n\t\t{\n\t\t\tdescription:\n\t\t\t\t\"General answer rules for Dynamoi MCP tools so agents stop after useful results.\",\n\t\t\tmimeType: \"application/json\",\n\t\t\ttitle: \"MCP Tool Answering Rules\",\n\t\t},\n\t\tasync (uri) => ({\n\t\t\tcontents: [\n\t\t\t\t{\n\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\t\temptyStateRule:\n\t\t\t\t\t\t\t\"If the request identifies an artist, campaign, or Smart Link, use the targeted read directly. For missing or ambiguous identity, use the relevant roster or search tool first, then read the resolved resource. For a known empty account, use dynamoi_get_account_overview.recommendedNextActions or dynamoi://playbooks/onboarding-tree to explain supported onboarding; do not treat empty lists as a terminal answer.\",\n\t\t\t\t\t\tgenericAdvice:\n\t\t\t\t\t\t\t\"Answer generic music marketing questions directly unless the user asks about their Dynamoi account or asks Dynamoi to take an action.\",\n\t\t\t\t\t\tstopRule:\n\t\t\t\t\t\t\t\"If a read tool already returns the requested fact in summary form, answer the user instead of chaining more read tools.\",\n\t\t\t\t\t\tuserFacingFields:\n\t\t\t\t\t\t\t\"Prefer names, public URLs, statuses, money display values, and next actions over internal IDs.\",\n\t\t\t\t\t\twriteRule:\n\t\t\t\t\t\t\t\"Before write tools, confirm what will change. After success, answer from the returned record.\",\n\t\t\t\t\t}),\n\t\t\t\t\turi: uri.href,\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t);\n\n\tregisterPlaybookResources(server);\n\n\tserver.registerResource(\n\t\t\"music-marketing-when-to-use-dynamoi\",\n\t\t\"dynamoi://music-marketing/when-to-use-dynamoi\",\n\t\t{\n\t\t\tdescription:\n\t\t\t\t\"When an assistant should use Dynamoi account tools versus answering music marketing questions natively.\",\n\t\t\tmimeType: \"application/json\",\n\t\t\ttitle: \"When To Use Dynamoi\",\n\t\t},\n\t\tasync (uri) => ({\n\t\t\tcontents: [\n\t\t\t\t{\n\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\t\tanswerNativelyFor: [\n\t\t\t\t\t\t\t\"general promotion strategy\",\n\t\t\t\t\t\t\t\"songwriting, branding, release-planning, or content ideas\",\n\t\t\t\t\t\t\t\"music marketing education that does not require the user's Dynamoi data\",\n\t\t\t\t\t\t],\n\t\t\t\t\t\tuseToolsFor: [\n\t\t\t\t\t\t\t\"finding the user's artists, campaigns, Smart Links, billing, platform connections, or analytics\",\n\t\t\t\t\t\t\t\"creating or editing free Smart Links\",\n\t\t\t\t\t\t\t\"confirmed campaign mutations such as pause, resume, budget update, or launch workflow\",\n\t\t\t\t\t\t],\n\t\t\t\t\t}),\n\t\t\t\t\turi: uri.href,\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t);\n\n\tserver.registerResource(\n\t\t\"platform-campaign-statuses\",\n\t\t\"dynamoi://platform/campaign-statuses\",\n\t\t{ mimeType: \"application/json\", title: \"Campaign Statuses\" },\n\t\tasync (uri) => ({\n\t\t\tcontents: [\n\t\t\t\t{\n\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\t\tstatuses: [\n\t\t\t\t\t\t\t\"AWAITING_SMART_LINK\",\n\t\t\t\t\t\t\t\"CONTENT_VALIDATION\",\n\t\t\t\t\t\t\t\"DEPLOYING\",\n\t\t\t\t\t\t\t\"READY_FOR_REVIEW\",\n\t\t\t\t\t\t\t\"ACTIVE\",\n\t\t\t\t\t\t\t\"PAUSED\",\n\t\t\t\t\t\t\t\"SUBSCRIPTION_PAUSED\",\n\t\t\t\t\t\t\t\"FAILED\",\n\t\t\t\t\t\t\t\"ARCHIVED\",\n\t\t\t\t\t\t\t\"ENDED\",\n\t\t\t\t\t\t],\n\t\t\t\t\t}),\n\t\t\t\t\turi: uri.href,\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t);\n\n\t// Dynamic resources: lightweight equivalents to get_* tools\n\tserver.registerResource(\n\t\t\"artist-resource\",\n\t\tnew ResourceTemplate(\"dynamoi://artist/{artistId}\", {\n\t\t\tlist: async () => ({ resources: [] }),\n\t\t}),\n\t\t{ mimeType: \"application/json\", title: \"Artist\" },\n\t\tasync (uri, variables) => {\n\t\t\tconst artistId = variables[\"artistId\"];\n\t\t\tconst parsed = z.string().uuid().safeParse(artistId);\n\t\t\tif (!parsed.success) {\n\t\t\t\treturn {\n\t\t\t\t\tcontents: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\t\t\t\tmessage: \"Invalid artistId\",\n\t\t\t\t\t\t\t\tstatus: \"error\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\turi: uri.href,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst envelope = await adapter.getArtist({\n\t\t\t\tartistId: parsed.data,\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tcontents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\t\ttext: JSON.stringify(envelope),\n\t\t\t\t\t\turi: uri.href,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t},\n\t);\n\n\tserver.registerResource(\n\t\t\"campaign-resource\",\n\t\tnew ResourceTemplate(\"dynamoi://campaign/{campaignId}\", {\n\t\t\tlist: async () => ({ resources: [] }),\n\t\t}),\n\t\t{ mimeType: \"application/json\", title: \"Campaign\" },\n\t\tasync (uri, variables) => {\n\t\t\tconst campaignId = variables[\"campaignId\"];\n\t\t\tconst parsed = z.string().uuid().safeParse(campaignId);\n\t\t\tif (!parsed.success) {\n\t\t\t\treturn {\n\t\t\t\t\tcontents: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\t\t\t\tmessage: \"Invalid campaignId\",\n\t\t\t\t\t\t\t\tstatus: \"error\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\turi: uri.href,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst envelope = await adapter.getCampaign({\n\t\t\t\tcampaignId: parsed.data,\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tcontents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\t\ttext: JSON.stringify(envelope),\n\t\t\t\t\t\turi: uri.href,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t},\n\t);\n\n\tserver.registerResource(\n\t\t\"smart-link-resource\",\n\t\tnew ResourceTemplate(\"dynamoi://smart-link/{playLinkId}\", {\n\t\t\tlist: async () => ({ resources: [] }),\n\t\t}),\n\t\t{ mimeType: \"application/json\", title: \"Smart Link\" },\n\t\tasync (uri, variables) => {\n\t\t\tconst playLinkId = variables[\"playLinkId\"];\n\t\t\tconst parsed = z.string().uuid().safeParse(playLinkId);\n\t\t\tif (!parsed.success) {\n\t\t\t\treturn {\n\t\t\t\t\tcontents: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\t\t\t\tmessage: \"Invalid playLinkId\",\n\t\t\t\t\t\t\t\tstatus: \"error\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\turi: uri.href,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst envelope = await adapter.getSmartLink({\n\t\t\t\tplayLinkId: parsed.data,\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tcontents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\t\ttext: JSON.stringify(envelope),\n\t\t\t\t\t\turi: uri.href,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t},\n\t);\n\n\tserver.registerResource(\n\t\t\"smart-link-artist-settings-resource\",\n\t\tnew ResourceTemplate(\"dynamoi://artist/{artistId}/smart-link-settings\", {\n\t\t\tlist: async () => ({ resources: [] }),\n\t\t}),\n\t\t{ mimeType: \"application/json\", title: \"Smart Link Artist Settings\" },\n\t\tasync (uri, variables) => {\n\t\t\tconst artistId = variables[\"artistId\"];\n\t\t\tconst parsed = z.string().uuid().safeParse(artistId);\n\t\t\tif (!parsed.success) {\n\t\t\t\treturn {\n\t\t\t\t\tcontents: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\t\t\t\tmessage: \"Invalid artistId\",\n\t\t\t\t\t\t\t\tstatus: \"error\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\turi: uri.href,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst envelope = await adapter.getSmartLinkArtistSettings({\n\t\t\t\tartistId: parsed.data,\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tcontents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\t\ttext: JSON.stringify(envelope),\n\t\t\t\t\t\turi: uri.href,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t},\n\t);\n}\n",
13
+ "import type { McpServer } from \"@modelcontextprotocol/server\";\n\nexport function registerPlaybookResources(server: McpServer) {\n\tserver.registerResource(\n\t\t\"playbook-spotify-artist\",\n\t\t\"dynamoi://playbooks/spotify-artist\",\n\t\t{\n\t\t\tdescription:\n\t\t\t\t\"Persona playbook: how to convert a Spotify artist user from auth-grant to first activated Smart Link.\",\n\t\t\tmimeType: \"application/json\",\n\t\t\ttitle: \"Playbook: Spotify Artist\",\n\t\t},\n\t\tasync (uri) => ({\n\t\t\tcontents: [\n\t\t\t\t{\n\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\t\tfastestPath:\n\t\t\t\t\t\t\t\"Ask the user for their Spotify artist URL, then call dynamoi_create_smart_links_from_spotify_artist with that URL. Return the artist hub URL plus the starter Smart Link URL. Catalog import continues in the background.\",\n\t\t\t\t\t\tfreePlanReminder:\n\t\t\t\t\t\t\t\"Free Smart Links have no per-link fee for creation or management. High-popularity or unverifiable artist links may stay unpublished in verification hold until Dynamoi can verify the client relationship. Creating a Smart Link does not create a paid campaign or spend ad budget.\",\n\t\t\t\t\t\tpersona:\n\t\t\t\t\t\t\t\"Independent musician or small artist with at least one Spotify release. Goal: increase Spotify streams.\",\n\t\t\t\t\t\tsampleScript:\n\t\t\t\t\t\t\t\"Drop your Spotify artist link and I'll set up your free Dynamoi hub in about 30 seconds. We'll get all your releases on one shareable page, then we can talk about whether you want to promote any of them.\",\n\t\t\t\t\t\ttalkingPoints: {\n\t\t\t\t\t\t\tdifferentiatorComparison: {\n\t\t\t\t\t\t\t\tclaim:\n\t\t\t\t\t\t\t\t\t\"Linkfire, Feature.fm, and Hypeddit are primarily link and landing-page tools. Dynamoi starts with free Smart Links, then uses the same artist and link data to launch managed Meta campaigns from chat.\",\n\t\t\t\t\t\t\t\ttrigger:\n\t\t\t\t\t\t\t\t\t\"User asks how Dynamoi differs from link-in-bio or Smart Link products.\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\thesitationReassurance: {\n\t\t\t\t\t\t\t\tclaim:\n\t\t\t\t\t\t\t\t\t\"Managed advertising billing is completed in the Dynamoi dashboard. On surfaces without billing or launch tools, keep the flow focused on Smart Links, readiness, platform connections, and campaign management after billing setup is complete.\",\n\t\t\t\t\t\t\t\ttrigger:\n\t\t\t\t\t\t\t\t\t\"User hesitates about price, commitment, or whether the first month is enough to test.\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tpostLaunchExpectations: {\n\t\t\t\t\t\t\t\tclaim:\n\t\t\t\t\t\t\t\t\t\"After launch, expect 7-14 days of learning while delivery shifts by country and creative. CPC and save-rate trends are usually more useful than same-day results.\",\n\t\t\t\t\t\t\t\ttrigger:\n\t\t\t\t\t\t\t\t\t\"Immediately after a successful launch_campaign call or when the user asks when results should show.\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tsmartLinkPixelSeed: {\n\t\t\t\t\t\t\t\tclaim:\n\t\t\t\t\t\t\t\t\t\"Publishing a Smart Link can create first-party click and pixel signals before ad spend begins, which gives future Meta and Google campaigns a cleaner starting signal.\",\n\t\t\t\t\t\t\t\ttrigger:\n\t\t\t\t\t\t\t\t\t\"Smart Link user has no campaign yet or asks why a free Smart Link matters before ads.\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tsocialSideEffect: {\n\t\t\t\t\t\t\t\tclaim:\n\t\t\t\t\t\t\t\t\t\"Smart Campaigns run on Meta, so campaigns optimized for Spotify saves can also create Instagram engagement such as profile visits, likes, and follows as a side effect.\",\n\t\t\t\t\t\t\t\ttrigger:\n\t\t\t\t\t\t\t\t\t\"User mentions Instagram, social media growth, or followers while discussing Spotify promotion.\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tupsellAfterStarter:\n\t\t\t\t\t\t\t\"Once they have a hub URL, the natural next ask is 'would you like to promote this release on Meta Ads?' which routes to dynamoi_get_campaign_readiness, dynamoi_start_meta_connection if Meta is missing, then dynamoi_launch_campaign for a Smart Campaign — when those tools are available to this client.\",\n\t\t\t\t\t}),\n\t\t\t\t\turi: uri.href,\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t);\n\n\tserver.registerResource(\n\t\t\"playbook-youtube-creator\",\n\t\t\"dynamoi://playbooks/youtube-creator\",\n\t\t{\n\t\t\tdescription:\n\t\t\t\t\"Persona playbook: how to introduce a YouTube creator to Dynamoi's revenue-per-view optimization advantage.\",\n\t\t\tmimeType: \"application/json\",\n\t\t\ttitle: \"Playbook: YouTube Creator\",\n\t\t},\n\t\tasync (uri) => ({\n\t\t\tcontents: [\n\t\t\t\t{\n\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\t\tchannelLinkingPath:\n\t\t\t\t\t\t\t\"When connection tools are available to this client, call dynamoi_start_youtube_channel_link for the target artist, give the user the returned Google authorization URL, then poll dynamoi_get_platform_status for that artist with the returned onboardingAttemptId and onboardingFlow=youtube after the return page sends them back to chat. The completion field is platforms.youtube.connected. On surfaces without connection tools, direct the user: 'You can do this in the Dynamoi dashboard at https://dynamoi.com/dashboard.'\",\n\t\t\t\t\t\tdifferentiator:\n\t\t\t\t\t\t\t\"Dynamoi optimizes YouTube ad spend against AdSense revenue per country. Most ad tools optimize for views; Dynamoi optimizes for views that make money. The system explores small bids in new markets, scales countries where viewer revenue is strong, and pauses countries that cannot cover their costs.\",\n\t\t\t\t\t\tpersona:\n\t\t\t\t\t\t\t\"Channel owner of any niche (music, education, gaming, vlog, podcast, tutorial, product reviews) who wants subscriber growth that pays back via AdSense.\",\n\t\t\t\t\t\tpostLinkingFlow:\n\t\t\t\t\t\t\t\"After channel link, call dynamoi_get_campaign_readiness for a YouTube growth campaign when that tool is available to this client; otherwise direct campaign setup to the Dynamoi dashboard. Mention that ad copy is internationalized per market for lower cost and that campaigns require playlists so each paid view drives sustained organic views downstream.\",\n\t\t\t\t\t\tsampleScript:\n\t\t\t\t\t\t\t\"Most YouTube ad systems optimize for raw views. Dynamoi merges your AdSense revenue with ad cost data to optimize bids per country based on real viewer revenue, so you grow toward viewers who actually monetize. I can help you link your YouTube channel, then we can plan your first campaign.\",\n\t\t\t\t\t\ttalkingPoints: {\n\t\t\t\t\t\t\tdifferentiatorComparison: {\n\t\t\t\t\t\t\t\tclaim:\n\t\t\t\t\t\t\t\t\t\"Most creator ad tools optimize for views or subscribers. Dynamoi compares ad cost with AdSense revenue by country so delivery can favor viewers who are more likely to pay back over time.\",\n\t\t\t\t\t\t\t\ttrigger:\n\t\t\t\t\t\t\t\t\t\"User asks how YouTube campaigns differ from normal Google Ads or creator-growth services.\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\thesitationReassurance: {\n\t\t\t\t\t\t\t\tclaim:\n\t\t\t\t\t\t\t\t\t\"Managed advertising billing is completed in the Dynamoi dashboard. On surfaces without billing or launch tools, keep the flow focused on channel linking, readiness, and campaign management after billing setup is complete.\",\n\t\t\t\t\t\t\t\ttrigger:\n\t\t\t\t\t\t\t\t\t\"User expresses pricing concern or asks whether they can test without a long commitment.\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tplaylistWaterfall: {\n\t\t\t\t\t\t\t\tclaim:\n\t\t\t\t\t\t\t\t\t\"Playlist promotion sends viewers into a sequence, so one paid view can lead to additional organic views across related videos and channel-wide subscriber growth.\",\n\t\t\t\t\t\t\t\ttrigger:\n\t\t\t\t\t\t\t\t\t\"User asks whether campaigns can help subscribers or the whole channel instead of one video.\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tpostLaunchExpectations: {\n\t\t\t\t\t\t\t\tclaim:\n\t\t\t\t\t\t\t\t\t\"After launch, expect 7-14 days of learning while country bids, view quality, and attribution settle. Subscriber and revenue trends usually lag the first paid views.\",\n\t\t\t\t\t\t\t\ttrigger:\n\t\t\t\t\t\t\t\t\t\"Immediately after a successful YouTube launch or when the user asks when results should show.\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t\t\t\turi: uri.href,\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t);\n\n\tserver.registerResource(\n\t\t\"playbook-label-or-manager\",\n\t\t\"dynamoi://playbooks/label-or-manager\",\n\t\t{\n\t\t\tdescription:\n\t\t\t\t\"Persona playbook: how to onboard a label, manager, or anyone running a roster of multiple artists.\",\n\t\t\tmimeType: \"application/json\",\n\t\t\ttitle: \"Playbook: Label or Manager\",\n\t\t},\n\t\tasync (uri) => ({\n\t\t\tcontents: [\n\t\t\t\t{\n\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\t\tbillingNote:\n\t\t\t\t\t\t\t\"Consolidated billing across all artists in the organization. No per-seat charge, no per-artist fee.\",\n\t\t\t\t\t\tpersona:\n\t\t\t\t\t\t\t\"Label owner or manager handling more than one artist. Goal: oversee promotion across a roster from one account.\",\n\t\t\t\t\t\trolesNote:\n\t\t\t\t\t\t\t\"Dynamoi supports admin, editor, and viewer roles at organization and artist level. Editors can mutate everything except admin management; viewers are read-only.\",\n\t\t\t\t\t\tsampleScript:\n\t\t\t\t\t\t\t\"Dynamoi handles rosters: organizations with admin/editor/viewer roles, consolidated billing, and per-artist permissions. To start, create your first artist with a Spotify URL, then invite your team. We can layer in more artists from the same organization once you have one running.\",\n\t\t\t\t\t\tsetupSequence: [\n\t\t\t\t\t\t\t\"If they have one artist ready: route to dynamoi://playbooks/spotify-artist for that first artist.\",\n\t\t\t\t\t\t\t\"After the first artist is set up, mention team invites are managed in organization settings — not available through MCP. 'You can do this in the Dynamoi dashboard at https://dynamoi.com/dashboard.'\",\n\t\t\t\t\t\t\t\"Cross-artist analytics are available via dynamoi_get_artist_analytics per artist; a roster-wide rollup is dashboard-only.\",\n\t\t\t\t\t\t],\n\t\t\t\t\t\ttalkingPoints: {\n\t\t\t\t\t\t\tconsolidatedRoster: {\n\t\t\t\t\t\t\t\tclaim:\n\t\t\t\t\t\t\t\t\t\"One organization can hold multiple artists with admin, editor, and viewer roles, while campaign launch and billing state stay visible per artist.\",\n\t\t\t\t\t\t\t\ttrigger:\n\t\t\t\t\t\t\t\t\t\"User says they manage more than one artist or asks whether a label/manager workflow is supported.\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tdifferentiatorComparison: {\n\t\t\t\t\t\t\t\tclaim:\n\t\t\t\t\t\t\t\t\t\"Traditional Smart Link tools stop at links and analytics. Dynamoi keeps those free, then lets a roster operator move from link to managed campaign launch in the same assistant thread.\",\n\t\t\t\t\t\t\t\ttrigger:\n\t\t\t\t\t\t\t\t\t\"User compares Dynamoi to Linkfire, Feature.fm, Hypeddit, or a label marketing stack.\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\thesitationReassurance: {\n\t\t\t\t\t\t\t\tclaim:\n\t\t\t\t\t\t\t\t\t\"Managed advertising billing is completed in the Dynamoi dashboard. On surfaces without billing or launch tools, keep the flow focused on roster setup, readiness checks, and campaign management after billing setup is complete.\",\n\t\t\t\t\t\t\t\ttrigger:\n\t\t\t\t\t\t\t\t\t\"User asks whether billing scales per seat or wants to test with one artist first.\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t\t\t\turi: uri.href,\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t);\n\n\tserver.registerResource(\n\t\t\"playbook-onboarding-tree\",\n\t\t\"dynamoi://playbooks/onboarding-tree\",\n\t\t{\n\t\t\tdescription:\n\t\t\t\t\"Decision tree for routing a brand-new MCP user to the right persona playbook based on their first reply.\",\n\t\t\tmimeType: \"application/json\",\n\t\t\ttitle: \"Playbook: Onboarding Decision Tree\",\n\t\t},\n\t\tasync (uri) => ({\n\t\t\tcontents: [\n\t\t\t\t{\n\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\t\tnodes: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdo: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tmatch: \"Spotify artist\",\n\t\t\t\t\t\t\t\t\t\trouteTo: \"dynamoi://playbooks/spotify-artist\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tmatch: \"YouTube creator\",\n\t\t\t\t\t\t\t\t\t\trouteTo: \"dynamoi://playbooks/youtube-creator\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tmatch: \"Label / manager / multiple artists\",\n\t\t\t\t\t\t\t\t\t\trouteTo: \"dynamoi://playbooks/label-or-manager\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\tif: \"state.hasAnyArtist === false\",\n\t\t\t\t\t\t\t\tquestion:\n\t\t\t\t\t\t\t\t\t\"Are you a Spotify artist, a YouTube creator, or running a label/managing a roster?\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdo: \"Offer dynamoi_create_smart_link_from_spotify or dynamoi_create_smart_links_from_spotify_artist for the fastest visible win.\",\n\t\t\t\t\t\t\t\tif: \"state.hasAnyArtist === true && state.hasAnySmartLink === false\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdo: \"Offer dynamoi_get_campaign_readiness to validate launch inputs before creating anything, when that tool is available to this client.\",\n\t\t\t\t\t\t\t\tif: \"state.hasAnyArtist === true && state.hasAnyActiveCampaign === false\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdo: \"Managed-advertising billing setup is not available through this MCP surface; tell the user: 'You can do this in the Dynamoi dashboard at https://dynamoi.com/dashboard.' After they start or restore billing there, poll dynamoi_get_billing for that artist to confirm billing is active.\",\n\t\t\t\t\t\t\t\tif: \"state.hasAnyArtist === true && billing is the launch blocker\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdo: \"When connection tools are available to this client, offer dynamoi_start_meta_connection for the target artist, then poll dynamoi_get_platform_status for that artist with the returned onboardingAttemptId and onboardingFlow=meta after Meta returns them to chat. The completion field is platforms.meta.status. On surfaces without connection tools, direct the user: 'You can do this in the Dynamoi dashboard at https://dynamoi.com/dashboard.'\",\n\t\t\t\t\t\t\t\tif: \"state.hasAnyArtist === true && user wants Spotify Smart Campaigns && state.hasAnyConnectedMeta === false\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdo: \"When connection tools are available to this client, offer dynamoi_start_youtube_channel_link for the target artist, then poll dynamoi_get_platform_status for that artist with the returned onboardingAttemptId and onboardingFlow=youtube after Google returns them to chat. The completion field is platforms.youtube.connected. On surfaces without connection tools, direct the user: 'You can do this in the Dynamoi dashboard at https://dynamoi.com/dashboard.'\",\n\t\t\t\t\t\t\t\tif: \"state.hasAnyArtist === true && user wants YouTube growth && state.hasAnyConnectedYoutube === false\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdo: \"Ask whether they want a performance summary, a new campaign, or to update an existing campaign.\",\n\t\t\t\t\t\t\t\tif: \"state.hasAnyActiveCampaign === true\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\tsource:\n\t\t\t\t\t\t\t\"This tree mirrors dynamoi_get_account_overview.recommendedNextActions. Use either; the tree is for explaining the plan to the user, the array is for deciding the next tool call.\",\n\t\t\t\t\t\ttalkingPoints: {\n\t\t\t\t\t\t\tcreatorFirstChoice: {\n\t\t\t\t\t\t\t\tclaim:\n\t\t\t\t\t\t\t\t\t\"Spotify artists should start from a Spotify artist URL; YouTube creators should start by linking a channel; labels and managers should pick one artist as the first setup path.\",\n\t\t\t\t\t\t\t\ttrigger:\n\t\t\t\t\t\t\t\t\t\"Brand-new user has no artists and asks what to do first.\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tpostLaunchExpectations: {\n\t\t\t\t\t\t\t\tclaim:\n\t\t\t\t\t\t\t\t\t\"Campaigns need 7-14 days of learning before judging performance. Early reads should focus on blockers, delivery status, spend, CPC, and whether attribution is flowing.\",\n\t\t\t\t\t\t\t\ttrigger:\n\t\t\t\t\t\t\t\t\t\"User asks what happens after launch or whether a first-day result is good or bad.\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tsmartLinkBeforeAds: {\n\t\t\t\t\t\t\t\tclaim:\n\t\t\t\t\t\t\t\t\t\"A free Smart Link is the fastest visible setup step because it produces a public asset, starts catalog context, and creates a natural handoff into campaign readiness.\",\n\t\t\t\t\t\t\t\ttrigger:\n\t\t\t\t\t\t\t\t\t\"User has an artist but no Smart Link or asks why the assistant recommends links before ads.\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t\t\t\turi: uri.href,\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t);\n}\n",
14
+ "import * as z from \"zod/v4\";\nimport {\n\taddRecoverySafetyIssues,\n\tResultErrorRecoverySchema,\n} from \"./output-schemas\";\n\nexport const DYNAMOI_SHOP_FULL_SCOPE = \"dynamoi:mcp.full\" as const;\nexport const DYNAMOI_SHOP_MAX_TARGET_COUNTRY_CODES = 50;\nconst DYNAMOI_SHOP_CUSTOM_MIN_TARGET_VIEWS = 25_000;\nconst DYNAMOI_SHOP_CUSTOM_MAX_TARGET_VIEWS = 1_000_000;\nconst DYNAMOI_SHOP_CUSTOM_MIN_DURATION_DAYS = 7;\nconst DYNAMOI_SHOP_CUSTOM_MAX_DURATION_DAYS = 30;\n\nconst ShopPackageSelectionInputSchema = z\n\t.object({\n\t\tkind: z.literal(\"package\"),\n\t\ttier: z.enum([\"starter\", \"standard\", \"premium\"]),\n\t})\n\t.strict();\n\nconst ShopCustomSelectionInputSchema = z\n\t.object({\n\t\tcampaignDurationDays: z\n\t\t\t.number()\n\t\t\t.int()\n\t\t\t.min(DYNAMOI_SHOP_CUSTOM_MIN_DURATION_DAYS)\n\t\t\t.max(DYNAMOI_SHOP_CUSTOM_MAX_DURATION_DAYS),\n\t\tkind: z.literal(\"custom\"),\n\t\ttargetViews: z\n\t\t\t.number()\n\t\t\t.int()\n\t\t\t.min(DYNAMOI_SHOP_CUSTOM_MIN_TARGET_VIEWS)\n\t\t\t.max(DYNAMOI_SHOP_CUSTOM_MAX_TARGET_VIEWS),\n\t})\n\t.strict();\n\nexport const DynamoiShopSelectionInputSchema = z.discriminatedUnion(\"kind\", [\n\tShopPackageSelectionInputSchema,\n\tShopCustomSelectionInputSchema,\n]);\n\nconst ShopGlobalTargetingInputSchema = z\n\t.object({ mode: z.literal(\"GLOBAL\") })\n\t.strict();\n\nconst ShopIncludedTargetingInputSchema = z\n\t.object({\n\t\tcountryCodes: z\n\t\t\t.array(z.string().regex(/^[A-Z]{2}$/))\n\t\t\t.min(1)\n\t\t\t.max(DYNAMOI_SHOP_MAX_TARGET_COUNTRY_CODES),\n\t\tmode: z.literal(\"INCLUDE\"),\n\t})\n\t.strict();\n\nexport const DynamoiShopTargetingInputSchema = z.discriminatedUnion(\"mode\", [\n\tShopGlobalTargetingInputSchema,\n\tShopIncludedTargetingInputSchema,\n]);\n\nexport const DynamoiShopGetQuoteInputSchema = z\n\t.object({\n\t\tmarketLocale: z.string().trim().min(2).max(35),\n\t\tselection: DynamoiShopSelectionInputSchema,\n\t\tstorefrontSlug: z\n\t\t\t.string()\n\t\t\t.trim()\n\t\t\t.min(1)\n\t\t\t.max(160)\n\t\t\t.regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/),\n\t\ttargeting: DynamoiShopTargetingInputSchema,\n\t\tyoutubeUrl: z.string().trim().url().max(500),\n\t})\n\t.strict();\n\nexport const DynamoiShopCreateCheckoutInputSchema = z\n\t.object({\n\t\texpectedTotal: z\n\t\t\t.object({\n\t\t\t\tamountMinor: z.number().int().positive(),\n\t\t\t\tcurrency: z.string().regex(/^[A-Z]{3}$/),\n\t\t\t})\n\t\t\t.strict(),\n\t\tpromotion: DynamoiShopGetQuoteInputSchema,\n\t\trequestId: z.string().uuid(),\n\t})\n\t.strict();\n\nconst ShopSelectionOutputSchema = DynamoiShopSelectionInputSchema;\nconst ShopTargetingOutputSchema = z.discriminatedUnion(\"mode\", [\n\tShopGlobalTargetingInputSchema,\n\tz\n\t\t.object({\n\t\t\tcountryCodes: z.array(z.string().regex(/^[A-Z]{2}$/)).min(1),\n\t\t\tmode: z.literal(\"INCLUDE\"),\n\t\t})\n\t\t.strict(),\n]);\n\nconst ShopMoneyOutputSchema = z\n\t.object({\n\t\tamountMinor: z.number().int().positive(),\n\t\tcurrency: z.string().regex(/^[A-Z]{3}$/),\n\t\tformatted: z.string().min(1).max(80),\n\t})\n\t.strict();\n\nexport const DynamoiShopQuoteDataSchema = z\n\t.object({\n\t\tcampaignDurationDays: z.number().int().positive().nullable(),\n\t\testimatedViews: z\n\t\t\t.object({\n\t\t\t\tbasis: z.literal(\"rolling_30_day_cpv\"),\n\t\t\t\tmax: z.number().int().nonnegative(),\n\t\t\t\tmin: z.number().int().nonnegative(),\n\t\t\t\tnotGuaranteed: z.literal(true),\n\t\t\t})\n\t\t\t.strict()\n\t\t\t.nullable(),\n\t\tkind: z.literal(\"shop_quote\"),\n\t\treviewRequired: z.boolean(),\n\t\tselection: ShopSelectionOutputSchema,\n\t\tstorefront: z\n\t\t\t.object({\n\t\t\t\tcurrency: z.string().regex(/^[A-Z]{3}$/),\n\t\t\t\tmarketLocale: z.string(),\n\t\t\t\tslug: z.string(),\n\t\t\t})\n\t\t\t.strict(),\n\t\ttargeting: ShopTargetingOutputSchema,\n\t\ttotal: ShopMoneyOutputSchema,\n\t\tvideo: z\n\t\t\t.object({\n\t\t\t\tnormalizedUrl: z.string().url(),\n\t\t\t\tvideoId: z.string().regex(/^[A-Za-z0-9_-]{11}$/),\n\t\t\t})\n\t\t\t.strict(),\n\t})\n\t.strict();\n\nexport const DynamoiShopCheckoutDataSchema = z\n\t.object({\n\t\tcheckoutUrl: z.string().url(),\n\t\texpiresAt: z.string().datetime({ offset: true }),\n\t\tkind: z.literal(\"shop_checkout\"),\n\t\torderCreated: z.literal(false),\n\t\tpaymentCompleted: z.literal(false),\n\t\tstatus: z.literal(\"checkout_required\"),\n\t\ttotal: ShopMoneyOutputSchema,\n\t})\n\t.strict();\n\nconst ToolErrorEnvelopeSchema = z\n\t.object({\n\t\tkind: z.enum([\"validation\", \"business\", \"platform\", \"unknown\"]),\n\t\tmessage: z.string().min(1),\n\t\t...ResultErrorRecoverySchema.shape,\n\t\tstatus: z.literal(\"error\"),\n\t})\n\t.strict()\n\t.superRefine((value, context) => {\n\t\taddRecoverySafetyIssues(value, context);\n\t});\n\nconst DynamoiShopQuoteOutputEnvelopeSchema = z.union([\n\tz\n\t\t.object({\n\t\t\tdata: DynamoiShopQuoteDataSchema,\n\t\t\tstatus: z.literal(\"success\"),\n\t\t})\n\t\t.strict(),\n\tToolErrorEnvelopeSchema,\n]);\n\nconst DynamoiShopCheckoutOutputEnvelopeSchema = z.union([\n\tz\n\t\t.object({\n\t\t\tdata: DynamoiShopCheckoutDataSchema,\n\t\t\tstatus: z.literal(\"success\"),\n\t\t})\n\t\t.strict(),\n\tToolErrorEnvelopeSchema,\n]);\n\nexport type DynamoiShopGetQuoteInput = z.infer<\n\ttypeof DynamoiShopGetQuoteInputSchema\n>;\nexport type DynamoiShopCreateCheckoutInput = z.infer<\n\ttypeof DynamoiShopCreateCheckoutInputSchema\n>;\nexport type DynamoiShopQuoteData = z.infer<typeof DynamoiShopQuoteDataSchema>;\nexport type DynamoiShopCheckoutData = z.infer<\n\ttypeof DynamoiShopCheckoutDataSchema\n>;\n\nexport const SHOP_TOOL_DEFINITIONS = [\n\t{\n\t\tdescription:\n\t\t\t\"Calculate a read-only Dynamoi Shop estimate for a one-off YouTube video promotion. The server derives storefront price, currency, targeting, and estimated views. This does not reserve a price, create checkout, collect payment, create an order, or launch a campaign.\",\n\t\tdestructiveHint: false,\n\t\tidempotentHint: true,\n\t\tname: \"dynamoi_shop_get_quote\",\n\t\topenWorldHint: false,\n\t\toutputSchema: DynamoiShopQuoteOutputEnvelopeSchema,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiShopGetQuoteInputSchema,\n\t\ttitle: \"Get Shop Promotion Estimate\",\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"After explicit user intent, revalidate and re-quote a one-off Dynamoi Shop YouTube promotion and create an unpaid Stripe Checkout Session. The expected total is a compare-and-reject guard, never a price instruction. This does not charge the user, create an order, or launch a campaign; the user must open and complete Stripe Checkout.\",\n\t\tdestructiveHint: false,\n\t\tidempotentHint: true,\n\t\tname: \"dynamoi_shop_create_checkout\",\n\t\topenWorldHint: true,\n\t\toutputSchema: DynamoiShopCheckoutOutputEnvelopeSchema,\n\t\treadOnlyHint: false,\n\t\tschema: DynamoiShopCreateCheckoutInputSchema,\n\t\ttitle: \"Create Unpaid Shop Checkout\",\n\t},\n] as const;\n",
15
+ "import type { McpServer } from \"@modelcontextprotocol/server\";\nimport * as z from \"zod/v4\";\nimport type { ResultEnvelope } from \"../types\";\nimport { AnyOutputEnvelopeSchema } from \"./output-schemas\";\n\nexport const SMART_LINK_THEME_PREVIEW_RESOURCE_URI =\n\t\"ui://dynamoi/smart-link-theme-preview-v1.html\";\n\nconst SampleTextSchema = z.string().trim().min(1).max(80);\n\nconst DynamoiPreviewSmartLinkThemesInputSchema = z\n\t.object({\n\t\tartistName: SampleTextSchema.optional(),\n\t\treleaseTitle: SampleTextSchema.optional(),\n\t})\n\t.strict();\n\nexport type SmartLinkThemePreviewData = {\n\tartistName: string;\n\treleaseTitle: string;\n\tsummary: string;\n\tthemes: Array<{\n\t\taccentColor: string;\n\t\tbackgroundColor: string;\n\t\tdescription: string;\n\t\tid: \"classic\" | \"brutalist\" | \"aurora\" | \"cinematic\";\n\t\tname: string;\n\t\ttextColor: string;\n\t}>;\n\twidgetResourceUri: typeof SMART_LINK_THEME_PREVIEW_RESOURCE_URI;\n};\n\nexport const SMART_LINK_THEME_PREVIEW_TOOL_DEFINITION = {\n\tdescription:\n\t\t\"Use this when the user asks what Dynamoi Smart Link pages can look like, wants to compare Smart Link themes, or asks to preview the available themes before creating or updating a free Smart Link. This is a read-only visual preview and does not create, publish, update, or promote a Smart Link.\",\n\tdestructiveHint: false,\n\tname: \"dynamoi_preview_smart_link_themes\",\n\topenWorldHint: false,\n\toutputSchema: AnyOutputEnvelopeSchema,\n\treadOnlyHint: true,\n\tschema: DynamoiPreviewSmartLinkThemesInputSchema,\n\ttitle: \"Preview Smart Link Themes\",\n} as const;\n\nexport function previewSmartLinkThemes(\n\trawInput: unknown,\n): ResultEnvelope<SmartLinkThemePreviewData> {\n\tconst input = DynamoiPreviewSmartLinkThemesInputSchema.parse(rawInput ?? {});\n\tconst artistName = input.artistName ?? \"Dynamoi Artist\";\n\tconst releaseTitle = input.releaseTitle ?? \"New Single\";\n\tconst themes: SmartLinkThemePreviewData[\"themes\"] = [\n\t\t{\n\t\t\taccentColor: \"#2ef2a2\",\n\t\t\tbackgroundColor: \"#f8f6ef\",\n\t\t\tdescription:\n\t\t\t\t\"Clean editorial layout for release pages that should feel calm and polished.\",\n\t\t\tid: \"classic\",\n\t\t\tname: \"Classic\",\n\t\t\ttextColor: \"#171717\",\n\t\t},\n\t\t{\n\t\t\taccentColor: \"#ffe45c\",\n\t\t\tbackgroundColor: \"#111111\",\n\t\t\tdescription:\n\t\t\t\t\"Bold, poster-like treatment for artists who want sharp contrast and direct calls to action.\",\n\t\t\tid: \"brutalist\",\n\t\t\tname: \"Brutalist\",\n\t\t\ttextColor: \"#f5f5f5\",\n\t\t},\n\t\t{\n\t\t\taccentColor: \"#73f7ff\",\n\t\t\tbackgroundColor: \"#12172f\",\n\t\t\tdescription:\n\t\t\t\t\"Color-rich gradient atmosphere for pop, electronic, and high-energy releases.\",\n\t\t\tid: \"aurora\",\n\t\t\tname: \"Aurora\",\n\t\t\ttextColor: \"#f8fbff\",\n\t\t},\n\t\t{\n\t\t\taccentColor: \"#ffb36b\",\n\t\t\tbackgroundColor: \"#191512\",\n\t\t\tdescription:\n\t\t\t\t\"Moody cover-forward layout for cinematic, intimate, or premium release moments.\",\n\t\t\tid: \"cinematic\",\n\t\t\tname: \"Cinematic\",\n\t\t\ttextColor: \"#fff6eb\",\n\t\t},\n\t];\n\n\treturn {\n\t\tdata: {\n\t\t\tartistName,\n\t\t\treleaseTitle,\n\t\t\tsummary:\n\t\t\t\t\"Dynamoi Smart Links support four visual themes: Classic, Brutalist, Aurora, and Cinematic.\",\n\t\t\tthemes,\n\t\t\twidgetResourceUri: SMART_LINK_THEME_PREVIEW_RESOURCE_URI,\n\t\t},\n\t\tstatus: \"success\",\n\t};\n}\n\nconst SMART_LINK_THEME_PREVIEW_HTML = `\n<div class=\"shell\">\n\t<header>\n\t\t<p class=\"eyebrow\">Smart Link themes</p>\n\t\t<h1 id=\"title\">New Single</h1>\n\t\t<p id=\"artist\">Dynamoi Artist</p>\n\t</header>\n\t<section id=\"themes\" class=\"themes\" aria-label=\"Smart Link theme previews\"></section>\n</div>\n<script>\nconst fallback = {\n\tartistName: \"Dynamoi Artist\",\n\treleaseTitle: \"New Single\",\n\tthemes: [\n\t\t{ id: \"classic\", name: \"Classic\", description: \"Clean editorial layout for release pages that should feel calm and polished.\", backgroundColor: \"#f8f6ef\", textColor: \"#171717\", accentColor: \"#2ef2a2\" },\n\t\t{ id: \"brutalist\", name: \"Brutalist\", description: \"Bold, poster-like treatment for artists who want sharp contrast and direct calls to action.\", backgroundColor: \"#111111\", textColor: \"#f5f5f5\", accentColor: \"#ffe45c\" },\n\t\t{ id: \"aurora\", name: \"Aurora\", description: \"Color-rich gradient atmosphere for pop, electronic, and high-energy releases.\", backgroundColor: \"#12172f\", textColor: \"#f8fbff\", accentColor: \"#73f7ff\" },\n\t\t{ id: \"cinematic\", name: \"Cinematic\", description: \"Moody cover-forward layout for cinematic, intimate, or premium release moments.\", backgroundColor: \"#191512\", textColor: \"#fff6eb\", accentColor: \"#ffb36b\" }\n\t]\n};\nfunction normalize(output) {\n\tconst candidate = output?.data ?? output?.structuredContent?.data ?? output?.structuredContent ?? output;\n\treturn candidate?.themes ? candidate : fallback;\n}\nfunction render(output) {\n\tconst data = normalize(output);\n\tdocument.getElementById(\"title\").textContent = data.releaseTitle ?? fallback.releaseTitle;\n\tdocument.getElementById(\"artist\").textContent = data.artistName ?? fallback.artistName;\n\tconst themes = Array.isArray(data.themes) ? data.themes : fallback.themes;\n\tconst allowedThemeIds = new Set([\"classic\", \"brutalist\", \"aurora\", \"cinematic\"]);\n\tdocument.getElementById(\"themes\").replaceChildren(...themes.map((theme) => {\n\t\tconst article = document.createElement(\"article\");\n\t\tarticle.className = \"theme\";\n\t\tif (allowedThemeIds.has(theme.id)) article.classList.add(\"theme-\" + theme.id);\n\t\tarticle.style.backgroundColor = theme.backgroundColor;\n\t\tarticle.style.color = theme.textColor;\n\n\t\tconst cover = document.createElement(\"div\");\n\t\tcover.className = \"cover\";\n\t\tcover.style.backgroundColor = theme.accentColor;\n\t\tcover.append(document.createElement(\"span\"));\n\n\t\tconst copy = document.createElement(\"div\");\n\t\tcopy.className = \"theme-copy\";\n\t\tconst name = document.createElement(\"h2\");\n\t\tname.textContent = theme.name;\n\t\tconst description = document.createElement(\"p\");\n\t\tdescription.textContent = theme.description;\n\t\tcopy.append(name, description);\n\n\t\tconst cta = document.createElement(\"span\");\n\t\tcta.className = \"preview-cta\";\n\t\tcta.style.borderColor = theme.accentColor;\n\t\tcta.style.color = theme.textColor;\n\t\tcta.textContent = \"Listen on Spotify\";\n\t\tarticle.append(cover, copy, cta);\n\t\treturn article;\n\t}));\n}\nrender(window.openai?.toolOutput);\nwindow.addEventListener(\"openai:set_globals\", (event) => {\n\trender(event.detail?.globals?.toolOutput ?? window.openai?.toolOutput);\n}, { passive: true });\n</script>\n<style>\n:root {\n\tcolor-scheme: light dark;\n\tfont-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif;\n}\n* { box-sizing: border-box; }\nbody { margin: 0; }\n.shell {\n\tbackground: #f4f1e8;\n\tcolor: #151515;\n\tmin-height: 100vh;\n\tpadding: 18px;\n}\nheader {\n\tdisplay: grid;\n\tgap: 3px;\n\tmargin: 0 0 14px;\n}\n.eyebrow {\n\tcolor: #5f675f;\n\tfont-size: 12px;\n\tfont-weight: 700;\n\tletter-spacing: 0;\n\tmargin: 0;\n\ttext-transform: uppercase;\n}\nh1 {\n\tfont-size: 28px;\n\tline-height: 1;\n\tmargin: 0;\n}\nheader p:last-child {\n\tcolor: #59605a;\n\tfont-size: 14px;\n\tmargin: 0;\n}\n.themes {\n\tdisplay: grid;\n\tgap: 12px;\n\tgrid-template-columns: repeat(2, minmax(0, 1fr));\n}\n.theme {\n\tborder-radius: 8px;\n\tdisplay: grid;\n\tgap: 10px;\n\tmin-height: 232px;\n\toverflow: hidden;\n\tpadding: 12px;\n}\n.cover {\n\taspect-ratio: 1;\n\tborder-radius: 6px;\n\tdisplay: grid;\n\toverflow: hidden;\n\tplace-items: center;\n}\n.cover span {\n\tbackground: rgba(255, 255, 255, 0.62);\n\tborder: 1px solid rgba(0, 0, 0, 0.08);\n\tborder-radius: 999px;\n\tdisplay: block;\n\theight: 54%;\n\twidth: 54%;\n}\n.theme-aurora .cover {\n\tbackground: linear-gradient(135deg, #73f7ff, #ff6bd6 58%, #f6ff87) !important;\n}\n.theme-cinematic .cover {\n\tbackground: radial-gradient(circle at 48% 32%, #ffb36b, #7b3f2b 52%, #191512 76%) !important;\n}\n.theme h2 {\n\tfont-size: 18px;\n\tline-height: 1.1;\n\tmargin: 0 0 4px;\n}\n.theme p {\n\tfont-size: 12px;\n\tline-height: 1.35;\n\tmargin: 0;\n\topacity: 0.78;\n}\n.preview-cta {\n\tbackground: transparent;\n\tborder: 1px solid currentColor;\n\tborder-radius: 999px;\n\tfont: inherit;\n\tfont-size: 12px;\n\tfont-weight: 700;\n\tmin-height: 34px;\n\tpadding: 6px 10px;\n\twidth: 100%;\n}\n@media (max-width: 520px) {\n\t.shell { padding: 14px; }\n\t.themes { grid-template-columns: 1fr; }\n\th1 { font-size: 24px; }\n\t.theme {\n\t\tgrid-template-columns: 82px minmax(0, 1fr);\n\t\tmin-height: 0;\n\t}\n\t.cover { grid-row: span 2; }\n\t.preview-cta { grid-column: 2; }\n}\n</style>\n`.trim();\n\nexport function registerSmartLinkThemePreviewResource(server: McpServer) {\n\tserver.registerResource(\n\t\t\"smart-link-theme-preview\",\n\t\tSMART_LINK_THEME_PREVIEW_RESOURCE_URI,\n\t\t{\n\t\t\tdescription:\n\t\t\t\t\"Visual preview for the four Dynamoi Smart Link page themes.\",\n\t\t\tmimeType: \"text/html;profile=mcp-app\",\n\t\t\ttitle: \"Smart Link Theme Preview\",\n\t\t},\n\t\tasync () => ({\n\t\t\tcontents: [\n\t\t\t\t{\n\t\t\t\t\t_meta: {\n\t\t\t\t\t\tui: {\n\t\t\t\t\t\t\tcsp: {\n\t\t\t\t\t\t\t\tconnectDomains: [],\n\t\t\t\t\t\t\t\tresourceDomains: [],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tdomain: \"https://dynamoi.com\",\n\t\t\t\t\t\t\tprefersBorder: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tmimeType: \"text/html;profile=mcp-app\",\n\t\t\t\t\ttext: SMART_LINK_THEME_PREVIEW_HTML,\n\t\t\t\t\turi: SMART_LINK_THEME_PREVIEW_RESOURCE_URI,\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t);\n}\n",
16
+ "import * as z from \"zod/v4\";\nimport {\n\tAnyOutputEnvelopeSchema,\n\tCreateSmartLinkFromSpotifyOutputEnvelopeSchema,\n\tCreateSmartLinksFromSpotifyArtistOutputEnvelopeSchema,\n\tListSmartLinksOutputEnvelopeSchema,\n} from \"./output-schemas\";\nimport {\n\tClientRequestIdSchema,\n\tDateRangeSchema,\n\tRequiredClientRequestIdSchema,\n\tToolFormatSchema,\n\tUserIntentSummarySchema,\n} from \"./shared-schemas\";\n\nconst SmartLinkStatusFiltersSchema = {\n\tclaimStatus: z\n\t\t.enum([\n\t\t\t\"auto_approved\",\n\t\t\t\"pending_ops_review\",\n\t\t\t\"verification_deferred\",\n\t\t\t\"approved_by_ops\",\n\t\t\t\"rejected\",\n\t\t])\n\t\t.optional(),\n\tpublishState: z.enum([\"published\", \"unpublished\"]).optional(),\n\trenderState: z.enum([\"queued\", \"rendering\", \"rendered\", \"failed\"]).optional(),\n} as const;\n\nconst SmartLinkThemeSchema = z.enum([\n\t\"classic\",\n\t\"brutalist\",\n\t\"aurora\",\n\t\"cinematic\",\n]);\nexport const DynamoiCreateSmartLinkFromSpotifyInputSchema = z\n\t.object({\n\t\tartistId: z.string().uuid(),\n\t\tclientRequestId: RequiredClientRequestIdSchema.optional(),\n\t\tcustomDescription: z.string().trim().max(500).optional(),\n\t\tformat: ToolFormatSchema.optional(),\n\t\tspotifyUrl: z.string().trim().min(1).max(500),\n\t\tuserIntentSummary: UserIntentSummarySchema,\n\t})\n\t.strict();\n\nexport const DynamoiCreateSmartLinksFromSpotifyArtistInputSchema = z\n\t.object({\n\t\tartistId: z.string().uuid().optional(),\n\t\tclientRequestId: RequiredClientRequestIdSchema.optional(),\n\t\tformat: ToolFormatSchema.optional(),\n\t\tspotifyArtistUrl: z.string().trim().min(1).max(500),\n\t\tuserIntentSummary: UserIntentSummarySchema,\n\t})\n\t.strict();\n\nexport const DynamoiListSmartLinksInputSchema = z\n\t.object({\n\t\tartistId: z.string().uuid(),\n\t\tcursor: z.string().optional(),\n\t\tformat: ToolFormatSchema.optional(),\n\t\tlimit: z.number().int().min(1).max(50).optional(),\n\t\tquery: z.string().trim().max(120).optional(),\n\t\t...SmartLinkStatusFiltersSchema,\n\t})\n\t.strict();\n\nconst DynamoiGetSmartLinkInputShape = {\n\tartistId: z.string().uuid().optional(),\n\tdateRange: DateRangeSchema.optional(),\n\tformat: ToolFormatSchema.optional(),\n\tgranularity: z.enum([\"TOTAL\", \"DAILY\"]).optional(),\n\tincludeAnalytics: z.boolean().optional(),\n\tincludeArtistSettings: z.boolean().optional(),\n\tincludeBreakdowns: z.boolean().optional(),\n\tplayLinkId: z.string().uuid().optional(),\n\tspotifyUrl: z.string().trim().min(1).max(500).optional(),\n} as const;\n\nfunction validateDynamoiGetSmartLinkInput(\n\tdata: z.infer<z.ZodObject<typeof DynamoiGetSmartLinkInputShape>>,\n\tctx: z.RefinementCtx,\n) {\n\tconst settingsOnly =\n\t\tdata.includeArtistSettings === true &&\n\t\t!data.playLinkId &&\n\t\t!data.spotifyUrl &&\n\t\tBoolean(data.artistId);\n\tif (\n\t\t!(data.playLinkId || (data.artistId && data.spotifyUrl) || settingsOnly)\n\t) {\n\t\tctx.addIssue({\n\t\t\tcode: \"custom\",\n\t\t\tmessage:\n\t\t\t\t\"Provide playLinkId, artistId with spotifyUrl, or artistId with includeArtistSettings=true\",\n\t\t\tpath: [\"playLinkId\"],\n\t\t});\n\t}\n\tif (\n\t\t(data.dateRange || data.granularity || data.includeBreakdowns) &&\n\t\tdata.includeAnalytics !== true\n\t) {\n\t\tctx.addIssue({\n\t\t\tcode: \"custom\",\n\t\t\tmessage:\n\t\t\t\t\"dateRange, granularity, and includeBreakdowns require includeAnalytics=true\",\n\t\t\tpath: [\"includeAnalytics\"],\n\t\t});\n\t}\n}\n\nconst StrictDynamoiGetSmartLinkInputSchema = z\n\t.object(DynamoiGetSmartLinkInputShape)\n\t.strict()\n\t.superRefine(validateDynamoiGetSmartLinkInput);\n\nexport const DynamoiGetSmartLinkInputSchema =\n\tStrictDynamoiGetSmartLinkInputSchema;\n\nexport function parseDynamoiGetSmartLinkInput(rawInput: unknown) {\n\treturn StrictDynamoiGetSmartLinkInputSchema.parse(rawInput);\n}\n\nexport const DynamoiGetSmartLinkAnalyticsInputSchema = z\n\t.object({\n\t\tdateRange: DateRangeSchema.optional(),\n\t\tformat: ToolFormatSchema.optional(),\n\t\tgranularity: z.enum([\"TOTAL\", \"DAILY\"]).optional(),\n\t\tincludeBreakdowns: z.boolean().optional(),\n\t\tplayLinkId: z.string().uuid(),\n\t})\n\t.strict();\n\nexport const DynamoiGetSmartLinkArtistSettingsInputSchema = z\n\t.object({\n\t\tartistId: z.string().uuid(),\n\t\tformat: ToolFormatSchema.optional(),\n\t})\n\t.strict();\n\nexport const DynamoiUpdateSmartLinkInputSchema = z\n\t.object({\n\t\taction: z.enum([\"update_description\", \"update_artist_settings\"]),\n\t\tartistId: z.string().uuid().optional(),\n\t\tclientRequestId: ClientRequestIdSchema,\n\t\tcustomDescription: z.string().max(500).nullable().optional(),\n\t\texpectedUpdatedAt: z.string().datetime().optional(),\n\t\tgoogleAdsConversionId: z.string().trim().max(32).nullable().optional(),\n\t\tmetaPixelId: z.string().trim().max(32).nullable().optional(),\n\t\tplayLinkId: z.string().uuid().optional(),\n\t\ttheme: SmartLinkThemeSchema.optional(),\n\t\ttiktokPixelId: z.string().trim().max(32).nullable().optional(),\n\t\tuserIntentSummary: UserIntentSummarySchema,\n\t})\n\t.strict()\n\t.superRefine((data, ctx) => {\n\t\tif (\n\t\t\tdata.action === \"update_description\" &&\n\t\t\tdata.customDescription === undefined\n\t\t) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tmessage:\n\t\t\t\t\t\"customDescription is required when action is update_description\",\n\t\t\t\tpath: [\"customDescription\"],\n\t\t\t});\n\t\t}\n\t\tif (data.action !== \"update_artist_settings\" && !data.playLinkId) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tmessage: \"playLinkId is required when action is update_description\",\n\t\t\t\tpath: [\"playLinkId\"],\n\t\t\t});\n\t\t}\n\t\tif (data.action === \"update_artist_settings\") {\n\t\t\tif (!data.artistId) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tmessage: \"artistId is required when action is update_artist_settings\",\n\t\t\t\t\tpath: [\"artistId\"],\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (\n\t\t\t\tdata.theme === undefined &&\n\t\t\t\tdata.metaPixelId === undefined &&\n\t\t\t\tdata.tiktokPixelId === undefined &&\n\t\t\t\tdata.googleAdsConversionId === undefined\n\t\t\t) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tmessage: \"Provide at least one setting to update\",\n\t\t\t\t\tpath: [\"theme\"],\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\tif (data.action !== \"update_artist_settings\") {\n\t\t\tfor (const field of [\n\t\t\t\t\"artistId\",\n\t\t\t\t\"googleAdsConversionId\",\n\t\t\t\t\"metaPixelId\",\n\t\t\t\t\"theme\",\n\t\t\t\t\"tiktokPixelId\",\n\t\t\t] as const) {\n\t\t\t\tif (data[field] !== undefined) {\n\t\t\t\t\tctx.addIssue({\n\t\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\t\tmessage: `${field} is only valid for update_artist_settings`,\n\t\t\t\t\t\tpath: [field],\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\nexport const DynamoiUpdateSmartLinkArtistSettingsInputSchema = z\n\t.object({\n\t\tartistId: z.string().uuid(),\n\t\tclientRequestId: ClientRequestIdSchema,\n\t\tgoogleAdsConversionId: z.string().trim().max(32).nullable().optional(),\n\t\tmetaPixelId: z.string().trim().max(32).nullable().optional(),\n\t\ttheme: SmartLinkThemeSchema.optional(),\n\t\ttiktokPixelId: z.string().trim().max(32).nullable().optional(),\n\t\tuserIntentSummary: UserIntentSummarySchema,\n\t})\n\t.strict()\n\t.superRefine((data, ctx) => {\n\t\tif (\n\t\t\tdata.theme === undefined &&\n\t\t\tdata.metaPixelId === undefined &&\n\t\t\tdata.tiktokPixelId === undefined &&\n\t\t\tdata.googleAdsConversionId === undefined\n\t\t) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tmessage: \"Provide at least one setting to update\",\n\t\t\t\tpath: [\"theme\"],\n\t\t\t});\n\t\t}\n\t});\n\nexport const PHASE_4_TOOL_DEFINITIONS = [\n\t{\n\t\tdescription:\n\t\t\t\"Use this when the user wants to create one free Dynamoi Smart Link from a Spotify album or track URL/URI, or a single starter release from a Spotify artist URL. For full-catalog artist imports or artist hub requests, prefer dynamoi_create_smart_links_from_spotify_artist. Smart Links are free to create and manage. High-popularity or unverifiable artist links may stay unpublished in verification hold until Dynamoi can verify the client relationship. 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; if customDescription is provided, update that Smart Link's public description. In the final answer, lead with the public URL and do not expose internal IDs unless asked.\",\n\t\tdestructiveHint: true,\n\t\tidempotentHint: true,\n\t\tname: \"dynamoi_create_smart_link_from_spotify\",\n\t\topenWorldHint: true,\n\t\toutputSchema: CreateSmartLinkFromSpotifyOutputEnvelopeSchema,\n\t\treadOnlyHint: false,\n\t\tschema: DynamoiCreateSmartLinkFromSpotifyInputSchema,\n\t\ttitle: \"Create Free Smart Link from Spotify\",\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"Use this when the user gives a Spotify artist URL and wants Dynamoi to create, import, or refresh free Smart Links for the artist catalog and return the artist hub. If the signed-in user has no Dynamoi artist yet, omit artistId so Dynamoi can create the first artist from the Spotify artist profile. This starts the background catalog import so the user does not need to open the dashboard. Smart Links are free to create and manage. High-popularity or unverifiable artist catalog links may stay unpublished in verification hold until Dynamoi can verify the client relationship. This does not create a paid ad campaign. In the final answer, lead with the artist hub URL and current public Smart Link URLs; do not expose internal IDs unless asked.\",\n\t\tdestructiveHint: false,\n\t\tidempotentHint: true,\n\t\tname: \"dynamoi_create_smart_links_from_spotify_artist\",\n\t\topenWorldHint: true,\n\t\toutputSchema: CreateSmartLinksFromSpotifyArtistOutputEnvelopeSchema,\n\t\treadOnlyHint: false,\n\t\tschema: DynamoiCreateSmartLinksFromSpotifyArtistInputSchema,\n\t\ttitle: \"Create Free Smart Links for Spotify Artist\",\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"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. In the final answer, show public URLs and avoid internal IDs unless asked. If empty for an artist with connected Spotify, suggest dynamoi_create_smart_links_from_spotify_artist for catalog import or dynamoi_create_smart_link_from_spotify for one release instead of stopping at 'no Smart Links yet'.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_list_smart_links\",\n\t\topenWorldHint: false,\n\t\toutputSchema: ListSmartLinksOutputEnvelopeSchema,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiListSmartLinksInputSchema,\n\t\ttitle: \"List Smart Links\",\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"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. Set includeAnalytics=true for visit/click analytics and includeArtistSettings=true for artist-level theme/pixel settings. In the final answer, lead with the public URL and do not expose internal IDs unless asked.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_get_smart_link\",\n\t\topenWorldHint: false,\n\t\toutputSchema: AnyOutputEnvelopeSchema,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiGetSmartLinkInputSchema,\n\t\ttitle: \"Get Smart Link\",\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"Use this when the user wants to change one Smart Link's public description or update artist-level Smart Link theme/pixel settings. Set action to update_description or update_artist_settings. Public availability is artist-wide in the dashboard; this tool does not publish or unpublish individual links. Theme-only updates switch instantly; description or pixel changes may queue background rendering.\",\n\t\tdestructiveHint: true,\n\t\tidempotentHint: true,\n\t\tname: \"dynamoi_update_smart_link\",\n\t\topenWorldHint: true,\n\t\toutputSchema: AnyOutputEnvelopeSchema,\n\t\treadOnlyHint: false,\n\t\tschema: DynamoiUpdateSmartLinkInputSchema,\n\t\ttitle: \"Update Smart Link\",\n\t},\n] as const;\n",
16
17
  "import * as z from \"zod/v4\";\n\nexport const ToolFormatSchema = z.enum([\"json\", \"summary\"]);\n\nconst IsoDateSchema = z.string().regex(/^\\d{4}-\\d{2}-\\d{2}$/);\n\nexport const UserIntentSummarySchema = z.string().trim().max(500).optional();\n\nexport const ClientRequestIdSchema = z.string().uuid().optional();\n\nexport const RequiredClientRequestIdSchema = z.string().uuid();\n\nfunction isValidCalendarDate(value: string): boolean {\n\tconst date = new Date(`${value}T00:00:00.000Z`);\n\treturn (\n\t\tNumber.isFinite(date.getTime()) && date.toISOString().slice(0, 10) === value\n\t);\n}\n\nexport const IsoCalendarDateSchema = IsoDateSchema.refine(isValidCalendarDate, {\n\tmessage: \"must be a valid calendar date\",\n});\n\nexport const DateRangeSchema = z\n\t.object({\n\t\tend: IsoDateSchema,\n\t\tstart: IsoDateSchema,\n\t})\n\t.strict()\n\t.superRefine((data, ctx) => {\n\t\tif (!isValidCalendarDate(data.start)) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tmessage: \"start must be a valid calendar date\",\n\t\t\t\tpath: [\"start\"],\n\t\t\t});\n\t\t}\n\t\tif (!isValidCalendarDate(data.end)) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tmessage: \"end must be a valid calendar date\",\n\t\t\t\tpath: [\"end\"],\n\t\t\t});\n\t\t}\n\t\tif (\n\t\t\tisValidCalendarDate(data.start) &&\n\t\t\tisValidCalendarDate(data.end) &&\n\t\t\tdata.start > data.end\n\t\t) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tmessage: \"start must be on or before end\",\n\t\t\t\tpath: [\"start\"],\n\t\t\t});\n\t\t}\n\t});\n",
17
- "import * as z from \"zod/v4\";\nimport {\n\tPROSPECTIVE_BUDGET_FUNDING_CONSENT_COPY as prospectiveFundingConsentCopy,\n\tPROSPECTIVE_BUDGET_FUNDING_CONSENT_COPY_HASH as prospectiveFundingConsentCopyHash,\n\tPROSPECTIVE_BUDGET_FUNDING_CONSENT_VERSION as prospectiveFundingConsentVersion,\n} from \"../consent\";\nimport { createPhaseOnboardingToolDefinitions } from \"./onboarding-tool-definitions\";\nimport { OPENAI_TOOL_DEFINITIONS } from \"./openai-tools\";\nimport {\n\tAnyOutputEnvelopeSchema,\n\tGetCampaignReadinessOutputEnvelopeSchema,\n\tListAvailableCountriesOutputEnvelopeSchema,\n} from \"./output-schemas\";\nimport {\n\tClientRequestIdSchema,\n\tIsoCalendarDateSchema,\n\tDateRangeSchema as SharedDateRangeSchema,\n\tToolFormatSchema as SharedToolFormatSchema,\n\tUserIntentSummarySchema,\n} from \"./shared-schemas\";\n\nexport const DateRangeSchema = SharedDateRangeSchema;\nexport const ToolFormatSchema = SharedToolFormatSchema;\n\nconst OnboardingAttemptIdSchema = z.string().trim().min(1).max(120).optional();\nconst ExpectedCampaignStatusEnum = z.enum([\n\t\"AWAITING_SMART_LINK\",\n\t\"ACTIVE\",\n\t\"ARCHIVED\",\n\t\"CONTENT_VALIDATION\",\n\t\"DEPLOYING\",\n\t\"ENDED\",\n\t\"FAILED\",\n\t\"PAUSED\",\n\t\"READY_FOR_REVIEW\",\n\t\"SUBSCRIPTION_PAUSED\",\n]);\nconst ExpectedCampaignStatusSchema = ExpectedCampaignStatusEnum.optional();\nconst CampaignStatusFilterSchema = ExpectedCampaignStatusEnum.exclude([\n\t\"ENDED\",\n]).optional();\n\nexport const DynamoiListArtistsInputSchema = z\n\t.object({\n\t\tartistId: z.string().uuid().optional(),\n\t\tcursor: z.string().optional(),\n\t\tformat: ToolFormatSchema.optional(),\n\t\tlimit: z.number().int().min(1).max(50).optional(),\n\t})\n\t.strict();\n\nexport const DynamoiSearchInputSchema = z\n\t.object({\n\t\tartistId: z.string().uuid().optional(),\n\t\tcursor: z.string().optional(),\n\t\tformat: ToolFormatSchema.optional(),\n\t\tincludeArchived: z.boolean().optional(),\n\t\tlimit: z.number().int().min(1).max(50).optional(),\n\t\tquery: z.string().trim().max(120).optional(),\n\t\ttype: z.enum([\"artist\", \"campaign\", \"smartlink\"]).optional(),\n\t})\n\t.strict()\n\t.superRefine((data, ctx) => {\n\t\tif (!(data.type || data.query)) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tmessage: \"query is required when type is not specified\",\n\t\t\t\tpath: [\"query\"],\n\t\t\t});\n\t\t}\n\t});\n\nconst DynamoiGetCurrentUserIntentSchema = z.enum([\n\t\"account_overview\",\n\t\"artist_access_check\",\n\t\"organization_access_check\",\n\t\"platform_connection_check\",\n]);\n\nexport const DynamoiGetCurrentUserInputSchema = z\n\t.object({\n\t\tformat: ToolFormatSchema.optional(),\n\t\tintent: DynamoiGetCurrentUserIntentSchema,\n\t})\n\t.strict();\n\nexport const DynamoiGetArtistInputSchema = z\n\t.object({\n\t\tartistId: z.string().uuid(),\n\t\tformat: ToolFormatSchema.optional(),\n\t})\n\t.strict();\n\nexport const DynamoiListCampaignsInputSchema = z\n\t.object({\n\t\tartistId: z.string().uuid(),\n\t\tcampaignType: z.enum([\"SMART_CAMPAIGN\", \"YOUTUBE\"]).optional(),\n\t\tcursor: z.string().optional(),\n\t\tformat: ToolFormatSchema.optional(),\n\t\tlimit: z.number().int().min(1).max(50).optional(),\n\t\tstatus: CampaignStatusFilterSchema,\n\t})\n\t.strict();\n\nexport const DynamoiGetCampaignInputSchema = z\n\t.object({\n\t\tanalyticsDateRange: DateRangeSchema.optional(),\n\t\tanalyticsGranularity: z.enum([\"TOTAL\", \"DAILY\"]).optional(),\n\t\tcampaignId: z.string().uuid(),\n\t\tformat: ToolFormatSchema.optional(),\n\t\tincludeAnalytics: z.boolean().optional(),\n\t\tincludeCountries: z.boolean().optional(),\n\t\tincludeDeploymentStatus: z.boolean().optional(),\n\t})\n\t.strict();\n\nexport const DynamoiGetCampaignAnalyticsInputSchema = z\n\t.object({\n\t\tcampaignId: z.string().uuid(),\n\t\tdateRange: DateRangeSchema.optional(),\n\t\tformat: ToolFormatSchema.optional(),\n\t\tgranularity: z.enum([\"TOTAL\", \"DAILY\"]).optional(),\n\t})\n\t.strict();\n\nexport const DynamoiGetArtistAnalyticsInputSchema = z\n\t.object({\n\t\tartistId: z.string().uuid(),\n\t\tdateRange: DateRangeSchema.optional(),\n\t\tformat: ToolFormatSchema.optional(),\n\t\tgranularity: z.enum([\"TOTAL\", \"DAILY\"]).optional(),\n\t})\n\t.strict();\n\nexport const DynamoiGetBillingInputSchema = z\n\t.object({\n\t\tartistId: z.string().uuid(),\n\t\tformat: ToolFormatSchema.optional(),\n\t\tonboardingAttemptId: OnboardingAttemptIdSchema,\n\t})\n\t.strict();\n\nconst LocationTargetSchema = z\n\t.object({\n\t\tcode: z.string().trim().min(1).max(8),\n\t\tname: z.string().trim().min(1).max(120),\n\t})\n\t.strict();\n\nexport const DynamoiGetPlatformStatusInputSchema = z\n\t.object({\n\t\tartistId: z.string().uuid(),\n\t\tformat: ToolFormatSchema.optional(),\n\t\tonboardingAttemptId: OnboardingAttemptIdSchema,\n\t\tonboardingFlow: z.enum([\"meta\", \"youtube\"]).optional(),\n\t})\n\t.strict();\n\nexport const DynamoiStartYoutubeChannelLinkInputSchema = z\n\t.object({\n\t\tartistId: z.string().uuid(),\n\t\tformat: ToolFormatSchema.optional(),\n\t\tpurpose: z.enum([\"advertising\", \"distribution_identity\"]).optional(),\n\t\tuserIntentSummary: UserIntentSummarySchema,\n\t})\n\t.strict();\n\nexport const DynamoiStartMetaConnectionInputSchema = z\n\t.object({\n\t\tartistId: z.string().uuid(),\n\t\tformat: ToolFormatSchema.optional(),\n\t\tpurpose: z.enum([\"advertising\", \"distribution_identity\"]).optional(),\n\t\tuserIntentSummary: UserIntentSummarySchema,\n\t})\n\t.strict();\n\nexport const DynamoiListAvailableCountriesInputSchema = z\n\t.object({\n\t\tcampaignType: z.enum([\"SMART_CAMPAIGN\", \"YOUTUBE\"]),\n\t\tcursor: z.string().optional(),\n\t\tformat: ToolFormatSchema.optional(),\n\t\tlimit: z.number().int().min(1).max(100).optional(),\n\t\tquery: z.string().trim().max(120).optional(),\n\t})\n\t.strict();\n\nexport const DynamoiGetOnboardingStatusInputSchema = z\n\t.object({\n\t\tartistId: z.string().uuid(),\n\t\tformat: ToolFormatSchema.optional(),\n\t})\n\t.strict();\n\nexport const DynamoiGetCampaignReadinessInputSchema = z\n\t.object({\n\t\tartistId: z.string().uuid(),\n\t\tbudgetAmount: z.number().finite().positive().optional(),\n\t\tbudgetType: z.enum([\"DAILY\", \"TOTAL\"]).optional(),\n\t\tcampaignType: z.enum([\"SMART_CAMPAIGN\", \"YOUTUBE\"]),\n\t\tcontentType: z.enum([\"TRACK\", \"ALBUM\", \"PLAYLIST\", \"VIDEO\"]).optional(),\n\t\tendDate: IsoCalendarDateSchema.optional(),\n\t\tformat: ToolFormatSchema.optional(),\n\t\tlocationTargets: z.array(LocationTargetSchema).optional(),\n\t\tmediaAssetIds: z.array(z.string().uuid()).optional(),\n\t\tspotifyUrl: z.string().trim().min(1).max(500).optional(),\n\t\tyoutubeVideoId: z.string().trim().min(1).max(128).optional(),\n\t})\n\t.strict();\n\nexport const DynamoiGetCampaignDeploymentStatusInputSchema = z\n\t.object({\n\t\tcampaignId: z.string().uuid(),\n\t\tformat: ToolFormatSchema.optional(),\n\t})\n\t.strict();\n\nexport const DynamoiPauseCampaignInputSchema = z\n\t.object({\n\t\tcampaignId: z.string().uuid(),\n\t\tclientRequestId: ClientRequestIdSchema,\n\t\texpectedCurrentStatus: ExpectedCampaignStatusSchema,\n\t\tuserIntentSummary: UserIntentSummarySchema,\n\t})\n\t.strict();\n\nexport const DynamoiResumeCampaignInputSchema = z\n\t.object({\n\t\tcampaignId: z.string().uuid(),\n\t\tclientRequestId: ClientRequestIdSchema,\n\t\texpectedCurrentStatus: ExpectedCampaignStatusSchema,\n\t\tuserIntentSummary: UserIntentSummarySchema,\n\t})\n\t.strict();\n\nexport const DynamoiUpdateBudgetInputSchema = z\n\t.object({\n\t\tacceptedConsentCopyHash: z\n\t\t\t.literal(prospectiveFundingConsentCopyHash)\n\t\t\t.optional(),\n\t\tacceptedConsentVersion: z\n\t\t\t.literal(prospectiveFundingConsentVersion)\n\t\t\t.optional(),\n\t\tauthorizeAutomaticDailyFunding: z\n\t\t\t.literal(true)\n\t\t\t.describe(\n\t\t\t\t`Set only after the client explicitly accepts: “${prospectiveFundingConsentCopy}”`,\n\t\t\t)\n\t\t\t.optional(),\n\t\tbudgetAmount: z.number().finite().positive(),\n\t\tcampaignId: z.string().uuid(),\n\t\tclientRequestId: ClientRequestIdSchema,\n\t\tendDate: IsoCalendarDateSchema.optional(),\n\t\texpectedCurrentBudgetAmount: z.number().finite().positive().optional(),\n\t\texpectedCurrentEndDate: IsoCalendarDateSchema.optional(),\n\t\tuserIntentSummary: UserIntentSummarySchema,\n\t})\n\t.strict()\n\t.superRefine((data, ctx) => {\n\t\tif (\n\t\t\tdata.authorizeAutomaticDailyFunding &&\n\t\t\t!(\n\t\t\t\tdata.acceptedConsentCopyHash &&\n\t\t\t\tdata.acceptedConsentVersion &&\n\t\t\t\tdata.clientRequestId\n\t\t\t)\n\t\t) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tmessage:\n\t\t\t\t\t\"acceptedConsentCopyHash, acceptedConsentVersion, and clientRequestId are required with automatic daily funding authorization\",\n\t\t\t\tpath: [\"authorizeAutomaticDailyFunding\"],\n\t\t\t});\n\t\t}\n\t});\n\nexport const DynamoiUpdateCampaignInputSchema = z\n\t.object({\n\t\taction: z.enum([\"pause\", \"resume\", \"update_budget\"]),\n\t\tacceptedConsentCopyHash: z\n\t\t\t.literal(prospectiveFundingConsentCopyHash)\n\t\t\t.optional(),\n\t\tacceptedConsentVersion: z\n\t\t\t.literal(prospectiveFundingConsentVersion)\n\t\t\t.optional(),\n\t\tauthorizeAutomaticDailyFunding: z\n\t\t\t.literal(true)\n\t\t\t.describe(\n\t\t\t\t`Set only after the client explicitly accepts: “${prospectiveFundingConsentCopy}”`,\n\t\t\t)\n\t\t\t.optional(),\n\t\tbudgetAmount: z.number().finite().positive().optional(),\n\t\tcampaignId: z.string().uuid(),\n\t\tclientRequestId: ClientRequestIdSchema,\n\t\tendDate: IsoCalendarDateSchema.optional(),\n\t\texpectedCurrentBudgetAmount: z.number().finite().positive().optional(),\n\t\texpectedCurrentEndDate: IsoCalendarDateSchema.optional(),\n\t\texpectedCurrentStatus: ExpectedCampaignStatusSchema,\n\t\tuserIntentSummary: UserIntentSummarySchema,\n\t})\n\t.strict()\n\t.superRefine((data, ctx) => {\n\t\tif (data.action === \"update_budget\" && data.budgetAmount === undefined) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tmessage: \"budgetAmount is required when action is update_budget\",\n\t\t\t\tpath: [\"budgetAmount\"],\n\t\t\t});\n\t\t}\n\t\tif (data.action !== \"update_budget\") {\n\t\t\tfor (const field of [\n\t\t\t\t\"acceptedConsentCopyHash\",\n\t\t\t\t\"acceptedConsentVersion\",\n\t\t\t\t\"budgetAmount\",\n\t\t\t\t\"authorizeAutomaticDailyFunding\",\n\t\t\t\t\"endDate\",\n\t\t\t\t\"expectedCurrentBudgetAmount\",\n\t\t\t\t\"expectedCurrentEndDate\",\n\t\t\t] as const) {\n\t\t\t\tif (data[field] !== undefined) {\n\t\t\t\t\tctx.addIssue({\n\t\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\t\tmessage: `${field} is only valid when action is update_budget`,\n\t\t\t\t\t\tpath: [field],\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (\n\t\t\tdata.authorizeAutomaticDailyFunding &&\n\t\t\t!(\n\t\t\t\tdata.acceptedConsentCopyHash &&\n\t\t\t\tdata.acceptedConsentVersion &&\n\t\t\t\tdata.clientRequestId\n\t\t\t)\n\t\t) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tmessage:\n\t\t\t\t\t\"acceptedConsentCopyHash, acceptedConsentVersion, and clientRequestId are required with automatic daily funding authorization\",\n\t\t\t\tpath: [\"authorizeAutomaticDailyFunding\"],\n\t\t\t});\n\t\t}\n\t});\n\nexport const DynamoiListMediaAssetsInputSchema = z\n\t.object({\n\t\tartistId: z.string().uuid(),\n\t\tcursor: z.string().optional(),\n\t\tformat: ToolFormatSchema.optional(),\n\t\tincludeUrls: z.boolean().optional(),\n\t\tlimit: z.number().int().min(1).max(50).optional(),\n\t})\n\t.strict();\n\nexport const DynamoiLaunchCampaignInputSchema = z\n\t.object({\n\t\t// Creative\n\t\tadCopy: z.string().trim().max(500).optional(),\n\t\tappleMusicUrl: z.string().trim().min(1).max(500).optional(),\n\t\tartistId: z.string().uuid(),\n\n\t\t// Budget\n\t\tbudgetAmount: z.number().finite().positive(),\n\t\tbudgetSplits: z.record(\n\t\t\tz.enum([\"META\", \"GOOGLE\"]),\n\t\t\tz.number().int().min(0).max(100),\n\t\t),\n\t\tbudgetType: z.enum([\"DAILY\", \"TOTAL\"]),\n\n\t\tcampaignType: z.enum([\"SMART_CAMPAIGN\", \"YOUTUBE\"]),\n\t\t// Idempotency (client-generated UUID)\n\t\tclientRequestId: z.string().uuid(),\n\n\t\t// Content\n\t\tcontentTitle: z.string().trim().min(1).max(160),\n\t\tcontentType: z.enum([\"TRACK\", \"ALBUM\", \"PLAYLIST\", \"VIDEO\"]),\n\t\tendDate: IsoCalendarDateSchema.optional(),\n\n\t\t// Targeting\n\t\tlocationTargets: z.array(LocationTargetSchema).optional(),\n\n\t\t// Smart Campaign creative selection (existing assets only in Phase 3)\n\t\tmediaAssetIds: z.array(z.string().uuid()).optional(),\n\t\tspotifyUrl: z.string().trim().min(1).max(500).optional(),\n\t\tuseAiGeneratedCopy: z.boolean().optional(),\n\t\tuserIntentSummary: UserIntentSummarySchema,\n\t\tyoutubeVideoId: z.string().trim().min(1).max(128).optional(),\n\t})\n\t.strict()\n\t.superRefine((data, ctx) => {\n\t\tconst sum = Object.values(data.budgetSplits ?? {}).reduce(\n\t\t\t(acc, v) => acc + (Number.isFinite(v) ? v : 0),\n\t\t\t0,\n\t\t);\n\t\tif (!(sum > 0)) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tmessage: \"budgetSplits must allocate at least one platform\",\n\t\t\t\tpath: [\"budgetSplits\"],\n\t\t\t});\n\t\t}\n\n\t\t// Require splits to sum to ~100 for predictable intent.\n\t\tif (sum > 0 && Math.abs(sum - 100) > 0.01) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tmessage: \"budgetSplits must sum to 100\",\n\t\t\t\tpath: [\"budgetSplits\"],\n\t\t\t});\n\t\t}\n\n\t\tif (data.campaignType === \"SMART_CAMPAIGN\") {\n\t\t\tif (!data.mediaAssetIds || data.mediaAssetIds.length === 0) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tmessage: \"mediaAssetIds is required for SMART_CAMPAIGN\",\n\t\t\t\t\tpath: [\"mediaAssetIds\"],\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (!(\"META\" in data.budgetSplits) || data.budgetSplits.META <= 0) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tmessage: \"SMART_CAMPAIGN requires a META budget split > 0\",\n\t\t\t\t\tpath: [\"budgetSplits\", \"META\"],\n\t\t\t\t});\n\t\t\t}\n\t\t\t// Smart Campaigns are Meta-only today. Keep the public contract accurate.\n\t\t\tif (data.budgetSplits.GOOGLE && data.budgetSplits.GOOGLE > 0) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tmessage: \"SMART_CAMPAIGN does not support GOOGLE budget splits\",\n\t\t\t\t\tpath: [\"budgetSplits\", \"GOOGLE\"],\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tif (data.campaignType === \"YOUTUBE\") {\n\t\t\tif (!data.youtubeVideoId) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tmessage: \"youtubeVideoId is required for YOUTUBE\",\n\t\t\t\t\tpath: [\"youtubeVideoId\"],\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (data.contentType !== \"VIDEO\") {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tmessage: \"contentType must be VIDEO for YOUTUBE\",\n\t\t\t\t\tpath: [\"contentType\"],\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (!(\"GOOGLE\" in data.budgetSplits) || data.budgetSplits.GOOGLE <= 0) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tmessage: \"YOUTUBE requires a GOOGLE budget split > 0\",\n\t\t\t\t\tpath: [\"budgetSplits\", \"GOOGLE\"],\n\t\t\t\t});\n\t\t\t}\n\t\t\t// YouTube campaigns are Google-only today.\n\t\t\tif (data.budgetSplits.META && data.budgetSplits.META > 0) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tmessage: \"YOUTUBE does not support META budget splits\",\n\t\t\t\t\tpath: [\"budgetSplits\", \"META\"],\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t});\n\nexport const PHASE_1_TOOL_DEFINITIONS = [\n\t{\n\t\tdescription:\n\t\t\t\"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 confirm a specific Meta or YouTube onboarding attempt because this account-level state can span multiple artists; use dynamoi_get_platform_status for the target artist instead. 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.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_get_account_overview\",\n\t\topenWorldHint: false,\n\t\toutputSchema: AnyOutputEnvelopeSchema,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiGetCurrentUserInputSchema,\n\t\ttitle: \"Get Account Overview\",\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"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. Pass artistId when you need the full profile/readiness details for one artist instead of a roster page. 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. If the result is empty, the user is brand-new — do not stop with 'no records found'; route through dynamoi_get_account_overview.recommendedNextActions.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_list_artists\",\n\t\topenWorldHint: false,\n\t\toutputSchema: AnyOutputEnvelopeSchema,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiListArtistsInputSchema,\n\t\ttitle: \"List Artists\",\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"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. If the result is empty for a brand-new user (no artists yet), do not respond 'no records found' as a terminal answer — instead suggest creating their first artist hub via dynamoi_create_smart_links_from_spotify_artist.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_search\",\n\t\topenWorldHint: false,\n\t\toutputSchema: AnyOutputEnvelopeSchema,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiSearchInputSchema,\n\t\ttitle: \"Search Dynamoi\",\n\t},\n\t...OPENAI_TOOL_DEFINITIONS,\n\t{\n\t\tdescription:\n\t\t\t\"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. If the user has no artists yet, do not call this — route via dynamoi_get_account_overview first.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_list_campaigns\",\n\t\topenWorldHint: false,\n\t\toutputSchema: AnyOutputEnvelopeSchema,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiListCampaignsInputSchema,\n\t\ttitle: \"List Campaigns\",\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"Use this when the user wants full details for one campaign, including budget, targeting, platform status, and next actions. Set includeAnalytics=true for one-campaign performance, includeDeploymentStatus=true for delivery/deployment blockers, and includeCountries=true only when the full country list is needed. Do not use this for a campaign list; use dynamoi_list_campaigns instead. After a successful launch or campaign mutation, prefer format=summary when you need a follow-up read to relay the final answer.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_get_campaign\",\n\t\topenWorldHint: false,\n\t\toutputSchema: AnyOutputEnvelopeSchema,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiGetCampaignInputSchema,\n\t\ttitle: \"Get Campaign\",\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"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. For one campaign's metrics, use dynamoi_get_campaign with includeAnalytics=true.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_get_artist_analytics\",\n\t\topenWorldHint: false,\n\t\toutputSchema: AnyOutputEnvelopeSchema,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiGetArtistAnalyticsInputSchema,\n\t\ttitle: \"Get Artist Analytics\",\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"Use this when the user asks about billing state, credit balance, promo limits, subscription status, or whether billing blocks launches for one artist. This is a read-only status check; it does not create checkout links or collect payment. If billing blocks a launch, direct the user to start or restore managed advertising in the Dynamoi dashboard, then call this tool again to confirm the status. Do not use this for campaign analytics or platform connection troubleshooting.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_get_billing\",\n\t\topenWorldHint: false,\n\t\toutputSchema: AnyOutputEnvelopeSchema,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiGetBillingInputSchema,\n\t\ttitle: \"Get Billing\",\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"Use this when the user wants to know whether Spotify, Meta, or YouTube are connected and what setup steps still block launches. When polling after a connection-start flow, pass the returned onboardingAttemptId and onboardingFlow so Dynamoi ops can correlate the browser step. Do not use this for detailed billing questions. Never use this to personalize generic Instagram or marketing-advice questions.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_get_platform_status\",\n\t\topenWorldHint: false,\n\t\toutputSchema: AnyOutputEnvelopeSchema,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiGetPlatformStatusInputSchema,\n\t\ttitle: \"Get Platform Status\",\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"Use this when the user asks which countries they can target for a Smart Campaign or YouTube campaign. Always pass campaignType because Smart Campaign and YouTube country catalogs are different. Do not use this for generic country marketing advice.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_list_available_countries\",\n\t\topenWorldHint: false,\n\t\toutputSchema: ListAvailableCountriesOutputEnvelopeSchema,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiListAvailableCountriesInputSchema,\n\t\ttitle: \"List Available Countries\",\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"Use this when the user is planning a campaign and wants to know if the proposed inputs are ready before dynamoi_launch_campaign. This validates readiness and targeting without creating a campaign. Do not use this to create or mutate campaigns.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_get_campaign_readiness\",\n\t\topenWorldHint: false,\n\t\toutputSchema: GetCampaignReadinessOutputEnvelopeSchema,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiGetCampaignReadinessInputSchema,\n\t\ttitle: \"Get Campaign Readiness\",\n\t},\n] as const;\n\nexport const PHASE_ONBOARDING_TOOL_DEFINITIONS =\n\tcreatePhaseOnboardingToolDefinitions({\n\t\tmetaConnection: DynamoiStartMetaConnectionInputSchema,\n\t\tyoutubeChannelLink: DynamoiStartYoutubeChannelLinkInputSchema,\n\t});\n\nexport const PHASE_2_TOOL_DEFINITIONS = [\n\t{\n\t\tdescription:\n\t\t\t\"Use this when the user explicitly wants to pause, resume, or update the budget/end date for an existing campaign. Set action to pause, resume, or update_budget. Do not use this for inspection-only questions; this changes live campaign workflow state or external campaign settings.\",\n\t\tdestructiveHint: true,\n\t\tidempotentHint: true,\n\t\tname: \"dynamoi_update_campaign\",\n\t\topenWorldHint: true,\n\t\toutputSchema: AnyOutputEnvelopeSchema,\n\t\treadOnlyHint: false,\n\t\tschema: DynamoiUpdateCampaignInputSchema,\n\t\ttitle: \"Update Campaign\",\n\t},\n] as const;\n",
18
+ "import * as z from \"zod/v4\";\nimport {\n\tPROSPECTIVE_BUDGET_FUNDING_CONSENT_COPY as prospectiveFundingConsentCopy,\n\tPROSPECTIVE_BUDGET_FUNDING_CONSENT_COPY_HASH as prospectiveFundingConsentCopyHash,\n\tPROSPECTIVE_BUDGET_FUNDING_CONSENT_VERSION as prospectiveFundingConsentVersion,\n} from \"../consent\";\nimport { createPhaseOnboardingToolDefinitions } from \"./onboarding-tool-definitions\";\nimport { OPENAI_TOOL_DEFINITIONS } from \"./openai-tools\";\nimport {\n\tAnyOutputEnvelopeSchema,\n\tGetCampaignReadinessOutputEnvelopeSchema,\n\tListAvailableCountriesOutputEnvelopeSchema,\n} from \"./output-schemas\";\nimport {\n\tClientRequestIdSchema,\n\tIsoCalendarDateSchema,\n\tDateRangeSchema as SharedDateRangeSchema,\n\tToolFormatSchema as SharedToolFormatSchema,\n\tUserIntentSummarySchema,\n} from \"./shared-schemas\";\n\nexport const DateRangeSchema = SharedDateRangeSchema;\nexport const ToolFormatSchema = SharedToolFormatSchema;\n\nconst OnboardingAttemptIdSchema = z.string().trim().min(1).max(120).optional();\nconst ExpectedCampaignStatusEnum = z.enum([\n\t\"AWAITING_SMART_LINK\",\n\t\"ACTIVE\",\n\t\"ARCHIVED\",\n\t\"CONTENT_VALIDATION\",\n\t\"DEPLOYING\",\n\t\"ENDED\",\n\t\"FAILED\",\n\t\"PAUSED\",\n\t\"READY_FOR_REVIEW\",\n\t\"SUBSCRIPTION_PAUSED\",\n]);\nconst ExpectedCampaignStatusSchema = ExpectedCampaignStatusEnum.optional();\nconst CampaignStatusFilterSchema = ExpectedCampaignStatusEnum.exclude([\n\t\"ENDED\",\n]).optional();\n\nexport const DynamoiListArtistsInputSchema = z\n\t.object({\n\t\tartistId: z.string().uuid().optional(),\n\t\tcursor: z.string().optional(),\n\t\tformat: ToolFormatSchema.optional(),\n\t\tlimit: z.number().int().min(1).max(50).optional(),\n\t})\n\t.strict();\n\nexport const DynamoiSearchInputSchema = z\n\t.object({\n\t\tartistId: z.string().uuid().optional(),\n\t\tcursor: z.string().optional(),\n\t\tformat: ToolFormatSchema.optional(),\n\t\tincludeArchived: z.boolean().optional(),\n\t\tlimit: z.number().int().min(1).max(50).optional(),\n\t\tquery: z.string().trim().max(120).optional(),\n\t\ttype: z.enum([\"artist\", \"campaign\", \"smartlink\"]).optional(),\n\t})\n\t.strict()\n\t.superRefine((data, ctx) => {\n\t\tif (!(data.type || data.query)) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tmessage: \"query is required when type is not specified\",\n\t\t\t\tpath: [\"query\"],\n\t\t\t});\n\t\t}\n\t});\n\nconst DynamoiGetCurrentUserIntentSchema = z.enum([\n\t\"account_overview\",\n\t\"artist_access_check\",\n\t\"organization_access_check\",\n\t\"platform_connection_check\",\n]);\n\nexport const DynamoiGetCurrentUserInputSchema = z\n\t.object({\n\t\tformat: ToolFormatSchema.optional(),\n\t\tintent: DynamoiGetCurrentUserIntentSchema.default(\"account_overview\"),\n\t})\n\t.strict();\n\nexport const DynamoiGetArtistInputSchema = z\n\t.object({\n\t\tartistId: z.string().uuid(),\n\t\tformat: ToolFormatSchema.optional(),\n\t})\n\t.strict();\n\nexport const DynamoiListCampaignsInputSchema = z\n\t.object({\n\t\tartistId: z.string().uuid(),\n\t\tcampaignType: z.enum([\"SMART_CAMPAIGN\", \"YOUTUBE\"]).optional(),\n\t\tcursor: z.string().optional(),\n\t\tformat: ToolFormatSchema.optional(),\n\t\tlimit: z.number().int().min(1).max(50).optional(),\n\t\tstatus: CampaignStatusFilterSchema,\n\t})\n\t.strict();\n\nexport const DynamoiGetCampaignInputSchema = z\n\t.object({\n\t\tanalyticsDateRange: DateRangeSchema.optional(),\n\t\tanalyticsGranularity: z.enum([\"TOTAL\", \"DAILY\"]).optional(),\n\t\tcampaignId: z.string().uuid(),\n\t\tformat: ToolFormatSchema.optional(),\n\t\tincludeAnalytics: z.boolean().optional(),\n\t\tincludeCountries: z.boolean().optional(),\n\t\tincludeDeploymentStatus: z.boolean().optional(),\n\t})\n\t.strict();\n\nexport const DynamoiGetCampaignAnalyticsInputSchema = z\n\t.object({\n\t\tcampaignId: z.string().uuid(),\n\t\tdateRange: DateRangeSchema.optional(),\n\t\tformat: ToolFormatSchema.optional(),\n\t\tgranularity: z.enum([\"TOTAL\", \"DAILY\"]).optional(),\n\t})\n\t.strict();\n\nexport const DynamoiGetArtistAnalyticsInputSchema = z\n\t.object({\n\t\tartistId: z.string().uuid(),\n\t\tdateRange: DateRangeSchema.optional(),\n\t\tformat: ToolFormatSchema.optional(),\n\t\tgranularity: z.enum([\"TOTAL\", \"DAILY\"]).optional(),\n\t})\n\t.strict();\n\nexport const DynamoiGetBillingInputSchema = z\n\t.object({\n\t\tartistId: z.string().uuid(),\n\t\tformat: ToolFormatSchema.optional(),\n\t\tonboardingAttemptId: OnboardingAttemptIdSchema,\n\t})\n\t.strict();\n\nconst LocationTargetSchema = z\n\t.object({\n\t\tcode: z.string().trim().min(1).max(8),\n\t\tname: z.string().trim().min(1).max(120),\n\t})\n\t.strict();\n\nexport const DynamoiGetPlatformStatusInputSchema = z\n\t.object({\n\t\tartistId: z.string().uuid(),\n\t\tformat: ToolFormatSchema.optional(),\n\t\tonboardingAttemptId: OnboardingAttemptIdSchema,\n\t\tonboardingFlow: z.enum([\"meta\", \"youtube\"]).optional(),\n\t})\n\t.strict();\n\nexport const DynamoiStartYoutubeChannelLinkInputSchema = z\n\t.object({\n\t\tartistId: z.string().uuid(),\n\t\tformat: ToolFormatSchema.optional(),\n\t\tpurpose: z.enum([\"advertising\", \"distribution_identity\"]).optional(),\n\t\tuserIntentSummary: UserIntentSummarySchema,\n\t})\n\t.strict();\n\nexport const DynamoiStartMetaConnectionInputSchema = z\n\t.object({\n\t\tartistId: z.string().uuid(),\n\t\tformat: ToolFormatSchema.optional(),\n\t\tpurpose: z.enum([\"advertising\", \"distribution_identity\"]).optional(),\n\t\tuserIntentSummary: UserIntentSummarySchema,\n\t})\n\t.strict();\n\nexport const DynamoiListAvailableCountriesInputSchema = z\n\t.object({\n\t\tcampaignType: z.enum([\"SMART_CAMPAIGN\", \"YOUTUBE\"]),\n\t\tcursor: z.string().optional(),\n\t\tformat: ToolFormatSchema.optional(),\n\t\tlimit: z.number().int().min(1).max(100).optional(),\n\t\tquery: z.string().trim().max(120).optional(),\n\t})\n\t.strict();\n\nexport const DynamoiGetOnboardingStatusInputSchema = z\n\t.object({\n\t\tartistId: z.string().uuid(),\n\t\tformat: ToolFormatSchema.optional(),\n\t})\n\t.strict();\n\nexport const DynamoiGetCampaignReadinessInputSchema = z\n\t.object({\n\t\tartistId: z.string().uuid(),\n\t\tbudgetAmount: z.number().finite().positive().optional(),\n\t\tbudgetType: z.enum([\"DAILY\", \"TOTAL\"]).optional(),\n\t\tcampaignType: z.enum([\"SMART_CAMPAIGN\", \"YOUTUBE\"]),\n\t\tcontentType: z.enum([\"TRACK\", \"ALBUM\", \"PLAYLIST\", \"VIDEO\"]).optional(),\n\t\tendDate: IsoCalendarDateSchema.optional(),\n\t\tformat: ToolFormatSchema.optional(),\n\t\tlocationTargets: z.array(LocationTargetSchema).optional(),\n\t\tmediaAssetIds: z.array(z.string().uuid()).optional(),\n\t\tspotifyUrl: z.string().trim().min(1).max(500).optional(),\n\t\tyoutubeVideoId: z.string().trim().min(1).max(128).optional(),\n\t})\n\t.strict();\n\nexport const DynamoiGetCampaignDeploymentStatusInputSchema = z\n\t.object({\n\t\tcampaignId: z.string().uuid(),\n\t\tformat: ToolFormatSchema.optional(),\n\t})\n\t.strict();\n\nexport const DynamoiPauseCampaignInputSchema = z\n\t.object({\n\t\tcampaignId: z.string().uuid(),\n\t\tclientRequestId: ClientRequestIdSchema,\n\t\texpectedCurrentStatus: ExpectedCampaignStatusSchema,\n\t\tuserIntentSummary: UserIntentSummarySchema,\n\t})\n\t.strict();\n\nexport const DynamoiResumeCampaignInputSchema = z\n\t.object({\n\t\tacceptedConsentCopyHash: z\n\t\t\t.literal(prospectiveFundingConsentCopyHash)\n\t\t\t.optional(),\n\t\tacceptedConsentVersion: z\n\t\t\t.literal(prospectiveFundingConsentVersion)\n\t\t\t.optional(),\n\t\tauthorizeAutomaticDailyFunding: z.literal(true).optional(),\n\t\tcampaignId: z.string().uuid(),\n\t\tclientRequestId: ClientRequestIdSchema,\n\t\texpectedCurrentStatus: ExpectedCampaignStatusSchema,\n\t\tuserIntentSummary: UserIntentSummarySchema,\n\t})\n\t.strict()\n\t.superRefine((data, ctx) => {\n\t\tif (\n\t\t\tdata.authorizeAutomaticDailyFunding &&\n\t\t\t!(\n\t\t\t\tdata.acceptedConsentCopyHash &&\n\t\t\t\tdata.acceptedConsentVersion &&\n\t\t\t\tdata.clientRequestId\n\t\t\t)\n\t\t) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tmessage:\n\t\t\t\t\t\"acceptedConsentCopyHash, acceptedConsentVersion, and clientRequestId are required with automatic daily funding authorization\",\n\t\t\t\tpath: [\"authorizeAutomaticDailyFunding\"],\n\t\t\t});\n\t\t}\n\t});\n\nexport const DynamoiUpdateBudgetInputSchema = z\n\t.object({\n\t\tacceptedConsentCopyHash: z\n\t\t\t.literal(prospectiveFundingConsentCopyHash)\n\t\t\t.optional(),\n\t\tacceptedConsentVersion: z\n\t\t\t.literal(prospectiveFundingConsentVersion)\n\t\t\t.optional(),\n\t\tauthorizeAutomaticDailyFunding: z\n\t\t\t.literal(true)\n\t\t\t.describe(\n\t\t\t\t`Set only after the client explicitly accepts: “${prospectiveFundingConsentCopy}”`,\n\t\t\t)\n\t\t\t.optional(),\n\t\tbudgetAmount: z.number().finite().positive(),\n\t\tcampaignId: z.string().uuid(),\n\t\tclientRequestId: ClientRequestIdSchema,\n\t\tendDate: IsoCalendarDateSchema.optional(),\n\t\texpectedCurrentBudgetAmount: z.number().finite().positive().optional(),\n\t\texpectedCurrentEndDate: IsoCalendarDateSchema.optional(),\n\t\tuserIntentSummary: UserIntentSummarySchema,\n\t})\n\t.strict()\n\t.superRefine((data, ctx) => {\n\t\tif (\n\t\t\tdata.authorizeAutomaticDailyFunding &&\n\t\t\t!(\n\t\t\t\tdata.acceptedConsentCopyHash &&\n\t\t\t\tdata.acceptedConsentVersion &&\n\t\t\t\tdata.clientRequestId\n\t\t\t)\n\t\t) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tmessage:\n\t\t\t\t\t\"acceptedConsentCopyHash, acceptedConsentVersion, and clientRequestId are required with automatic daily funding authorization\",\n\t\t\t\tpath: [\"authorizeAutomaticDailyFunding\"],\n\t\t\t});\n\t\t}\n\t});\n\nexport const DynamoiUpdateCampaignInputSchema = z\n\t.object({\n\t\tacceptedConsentCopyHash: z\n\t\t\t.literal(prospectiveFundingConsentCopyHash)\n\t\t\t.optional(),\n\t\tacceptedConsentVersion: z\n\t\t\t.literal(prospectiveFundingConsentVersion)\n\t\t\t.optional(),\n\t\taction: z.enum([\"pause\", \"resume\", \"update_budget\"]),\n\t\tauthorizeAutomaticDailyFunding: z\n\t\t\t.literal(true)\n\t\t\t.describe(\n\t\t\t\t`Set only after the client explicitly accepts: “${prospectiveFundingConsentCopy}”`,\n\t\t\t)\n\t\t\t.optional(),\n\t\tbudgetAmount: z.number().finite().positive().optional(),\n\t\tcampaignId: z.string().uuid(),\n\t\tclientRequestId: ClientRequestIdSchema,\n\t\tendDate: IsoCalendarDateSchema.optional(),\n\t\texpectedCurrentBudgetAmount: z.number().finite().positive().optional(),\n\t\texpectedCurrentEndDate: IsoCalendarDateSchema.optional(),\n\t\texpectedCurrentStatus: ExpectedCampaignStatusSchema,\n\t\tuserIntentSummary: UserIntentSummarySchema,\n\t})\n\t.strict()\n\t.superRefine((data, ctx) => {\n\t\tif (data.action === \"update_budget\" && data.budgetAmount === undefined) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tmessage: \"budgetAmount is required when action is update_budget\",\n\t\t\t\tpath: [\"budgetAmount\"],\n\t\t\t});\n\t\t}\n\t\tif (data.action !== \"update_budget\") {\n\t\t\tfor (const field of [\n\t\t\t\t\"budgetAmount\",\n\t\t\t\t\"endDate\",\n\t\t\t\t\"expectedCurrentBudgetAmount\",\n\t\t\t\t\"expectedCurrentEndDate\",\n\t\t\t] as const) {\n\t\t\t\tif (data[field] !== undefined) {\n\t\t\t\t\tctx.addIssue({\n\t\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\t\tmessage: `${field} is only valid when action is update_budget`,\n\t\t\t\t\t\tpath: [field],\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (data.action === \"pause\") {\n\t\t\tfor (const field of [\n\t\t\t\t\"acceptedConsentCopyHash\",\n\t\t\t\t\"acceptedConsentVersion\",\n\t\t\t\t\"authorizeAutomaticDailyFunding\",\n\t\t\t] as const) {\n\t\t\t\tif (data[field] !== undefined) {\n\t\t\t\t\tctx.addIssue({\n\t\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\t\tmessage: `${field} is only valid when action is update_budget or resume`,\n\t\t\t\t\t\tpath: [field],\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (\n\t\t\tdata.authorizeAutomaticDailyFunding &&\n\t\t\t!(\n\t\t\t\tdata.acceptedConsentCopyHash &&\n\t\t\t\tdata.acceptedConsentVersion &&\n\t\t\t\tdata.clientRequestId\n\t\t\t)\n\t\t) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tmessage:\n\t\t\t\t\t\"acceptedConsentCopyHash, acceptedConsentVersion, and clientRequestId are required with automatic daily funding authorization\",\n\t\t\t\tpath: [\"authorizeAutomaticDailyFunding\"],\n\t\t\t});\n\t\t}\n\t});\n\nexport const DynamoiListMediaAssetsInputSchema = z\n\t.object({\n\t\tartistId: z.string().uuid(),\n\t\tcursor: z.string().optional(),\n\t\tformat: ToolFormatSchema.optional(),\n\t\tincludeUrls: z.boolean().optional(),\n\t\tlimit: z.number().int().min(1).max(50).optional(),\n\t})\n\t.strict();\n\nexport const DynamoiLaunchCampaignInputSchema = z\n\t.object({\n\t\tacceptedConsentCopyHash: z\n\t\t\t.literal(prospectiveFundingConsentCopyHash)\n\t\t\t.optional(),\n\t\tacceptedConsentVersion: z\n\t\t\t.literal(prospectiveFundingConsentVersion)\n\t\t\t.optional(),\n\t\t// Creative\n\t\tadCopy: z.string().trim().max(500).optional(),\n\t\tappleMusicUrl: z.string().trim().min(1).max(500).optional(),\n\t\tartistId: z.string().uuid(),\n\t\tauthorizeAutomaticDailyFunding: z\n\t\t\t.literal(true)\n\t\t\t.describe(\n\t\t\t\t`Required for DAILY budgets. Set only after the client explicitly accepts: “${prospectiveFundingConsentCopy}”`,\n\t\t\t)\n\t\t\t.optional(),\n\n\t\t// Budget\n\t\tbudgetAmount: z.number().finite().positive(),\n\t\tbudgetSplits: z.record(\n\t\t\tz.enum([\"META\", \"GOOGLE\"]),\n\t\t\tz.number().int().min(0).max(100),\n\t\t),\n\t\tbudgetType: z.enum([\"DAILY\", \"TOTAL\"]),\n\n\t\tcampaignType: z.enum([\"SMART_CAMPAIGN\", \"YOUTUBE\"]),\n\t\t// Idempotency (client-generated UUID)\n\t\tclientRequestId: z.string().uuid(),\n\n\t\t// Content\n\t\tcontentTitle: z.string().trim().min(1).max(160),\n\t\tcontentType: z.enum([\"TRACK\", \"ALBUM\", \"PLAYLIST\", \"VIDEO\"]),\n\t\tendDate: IsoCalendarDateSchema.optional(),\n\n\t\t// Targeting\n\t\tlocationTargets: z.array(LocationTargetSchema).optional(),\n\n\t\t// Smart Campaign creative selection (existing assets only in Phase 3)\n\t\tmediaAssetIds: z.array(z.string().uuid()).optional(),\n\t\tspotifyUrl: z.string().trim().min(1).max(500).optional(),\n\t\tuseAiGeneratedCopy: z.boolean().optional(),\n\t\tuserIntentSummary: UserIntentSummarySchema,\n\t\t// YouTube content (same choices as the app's YouTube campaign setup)\n\t\tyoutubePlaylistId: z.string().trim().min(1).max(128).optional(),\n\t\tyoutubeStrategy: z\n\t\t\t.enum([\n\t\t\t\t\"CHEAPEST_VIEWS\",\n\t\t\t\t\"ORGANIC_VIEWS\",\n\t\t\t\t\"SUBSCRIBERS\",\n\t\t\t\t\"ORGANIC_VIEWS_AND_SUBSCRIBERS\",\n\t\t\t\t\"ADSENSE_ROI\",\n\t\t\t])\n\t\t\t.optional(),\n\t\tyoutubeVideoId: z.string().trim().min(1).max(128).optional(),\n\t})\n\t.strict()\n\t.superRefine((data, ctx) => {\n\t\tif (\n\t\t\tdata.budgetType === \"DAILY\" &&\n\t\t\t!(\n\t\t\t\tdata.authorizeAutomaticDailyFunding &&\n\t\t\t\tdata.acceptedConsentCopyHash &&\n\t\t\t\tdata.acceptedConsentVersion\n\t\t\t)\n\t\t) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tmessage:\n\t\t\t\t\t\"DAILY budgets require authorizeAutomaticDailyFunding with acceptedConsentCopyHash and acceptedConsentVersion\",\n\t\t\t\tpath: [\"authorizeAutomaticDailyFunding\"],\n\t\t\t});\n\t\t}\n\n\t\tconst sum = Object.values(data.budgetSplits ?? {}).reduce(\n\t\t\t(acc, v) => acc + (Number.isFinite(v) ? v : 0),\n\t\t\t0,\n\t\t);\n\t\tif (!(sum > 0)) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tmessage: \"budgetSplits must allocate at least one platform\",\n\t\t\t\tpath: [\"budgetSplits\"],\n\t\t\t});\n\t\t}\n\n\t\t// Require splits to sum to ~100 for predictable intent.\n\t\tif (sum > 0 && Math.abs(sum - 100) > 0.01) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tmessage: \"budgetSplits must sum to 100\",\n\t\t\t\tpath: [\"budgetSplits\"],\n\t\t\t});\n\t\t}\n\n\t\tif (data.campaignType === \"SMART_CAMPAIGN\") {\n\t\t\tif (!data.mediaAssetIds || data.mediaAssetIds.length === 0) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tmessage: \"mediaAssetIds is required for SMART_CAMPAIGN\",\n\t\t\t\t\tpath: [\"mediaAssetIds\"],\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (!(\"META\" in data.budgetSplits) || data.budgetSplits.META <= 0) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tmessage: \"SMART_CAMPAIGN requires a META budget split > 0\",\n\t\t\t\t\tpath: [\"budgetSplits\", \"META\"],\n\t\t\t\t});\n\t\t\t}\n\t\t\t// Smart Campaigns are Meta-only today. Keep the public contract accurate.\n\t\t\tif (data.budgetSplits.GOOGLE && data.budgetSplits.GOOGLE > 0) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tmessage: \"SMART_CAMPAIGN does not support GOOGLE budget splits\",\n\t\t\t\t\tpath: [\"budgetSplits\", \"GOOGLE\"],\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tif (data.campaignType === \"YOUTUBE\") {\n\t\t\tif (!data.youtubeVideoId) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tmessage: \"youtubeVideoId is required for YOUTUBE\",\n\t\t\t\t\tpath: [\"youtubeVideoId\"],\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (!data.youtubeStrategy) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tmessage: \"youtubeStrategy is required for YOUTUBE\",\n\t\t\t\t\tpath: [\"youtubeStrategy\"],\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (\n\t\t\t\tdata.youtubeStrategy &&\n\t\t\t\tdata.youtubeStrategy !== \"CHEAPEST_VIEWS\" &&\n\t\t\t\t!data.youtubePlaylistId\n\t\t\t) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t\"youtubePlaylistId is required for YOUTUBE unless youtubeStrategy is CHEAPEST_VIEWS\",\n\t\t\t\t\tpath: [\"youtubePlaylistId\"],\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (data.contentType !== \"VIDEO\") {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tmessage: \"contentType must be VIDEO for YOUTUBE\",\n\t\t\t\t\tpath: [\"contentType\"],\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (!(\"GOOGLE\" in data.budgetSplits) || data.budgetSplits.GOOGLE <= 0) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tmessage: \"YOUTUBE requires a GOOGLE budget split > 0\",\n\t\t\t\t\tpath: [\"budgetSplits\", \"GOOGLE\"],\n\t\t\t\t});\n\t\t\t}\n\t\t\t// YouTube campaigns are Google-only today.\n\t\t\tif (data.budgetSplits.META && data.budgetSplits.META > 0) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tmessage: \"YOUTUBE does not support META budget splits\",\n\t\t\t\t\tpath: [\"budgetSplits\", \"META\"],\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t});\n\nexport const PHASE_1_TOOL_DEFINITIONS = [\n\t{\n\t\tdescription:\n\t\t\t\"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. Pass intent to match that explicit account question; it defaults to account_overview. Do not use this to confirm a specific Meta or YouTube onboarding attempt because this account-level state can span multiple artists; use dynamoi_get_platform_status for the target artist instead. 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.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_get_account_overview\",\n\t\topenWorldHint: false,\n\t\toutputSchema: AnyOutputEnvelopeSchema,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiGetCurrentUserInputSchema,\n\t\ttitle: \"Get Account Overview\",\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"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. Pass artistId when you need the full profile/readiness details for one artist instead of a roster page. 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. If the result is empty, the user is brand-new — do not stop with 'no records found'; route through dynamoi_get_account_overview.recommendedNextActions.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_list_artists\",\n\t\topenWorldHint: false,\n\t\toutputSchema: AnyOutputEnvelopeSchema,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiListArtistsInputSchema,\n\t\ttitle: \"List Artists\",\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"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. If the result is empty for a brand-new user (no artists yet), do not respond 'no records found' as a terminal answer — instead suggest creating their first artist hub via dynamoi_create_smart_links_from_spotify_artist.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_search\",\n\t\topenWorldHint: false,\n\t\toutputSchema: AnyOutputEnvelopeSchema,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiSearchInputSchema,\n\t\ttitle: \"Search Dynamoi\",\n\t},\n\t...OPENAI_TOOL_DEFINITIONS,\n\t{\n\t\tdescription:\n\t\t\t\"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. If the user has no artists yet, do not call this — route via dynamoi_get_account_overview first.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_list_campaigns\",\n\t\topenWorldHint: false,\n\t\toutputSchema: AnyOutputEnvelopeSchema,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiListCampaignsInputSchema,\n\t\ttitle: \"List Campaigns\",\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"Use this when the user wants full details for one campaign, including budget, targeting, platform status, and next actions. Set includeAnalytics=true for one-campaign performance, includeDeploymentStatus=true for delivery/deployment blockers, and includeCountries=true only when the full country list is needed. Do not use this for a campaign list; use dynamoi_list_campaigns instead. After a successful launch or campaign mutation, prefer format=summary when you need a follow-up read to relay the final answer.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_get_campaign\",\n\t\topenWorldHint: false,\n\t\toutputSchema: AnyOutputEnvelopeSchema,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiGetCampaignInputSchema,\n\t\ttitle: \"Get Campaign\",\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"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. For one campaign's metrics, use dynamoi_get_campaign with includeAnalytics=true.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_get_artist_analytics\",\n\t\topenWorldHint: false,\n\t\toutputSchema: AnyOutputEnvelopeSchema,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiGetArtistAnalyticsInputSchema,\n\t\ttitle: \"Get Artist Analytics\",\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"Use this when the user asks about billing state, credit balance, promo limits, subscription status, or whether billing blocks launches for one artist. This is a read-only status check; it does not create checkout links or collect payment. If billing blocks a launch, starting or restoring managed advertising is not available through this MCP surface; tell the user: 'You can do this in the Dynamoi dashboard at https://dynamoi.com/dashboard.' Then call this tool again to confirm the status. Do not use this for campaign analytics or platform connection troubleshooting.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_get_billing\",\n\t\topenWorldHint: false,\n\t\toutputSchema: AnyOutputEnvelopeSchema,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiGetBillingInputSchema,\n\t\ttitle: \"Get Billing\",\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"Use this when the user wants to know whether Spotify, Meta, or YouTube are connected and what setup steps still block launches. When polling after a connection-start flow, pass the returned onboardingAttemptId and onboardingFlow so Dynamoi ops can correlate the browser step. Do not use this for detailed billing questions. Never use this to personalize generic Instagram or marketing-advice questions.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_get_platform_status\",\n\t\topenWorldHint: false,\n\t\toutputSchema: AnyOutputEnvelopeSchema,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiGetPlatformStatusInputSchema,\n\t\ttitle: \"Get Platform Status\",\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"Use this when the user asks which countries they can target for a Smart Campaign or YouTube campaign. Always pass campaignType because Smart Campaign and YouTube country catalogs are different. Do not use this for generic country marketing advice.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_list_available_countries\",\n\t\topenWorldHint: false,\n\t\toutputSchema: ListAvailableCountriesOutputEnvelopeSchema,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiListAvailableCountriesInputSchema,\n\t\ttitle: \"List Available Countries\",\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"Use this when the user is planning a campaign and wants to know if the proposed inputs are ready before dynamoi_launch_campaign. This validates readiness and targeting without creating a campaign. Do not use this to create or mutate campaigns.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_get_campaign_readiness\",\n\t\topenWorldHint: false,\n\t\toutputSchema: GetCampaignReadinessOutputEnvelopeSchema,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiGetCampaignReadinessInputSchema,\n\t\ttitle: \"Get Campaign Readiness\",\n\t},\n] as const;\n\nexport const PHASE_ONBOARDING_TOOL_DEFINITIONS =\n\tcreatePhaseOnboardingToolDefinitions({\n\t\tmetaConnection: DynamoiStartMetaConnectionInputSchema,\n\t\tyoutubeChannelLink: DynamoiStartYoutubeChannelLinkInputSchema,\n\t});\n\nexport const PHASE_2_TOOL_DEFINITIONS = [\n\t{\n\t\tdescription: `Use this when the user explicitly wants to pause, resume, or update the budget/end date for an existing campaign. Set action to pause, resume, or update_budget. Pause takes effect immediately. For resume or update_budget on a campaign that needs automatic daily card funding, first show the user this exact consent copy: \"${prospectiveFundingConsentCopy}\" — then pass authorizeAutomaticDailyFunding=true with the exact acceptedConsentVersion (\"${prospectiveFundingConsentVersion}\") and acceptedConsentCopyHash (\"${prospectiveFundingConsentCopyHash}\") plus the request's clientRequestId. Without them, a resume that needs card funding is refused with: \"Review and accept the daily funding authorization to resume this campaign.\" When retrying the same resume, reuse the same clientRequestId. Do not use this for inspection-only questions; this changes live campaign workflow state or external campaign settings.`,\n\t\tdestructiveHint: true,\n\t\tidempotentHint: true,\n\t\tname: \"dynamoi_update_campaign\",\n\t\topenWorldHint: true,\n\t\toutputSchema: AnyOutputEnvelopeSchema,\n\t\treadOnlyHint: false,\n\t\tschema: DynamoiUpdateCampaignInputSchema,\n\t\ttitle: \"Update Campaign\",\n\t},\n] as const;\n",
18
19
  "import type * as z from \"zod/v4\";\nimport { AnyOutputEnvelopeSchema } from \"./output-schemas\";\n\ntype OnboardingToolSchemas = {\n\tmetaConnection: z.ZodType;\n\tyoutubeChannelLink: z.ZodType;\n};\n\nexport function createPhaseOnboardingToolDefinitions(\n\tschemas: OnboardingToolSchemas,\n) {\n\treturn [\n\t\t{\n\t\t\tdescription:\n\t\t\t\t\"Use this when the user is ready to link a YouTube channel to one Dynamoi artist from chat. Set purpose=distribution_identity for the least-privilege identity connection required by a distribution application; that flow does not require advertising billing or Google Ads linking, and its result is checked with dynamoi_get_distribution_application. Use purpose=advertising (the default) for managed YouTube promotion, then poll dynamoi_get_platform_status until platforms.youtube.connected is true. The tool returns a Google OAuth URL bound to the signed-in user and artist.\",\n\t\t\tdestructiveHint: false,\n\t\t\tidempotentHint: true,\n\t\t\tname: \"dynamoi_start_youtube_channel_link\",\n\t\t\topenWorldHint: true,\n\t\t\toutputSchema: AnyOutputEnvelopeSchema,\n\t\t\treadOnlyHint: false,\n\t\t\tschema: schemas.youtubeChannelLink,\n\t\t\ttitle: \"Start YouTube Channel Link\",\n\t\t},\n\t\t{\n\t\t\tdescription:\n\t\t\t\t\"Use this when the user is ready to connect a Facebook Page and Instagram professional account to one Dynamoi artist. Set purpose=distribution_identity for the least-privilege identity connection required by a distribution application; that flow does not require advertising billing, and its result is checked with dynamoi_get_distribution_application. Use purpose=advertising (the default) for Spotify Smart Campaigns; advertising requires active billing and is checked with dynamoi_get_platform_status until platforms.meta.status is oauth_complete, partnership_pending, or partnership_active. Advertising returns billing_required when inactive and billing_check_unavailable for a transient verification failure. This returns a signed Meta OAuth URL and may include a Page/Instagram selection step.\",\n\t\t\tdestructiveHint: false,\n\t\t\tidempotentHint: true,\n\t\t\tname: \"dynamoi_start_meta_connection\",\n\t\t\topenWorldHint: true,\n\t\t\toutputSchema: AnyOutputEnvelopeSchema,\n\t\t\treadOnlyHint: false,\n\t\t\tschema: schemas.metaConnection,\n\t\t\ttitle: \"Start Meta Connection\",\n\t\t},\n\t] as const;\n}\n",
19
20
  "import * as z from \"zod/v4\";\nimport { AnyOutputEnvelopeSchema } from \"./output-schemas\";\n\n/**\n * OpenAI ChatGPT Connectors / Deep Research spec requires every connector\n * to expose tools literally named `search` and `fetch`. These schemas are\n * intentionally minimal to match the spec exactly.\n */\n\n/**\n * OpenAI ChatGPT Connectors / Deep Research search tool result shape.\n * The spec requires `results: [{id, title, url?, text?}]`. We prefix `id`\n * with `${type}:` so the matching `fetch` tool can route.\n */\nexport type OpenAiSearchData = {\n\tresults: Array<{\n\t\tid: string;\n\t\ttitle: string;\n\t\turl?: string;\n\t\ttext?: string;\n\t}>;\n};\n\n/**\n * OpenAI Deep Research fetch tool result shape.\n * The spec requires `id`, `title`, `text`, `url`, optional `metadata`.\n */\nexport type OpenAiFetchData = {\n\tid: string;\n\ttitle: string;\n\ttext: string;\n\turl: string;\n\tmetadata?: Record<string, unknown>;\n};\n\nexport const DynamoiOpenAiSearchInputSchema = z\n\t.object({\n\t\tquery: z.string().trim().min(1).max(500),\n\t})\n\t.strict();\n\nexport const DynamoiOpenAiFetchInputSchema = z\n\t.object({\n\t\tid: z.string().trim().min(1).max(200),\n\t})\n\t.strict();\n\nexport const OPENAI_TOOL_DEFINITIONS = [\n\t{\n\t\t// OpenAI ChatGPT Connectors / Deep Research expects a tool literally\n\t\t// named `search` returning {results: [{id, title, text?, url?}]}. This\n\t\t// is the same data dynamoi_search returns, reshaped for OpenAI Deep\n\t\t// Research citation flows. ChatGPT will not call this tool directly in\n\t\t// regular chat — it picks dynamoi_search by description.\n\t\tdescription:\n\t\t\t\"OpenAI ChatGPT Deep Research / Connectors search contract. Returns matching Dynamoi artists, campaigns, and Smart Links so they can be cited in a deep-research session. For regular ChatGPT chat use dynamoi_search instead.\",\n\t\tdestructiveHint: false,\n\t\tname: \"search\",\n\t\topenWorldHint: false,\n\t\toutputSchema: AnyOutputEnvelopeSchema,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiOpenAiSearchInputSchema,\n\t\ttitle: \"Search (OpenAI Connectors)\",\n\t},\n\t{\n\t\t// OpenAI Deep Research follow-up tool: given an id returned by `search`,\n\t\t// returns the full record so it can be cited.\n\t\tdescription:\n\t\t\t\"OpenAI ChatGPT Deep Research / Connectors fetch contract. Given an id returned by `search` (formatted as 'artist:<uuid>', 'campaign:<uuid>', or 'smartlink:<uuid>'), returns the full record for citation.\",\n\t\tdestructiveHint: false,\n\t\tname: \"fetch\",\n\t\topenWorldHint: false,\n\t\toutputSchema: AnyOutputEnvelopeSchema,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiOpenAiFetchInputSchema,\n\t\ttitle: \"Fetch (OpenAI Connectors)\",\n\t},\n] as const;\n",
20
- "import {\n\tLaunchCampaignOutputEnvelopeSchema,\n\tListMediaAssetsOutputEnvelopeSchema,\n} from \"./output-schemas\";\nimport {\n\tDynamoiLaunchCampaignInputSchema,\n\tDynamoiListMediaAssetsInputSchema,\n} from \"./tools\";\n\nexport const PHASE_3_TOOL_DEFINITIONS = [\n\t{\n\t\tdescription:\n\t\t\t\"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.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_list_media_assets\",\n\t\topenWorldHint: false,\n\t\toutputSchema: ListMediaAssetsOutputEnvelopeSchema,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiListMediaAssetsInputSchema,\n\t\ttitle: \"List Media Assets\",\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"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.\",\n\t\tdestructiveHint: true,\n\t\tidempotentHint: true,\n\t\tname: \"dynamoi_launch_campaign\",\n\t\topenWorldHint: true,\n\t\toutputSchema: LaunchCampaignOutputEnvelopeSchema,\n\t\treadOnlyHint: false,\n\t\tschema: DynamoiLaunchCampaignInputSchema,\n\t\ttitle: \"Start Campaign Launch Workflow\",\n\t},\n] as const;\n",
21
- "import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { WebStandardStreamableHTTPServerTransport } from \"@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js\";\nimport { normalizeLegacySmartLinkInclude } from \"../server/smart-link-tools\";\n\ntype HandleOptions = {\n\tcreateServer: () => McpServer;\n\trequest: Request;\n\tparsedBody: unknown;\n};\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction normalizeLegacyDynamoiToolCallArguments(parsedBody: unknown): unknown {\n\tif (Array.isArray(parsedBody)) {\n\t\treturn parsedBody.map((message) =>\n\t\t\tnormalizeLegacyDynamoiToolCallArguments(message),\n\t\t);\n\t}\n\tif (!isRecord(parsedBody) || parsedBody.method !== \"tools/call\") {\n\t\treturn parsedBody;\n\t}\n\tconst params = parsedBody.params;\n\tif (!isRecord(params) || params.name !== \"dynamoi_get_smart_link\") {\n\t\treturn parsedBody;\n\t}\n\tconst normalizedArguments = normalizeLegacySmartLinkInclude(params.arguments);\n\tif (normalizedArguments === params.arguments) {\n\t\treturn parsedBody;\n\t}\n\treturn {\n\t\t...parsedBody,\n\t\tparams: {\n\t\t\t...params,\n\t\t\targuments: normalizedArguments,\n\t\t},\n\t};\n}\n\nexport async function handleMcpHttpRequest(\n\toptions: HandleOptions,\n): Promise<Response> {\n\tif (options.request.method.toUpperCase() !== \"POST\") {\n\t\treturn new Response(\n\t\t\tJSON.stringify({\n\t\t\t\terror: { code: -32_000, message: \"Method not allowed.\" },\n\t\t\t\tid: null,\n\t\t\t\tjsonrpc: \"2.0\",\n\t\t\t}),\n\t\t\t{\n\t\t\t\theaders: {\n\t\t\t\t\tAllow: \"POST\",\n\t\t\t\t\t\"content-type\": \"application/json\",\n\t\t\t\t},\n\t\t\t\tstatus: 405,\n\t\t\t},\n\t\t);\n\t}\n\n\tconst parsedBody = normalizeLegacyDynamoiToolCallArguments(\n\t\toptions.parsedBody,\n\t);\n\n\t// Each request owns its transport. MCP sessions are optional, and this helper\n\t// deliberately does not advertise a reusable session that serverless routing\n\t// cannot guarantee will reach the same process.\n\tconst transport = new WebStandardStreamableHTTPServerTransport();\n\n\tconst server = options.createServer();\n\tawait server.connect(transport);\n\n\treturn transport.handleRequest(options.request, {\n\t\tparsedBody,\n\t});\n}\n"
21
+ "import {\n\tPROSPECTIVE_BUDGET_FUNDING_CONSENT_COPY,\n\tPROSPECTIVE_BUDGET_FUNDING_CONSENT_COPY_HASH,\n\tPROSPECTIVE_BUDGET_FUNDING_CONSENT_VERSION,\n} from \"../consent\";\nimport {\n\tLaunchCampaignOutputEnvelopeSchema,\n\tListMediaAssetsOutputEnvelopeSchema,\n} from \"./output-schemas\";\nimport {\n\tDynamoiLaunchCampaignInputSchema,\n\tDynamoiListMediaAssetsInputSchema,\n} from \"./tools\";\n\nexport const PHASE_3_TOOL_DEFINITIONS = [\n\t{\n\t\tdescription:\n\t\t\t\"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.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_list_media_assets\",\n\t\topenWorldHint: false,\n\t\toutputSchema: ListMediaAssetsOutputEnvelopeSchema,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiListMediaAssetsInputSchema,\n\t\ttitle: \"List Media Assets\",\n\t},\n\t{\n\t\tdescription:\n\t\t\t`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. DAILY budgets require authorizeAutomaticDailyFunding=true plus the exact acceptedConsentVersion (\"${PROSPECTIVE_BUDGET_FUNDING_CONSENT_VERSION}\") and acceptedConsentCopyHash (\"${PROSPECTIVE_BUDGET_FUNDING_CONSENT_COPY_HASH}\"); first show the user this exact consent copy: \"${PROSPECTIVE_BUDGET_FUNDING_CONSENT_COPY}\". TOTAL budgets use existing credit and need no consent. YOUTUBE campaigns require youtubeVideoId and youtubeStrategy, plus youtubePlaylistId unless the strategy is CHEAPEST_VIEWS. After a successful launch, answer from the returned campaign details directly instead of chaining more tools unless the user explicitly asked for more.`,\n\t\tdestructiveHint: true,\n\t\tidempotentHint: true,\n\t\tname: \"dynamoi_launch_campaign\",\n\t\topenWorldHint: true,\n\t\toutputSchema: LaunchCampaignOutputEnvelopeSchema,\n\t\treadOnlyHint: false,\n\t\tschema: DynamoiLaunchCampaignInputSchema,\n\t\ttitle: \"Start Campaign Launch Workflow\",\n\t},\n] as const;\n",
22
+ "// Canonical public messaging for the Dynamoi MCP server. Registry metadata\n// (package.json and server.json), the public server card, agent discovery\n// documents, and docs metadata reuse these strings so the wording cannot drift.\n\n/** Product name for the hosted MCP server. */\nexport const DYNAMOI_MCP_SERVER_NAME = \"Dynamoi MCP Server\";\n\n/** One-line tagline. */\nexport const DYNAMOI_MCP_TAGLINE = \"Music marketing for AI agents\";\n\n/**\n * Short description. The MCP Registry caps `server.json` descriptions at 100\n * characters, and `package.json` and `server.json` must equal this exactly.\n */\nexport const DYNAMOI_MCP_SHORT_DESCRIPTION =\n\t\"Music marketing for AI agents: free Smart Links, promotion campaigns, analytics, and distribution.\";\n\n/** Standard description for docs metadata, listings, and discovery summaries. */\nexport const DYNAMOI_MCP_STANDARD_DESCRIPTION =\n\t\"Connect ChatGPT, Claude, Cursor, and other AI agents to Dynamoi for free Spotify Smart Links, music promotion campaigns, analytics, and distribution.\";\n\n/** Registry limit for `server.json` descriptions. */\nexport const DYNAMOI_MCP_REGISTRY_DESCRIPTION_MAX_LENGTH = 100;\n",
23
+ "import {\n\tcreateMcpHandler,\n\tisLegacyRequest,\n\ttype McpHttpHandler,\n\ttype McpServer,\n\tWebStandardStreamableHTTPServerTransport,\n} from \"@modelcontextprotocol/server\";\n\ntype HandleOptions = {\n\tcreateServer: () => McpServer;\n\trequest: Request;\n\tparsedBody: unknown;\n};\n\nfunction methodNotAllowed(): Response {\n\treturn new Response(\n\t\tJSON.stringify({\n\t\t\terror: { code: -32_000, message: \"Method not allowed.\" },\n\t\t\tid: null,\n\t\t\tjsonrpc: \"2.0\",\n\t\t}),\n\t\t{\n\t\t\theaders: {\n\t\t\t\tAllow: \"POST\",\n\t\t\t\t\"content-type\": \"application/json\",\n\t\t\t},\n\t\t\tstatus: 405,\n\t\t},\n\t);\n}\n\n// CUSTOM INTEROP SHIM (2025-era clients such as ChatGPT):\n// MCP SDK v2 serves 2026-07-28 requests through `createMcpHandler`, which does\n// not check Accept. Its 2025-era path (`WebStandardStreamableHTTPServerTransport`,\n// also behind the built-in `legacyStatelessFallback`) still answers 406 unless\n// Accept lists both `application/json` and `text/event-stream`, and the built-in\n// fallback always streams SSE. ChatGPT's 2025-era requests send\n// `Accept: application/json` only, so this path normalizes Accept for the SDK\n// check and keeps JSON response mode for clients that did not ask for SSE.\nasync function handleLegacyRequest(options: HandleOptions): Promise<Response> {\n\tconst accept = options.request.headers.get(\"accept\");\n\tconst acceptsEventStream = accept?.includes(\"text/event-stream\") ?? false;\n\tconst acceptsJson =\n\t\taccept?.includes(\"application/json\") || accept === \"*/*\" || !accept;\n\tconst enableJsonResponse = !acceptsEventStream && Boolean(acceptsJson);\n\n\tlet effectiveRequest = options.request;\n\tif (\n\t\t!(\n\t\t\taccept?.includes(\"application/json\") &&\n\t\t\taccept.includes(\"text/event-stream\")\n\t\t)\n\t) {\n\t\tconst headers = new Headers(options.request.headers);\n\t\theaders.set(\"accept\", \"application/json, text/event-stream\");\n\t\t// parsedBody is handed to the transport, so the request body is never read.\n\t\teffectiveRequest = new Request(options.request.url, {\n\t\t\theaders,\n\t\t\tmethod: options.request.method,\n\t\t\tsignal: options.request.signal,\n\t\t});\n\t}\n\n\t// Each request owns a stateless server and transport: serverless routing\n\t// cannot guarantee a reusable session reaches the same process. Both close\n\t// once the response is complete or the client disconnects.\n\tconst server = options.createServer();\n\tconst transport = new WebStandardStreamableHTTPServerTransport({\n\t\tenableJsonResponse,\n\t\tsessionIdGenerator: undefined,\n\t});\n\tlet closed = false;\n\tconst close = () => {\n\t\tif (!closed) {\n\t\t\tclosed = true;\n\t\t\toptions.request.signal.removeEventListener(\"abort\", close);\n\t\t\tvoid server.close().catch(() => undefined);\n\t\t}\n\t};\n\toptions.request.signal.addEventListener(\"abort\", close, { once: true });\n\n\tlet response: Response;\n\ttry {\n\t\tawait server.connect(transport);\n\t\tresponse = await transport.handleRequest(effectiveRequest, {\n\t\t\tparsedBody: options.parsedBody,\n\t\t});\n\t} catch (error) {\n\t\tclose();\n\t\tthrow error;\n\t}\n\tif (!(response.body && isEventStream(response))) {\n\t\tclose();\n\t\treturn response;\n\t}\n\treturn new Response(\n\t\tresponse.body.pipeThrough(new TransformStream({ flush: close })),\n\t\t{\n\t\t\theaders: response.headers,\n\t\t\tstatus: response.status,\n\t\t\tstatusText: response.statusText,\n\t\t},\n\t);\n}\n\nfunction isEventStream(response: Response): boolean {\n\treturn (response.headers.get(\"content-type\") ?? \"\").includes(\n\t\t\"text/event-stream\",\n\t);\n}\n\n// One SDK handler serves every modern request; each request supplies the\n// server factory for its own principal and tool profile.\nconst modernServerFactories = new WeakMap<Request, () => McpServer>();\nlet modernHandler: McpHttpHandler | undefined;\n\nfunction getModernHandler(): McpHttpHandler {\n\tmodernHandler ??= createMcpHandler(\n\t\t({ requestInfo }) => {\n\t\t\tconst createServer =\n\t\t\t\trequestInfo && modernServerFactories.get(requestInfo);\n\t\t\tif (!createServer) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"No MCP server factory is registered for this request.\",\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn createServer();\n\t\t},\n\t\t{ legacy: \"reject\", responseMode: \"json\" },\n\t);\n\treturn modernHandler;\n}\n\n/**\n * Serves one stateless MCP POST. 2026-07-28 requests go through the SDK's\n * per-request handler; 2025-era requests (including `initialize`) go through\n * the legacy transport above. GET and DELETE have no stream or session to\n * serve, so both eras answer them with 405.\n */\nexport async function handleMcpHttpRequest(\n\toptions: HandleOptions,\n): Promise<Response> {\n\tif (options.request.method.toUpperCase() !== \"POST\") {\n\t\treturn methodNotAllowed();\n\t}\n\tif (await isLegacyRequest(options.request, options.parsedBody)) {\n\t\treturn handleLegacyRequest(options);\n\t}\n\tmodernServerFactories.set(options.request, options.createServer);\n\ttry {\n\t\treturn await getModernHandler().fetch(options.request, {\n\t\t\tparsedBody: options.parsedBody,\n\t\t});\n\t} finally {\n\t\tmodernServerFactories.delete(options.request);\n\t}\n}\n"
22
24
  ],
23
- "mappings": ";;;;;;;;;;;;;;AAAA;;;ACAA;AAEA,IAAM,2BACJ,SAAO;AAAA,EACP,WAAa,SAAO;AAAA,EACpB,WAAa,SAAO;AACrB,CAAC,EACA,OAAO;AAET,SAAS,0BAA0B,CAClC,YACA,SACC;AAAA,EACD,MAAM,WAAW,SAAS,eACtB,CAAC,WAAW,mBAAmB,OAAO,IACtC,CAAC,WAAW,OAAO;AAAA,EACvB,OACE,SAAO;AAAA,IACP,MAAM,WAAW,SAAS;AAAA,IAC1B,MACE,OAAK,CAAC,cAAc,YAAY,YAAY,SAAS,CAAC,EACtD,SAAS;AAAA,IACX,SAAW,SAAO,EAAE,SAAS;AAAA,IAC7B,QAAU,OAAK,QAAQ;AAAA,EACxB,CAAC,EACA,OAAO,EACP,YAAY,CAAC,OAAO,YAAY;AAAA,IAChC,IAAI,MAAM,WAAW,WAAW,CAAC,MAAM,SAAS;AAAA,MAC/C,QAAQ,SAAS;AAAA,QAChB,MAAM;AAAA,QACN,SAAS;AAAA,QACT,MAAM,CAAC,SAAS;AAAA,MACjB,CAAC;AAAA,IACF;AAAA,IACA,IAAI,MAAM,WAAW,WAAW,M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AA,IACV,OAAO;AAAA,EACR,GACA,OAAO,SAAS;AAAA,IACf,UAAU;AAAA,MACT;AAAA,QACC,UAAU;AAAA,QACV,MAAM,KAAK,UAAU;AAAA,UACpB,oBACC;AAAA,UACD,gBACC;AAAA,UACD,SACC;AAAA,UACD,iBACC;AAAA,UACD,cACC;AAAA,UACD,eAAe;AAAA,YACd,0BAA0B;AAAA,cACzB,OACC;AAAA,cACD,SACC;AAAA,YACF;AAAA,YACA,uBAAuB;AAAA,cACtB,OACC;AAAA,cACD,SACC;AAAA,YACF;AAAA,YACA,mBAAmB;AAAA,cAClB,OACC;AAAA,cACD,SACC;AAAA,YACF;AAAA,YACA,wBAAwB;AAAA,cACvB,OACC;AAAA,cACD,SACC;AAAA,YACF;AAAA,UACD;AAAA,QACD,CAAC;AAAA,QACD,KAAK,IAAI;AAAA,MACV;AAAA,IACD;AAAA,EACD,EACD;AAAA,EAEA,OAAO,iBACN,6BACA,wCACA;AAAA,IACC,aACC;AAAA,IACD,UAAU;AAAA,IACV,OAAO;AAAA,EACR,GACA,OAAO,SAAS;AAAA,IACf,UAAU;AAAA,MACT;AAAA,QACC,UAAU;AAAA,QACV,MAAM,KAAK,UAAU;AAAA,UACpB,aACC;AAAA,UACD,SACC;AAAA,UACD,WACC;AAAA,UACD,cACC;AAAA,UACD,eAAe;AAAA,YACd;AAAA,YACA;AAAA,YACA;AAAA,UACD;AAAA,UACA,eAAe;AAAA,YACd,oBAAoB;AAAA,cACnB,OACC;AAAA,cACD,SACC;AAAA,YACF;AAAA,YACA,0BAA0B;AAAA,cACzB,OACC;AAAA,cACD,SACC;AAAA,YACF;AAAA,YACA,uBAAuB;AAAA,cACtB,OACC;AAAA,cACD,SACC;AAAA,YACF;AAAA,UACD;AAAA,QACD,CAAC;AAAA,QACD,KAAK,IAAI;AAAA,MACV;AAAA,IACD;AAAA,EACD,EACD;AAAA,EAEA,OAAO,iBACN,4BACA,uCACA;AAAA,IACC,aACC;AAAA,IACD,UAAU;AAAA,I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ACR,GACA,OAAO,SAAS;AAAA,IACf,UAAU;AAAA,MACT;AAAA,QACC,UAAU;AAAA,QACV,MAAM,KAAK,UAAU;AAAA,UACpB,aACC;AAAA,UACD,kBACC;AAAA,UACD,SACC;AAAA,UACD,cACC;AAAA,UACD,eAAe;AAAA,YACd,0BAA0B;AAAA,cACzB,OACC;AAAA,cACD,SACC;AAAA,YACF;AAAA,YACA,uBAAuB;AAAA,cACtB,OACC;AAAA,cACD,SACC;AAAA,YACF;AAAA,YACA,wBAAwB;AAAA,cACvB,OACC;AAAA,cACD,SACC;AAAA,YACF;AAAA,YACA,oBAAoB;AAAA,cACnB,OACC;AAAA,cACD,SACC;AAAA,YACF;AAAA,YACA,kBAAkB;AAAA,cACjB,OACC;AAAA,cACD,SACC;AAAA,YACF;AAAA,UACD;AAAA,UACA,oBACC;AAAA,QACF,CAAC;AAAA,QACD,KAAK,IAAI;AAAA,MACV;AAAA,IACD;AAAA,EACD,EACD;AAAA,EAEA,OAAO,iBACN,4BACA,uCACA;AAAA,IACC,aACC;AAAA,IACD,UAAU;AAAA,IACV,OAAO;AAAA,EACR,GACA,OAAO,SAAS;AAAA,IACf,UAAU;AAAA,MACT;AAAA,QACC,UAAU;AAAA,QACV,MAAM,KAAK,UAAU;AAAA,UACpB,oBACC;AAAA,UACD,gBACC;AAAA,UACD,SACC;AAAA,UACD,iBACC;AAAA,UACD,cACC;AAAA,UACD,eAAe;AAAA,YACd,0BAA0B;AAAA,cACzB,OACC;AAAA,cACD,SACC;AAAA,YACF;AAAA,YACA,uBAAuB;AAAA,cACtB,OACC;AAAA,cACD,SACC;AAAA,YACF;AAAA,YACA,mBAAmB;AAAA,cAClB,OACC;AAAA,cACD,SACC;AAAA,YACF;AAAA,YACA,wBAAwB;AAAA,cACvB,OACC;AAAA,cACD,SACC;AAAA,YACF;AAAA,UACD;AAAA,QACD,CAAC;AAAA,QACD,KAAK,IAAI;AAAA,MACV;AAAA,IACD;AAAA,EACD,EACD;AAAA,EAEA,OA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