Skip to content

fix: require account on update_media_buy, flatten preview_creative schema#2179

Merged
bokelley merged 2 commits intomainfrom
bokelley/buy-account-creative-flat
Apr 15, 2026
Merged

fix: require account on update_media_buy, flatten preview_creative schema#2179
bokelley merged 2 commits intomainfrom
bokelley/buy-account-creative-flat

Conversation

@bokelley
Copy link
Copy Markdown
Contributor

Summary

Implements two pre-3.0 schema changes discovered during createAdcpServer implementation (#537):

Changes

Schema (static/schemas/source/):

  • update-media-buy-request.json: added account (required) referencing account-ref.json
  • preview-creative-request.json: replaced oneOf with flat object + allOf conditional validation (if/then for mode-specific required fields)

Server (server/src/):

  • adcp-tools.ts: added account validation on update_media_buy, added validate function for preview_creative mode-specific requirements, updated quick-reference hint text
  • training-agent/task-handlers.ts: added account to required array, updated preview_creative tool definition (added variant to enum, renamed creativesrequests, added missing fields), added variant mode handler

Docs (docs/):

  • update_media_buy.mdx: added account to parameter table, updated all 15 code examples (JS, Python, JSON)
  • preview_creative.mdx: replaced 3 per-mode parameter tables with single flat table

Closes #2174, closes #2175.

Test plan

  • All 587 unit tests pass (training-agent, storyboards, creative-agent, etc.)
  • TypeScript typecheck passes
  • Mintlify docs validation passes (no broken links)
  • Pre-push hooks pass (version sync, accessibility)
  • Verify @adcp/client storyboard media_buy_state_machine.yaml sample_requests are updated to include account (separate client PR)

🤖 Generated with Claude Code

…hema (#2174, #2175)

- Add account as required field on update_media_buy for governance and
  account resolution parity with create_media_buy
- Replace preview_creative oneOf union with flat object using request_type
  discriminant and if/then conditional validation
- Add validate function for preview_creative in meta-tool registry
- Update training agent tool definitions to match canonical schemas
- Update all doc examples with account field

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor Author

@bokelley bokelley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed from the @adcp/client side. Both changes look correct and we've already picked them up:

  • update_media_buy account: We updated hasAccount: true in createAdcpServer's tool metadata. Account resolution now runs automatically on update_media_buy, matching create_media_buy.

  • preview_creative flattening: Once we regenerate schemas from the updated spec, PreviewCreativeRequestSchema becomes a z.object() and we can add previewCreative to CreativeHandlers in createAdcpServer. Currently blocked on schema regen (tracked in our PR).

One minor note: in task-handlers.ts line 2566, request_type is typed as optional (request_type?: 'single' | 'batch' | 'variant') but the schema now has required: ['request_type']. The runtime validation catches it, but the TypeScript type should match. Not blocking.

The validate function for preview_creative (checking mode-specific required fields) is a nice touch — mirrors exactly what the JSON Schema if/then does, but at the application level for better error messages.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@bokelley bokelley merged commit 07d82dd into main Apr 15, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant