Skip to main content
Glama

compute_image_crops

Calculate image crop coordinates for Meta ad creatives by providing image dimensions. Returns the largest centered region matching each required aspect ratio, ready to use in ad creation requests.

Instructions

Compute image_crops coordinates for a source image of the given dimensions.

Returns the image_crops dict ready to pass directly to create_ad_creative
or bulk_create_ad_creatives. For each crop key the result is the largest
centered region that fits within the source image while matching the key's
aspect ratio — equivalent to "Original" crop (no content is cut off beyond
what the ratio requires).

Args:
    image_width: Width of the source image in pixels (e.g. 1080).
    image_height: Height of the source image in pixels (e.g. 1080).
    crop_keys: Optional list of specific crop keys to compute. Defaults to
        all 6 keys accepted by Meta's API:
          "100x100"  — 1:1 square (Feed, Marketplace, Search)
          "100x72"   — ~1.39:1 horizontal (Marketplace, some placements)
          "400x500"  — 4:5 portrait (Feed on mobile, Stories fallback)
          "400x150"  — ~2.67:1 wide banner (Audience Network)
          "600x360"  — ~1.67:1 horizontal (Right column, some placements)
          "90x160"   — 9:16 tall portrait (Stories)

Returns:
    JSON with the image_crops dict (ready for copy-paste into create_ad_creative),
    plus validation notes for any invalid keys requested.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
image_widthYes
image_heightYes
crop_keysNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description fully explains the algorithm: largest centered region fitting source image while matching aspect ratio, equivalent to 'Original' crop. Also clarifies the return format and validation notes. No contradictions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Well-structured with sections (description, args, returns). While verbose, the detail is necessary and front-loaded with purpose. Could be slightly condensed but not wasteful.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 3 params and no annotations, the description is comprehensive: inputs, usage in creative creation, list of possible crop keys, return format. An agent can correctly invoke it without external context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, but description adds extensive meaning: explains image_width and image_height with example values, describes crop_keys list with all 6 default keys and their aspect ratios and placements. Highly compensates for lack of schema details.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it computes image_crops coordinates for a source image, and explains the output is directly usable in create_ad_creative or bulk_create_ad_creatives. It distinguishes from sibling tools like image upload or creation tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides clear context on when to use (preparation for ad creative creation) and describes the 'Original' crop behavior. It doesn't explicitly state when not to use, but the purpose is well-defined.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pipeboard-co/meta-ads-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server