Skip to content
This repository was archived by the owner on Mar 15, 2026. It is now read-only.

Fix dimensions extraction in storage.py - #17

Merged
bokelley merged 1 commit into
mainfrom
bokelley/colombo
Oct 17, 2025
Merged

Fix dimensions extraction in storage.py#17
bokelley merged 1 commit into
mainfrom
bokelley/colombo

Conversation

@bokelley

Copy link
Copy Markdown
Contributor

Background

The code was failing with an AttributeError because it incorrectly assumed format_obj.dimensions was a string attribute like "300x250". The actual dimensions are nested within the renders field of the Format object.

Changes

  • src/creative_agent/storage.py:
    • Modified dimension extraction logic.
    • Now accesses dimensions from format_obj.renders[0].dimensions.width and format_obj.renders[0].dimensions.height.
    • Added checks for the existence of renders and dimensions before accessing them.
    • Retains the default 300x250 dimensions if no renders or dimensions are found.

Testing

  • Verify preview_creative test passes.
  • Test with formats that have dimensions defined in renders (e.g., display_336x280_html).
  • Test with formats that do not have renders defined.

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>
@bokelley
bokelley merged commit 4ed17be into main Oct 17, 2025
3 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant