← Duply blog

Agent workflows

Designing an MCP Tool for Branded Image Generation

An agent should not need unrestricted access to a design editor to generate a useful campaign image. A narrow MCP-compatible tool can expose approved templates and safe dynamic fields while keeping the underlying rendering deterministic.

· 8 minute read

Expose a job, not a generic API proxy

Use a tool name such as generate_branded_image and document when it should be called. Inputs should represent the business job—template key, headline, photo URL, price, CTA—not arbitrary HTTP methods or raw layer mutations.

Constrain template and field selection

Return or document an allowlist of template keys and fields. Lock logos, brand colors, legal text, and structural layers. Validate lengths, URLs, enum values, and required fields before calling the image API.

  • Approved template enum
  • Strict input schema
  • Length and URL validation
  • Human-readable error messages
  • No rendering credentials exposed to the model

Return evidence the agent can reason about

A useful tool result includes the final image URL, template key, normalized inputs, generation identifier, and warnings. This lets the agent present the output for human review or pass it to a later workflow step.

Add approval where consequences are real

Generation can be automatic while publishing remains gated. Require confirmation before sending an image to a paid campaign, customer email, public social account, or irreversible downstream action.

Frequently asked questions

Does MCP replace the Duply API?

No. MCP exposes a tool to the agent; the tool implementation can validate inputs and call the normal Duply API behind the scenes.

Can the agent create its own template?

The safer default is to select from approved templates. Template creation can be a separate reviewed workflow with narrower permissions.