This repository was archived by the owner on Mar 15, 2026. It is now read-only.
Fix dimensions extraction in storage.py - #17
Merged
Merged
Conversation
The preview_creative tool was attempting to access format_obj.dimensions as a string attribute, but the Format Pydantic model uses a structured schema where dimensions are stored in the renders field. Changes: - Extract dimensions from format_obj.renders[0].dimensions object - Access width and height as numeric attributes from Dimensions model - Maintain fallback to 300x250 for formats without renders This fixes preview generation for all AdCP formats including display, video, and other format types that specify dimensions through renders. Resolves bug preventing creative preview generation in MCP protocol. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
The code was failing with an
AttributeErrorbecause it incorrectly assumedformat_obj.dimensionswas a string attribute like "300x250". The actual dimensions are nested within therendersfield of theFormatobject.Changes
src/creative_agent/storage.py:format_obj.renders[0].dimensions.widthandformat_obj.renders[0].dimensions.height.rendersanddimensionsbefore accessing them.Testing
renders(e.g.,display_336x280_html).rendersdefined.