Skip to main content
Glama

Generate image → save to file

generate_image_to_file

Create OpenAI images and save them directly to disk as full-resolution files, returning the absolute file path instead of image bytes. Set output directory, filename, size, and format.

Instructions

Generate an image with OpenAI and SAVE it as a file on disk. Returns the absolute file path (no image bytes are sent back through the model context). Best for real, full-resolution assets — lossless and cheap on context. Optionally set output_dir/filename.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "prompt": "<prompt>"
    },
    "name": "generate_image_to_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
sizeNoImage size. Square / landscape / portrait / auto. Default: auto.
promptYesWhat to draw. Be specific about style, colors, composition.
qualityNoRender quality (higher costs more). Default: auto.
filenameNoFile name without extension. Default: a slug of the prompt + timestamp.
backgroundNoUse "transparent" for logos/icons (PNG/WebP only). Default: auto.
output_dirNoFolder to save into (absolute recommended). Default: GPT_MCP_OUTPUT_DIR or ./generated-images.
output_formatNoFile format. Default: png.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.2/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does disclose the key traits: the tool writes a file to disk (a side effect), returns a path rather than bytes, and defaults its location to GPT_MCP_OUTPUT_DIR or ./generated-images. It omits overwrite behavior when a filename already exists and whether missing directories are created — meaningful gaps for a filesystem-writing tool.

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

Conciseness5/5

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

Three short sentences, each earning its place: what it does, what it returns, when to prefer it, and the optional knobs. The most decision-relevant facts (file output, path return, context economy) are front-loaded.

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

Completeness4/5

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

For a 7-parameter generation tool with no output schema, the description covers the return value explicitly (absolute file path), which is exactly what the missing output schema would otherwise need to convey. The remaining shortfall is side-effect detail — overwrite and directory-creation semantics — that no structured field supplies.

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

Parameters3/5

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

Schema description coverage is 100% with enum values and per-field defaults, so the schema already does the heavy lifting. The description only adds that output_dir/filename are optional, which is already implied by the schema's required list; no extra syntax or path-format guidance is provided beyond the schema.

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 pairs a specific verb and resource ("Generate an image with OpenAI") with the concrete output artifact ("SAVE it as a file on disk") and the returned value (absolute file path). It also distinguishes itself functionally from the bytes variant by stating "no image bytes are sent back through the model context," so an agent can pick between the two without opening either schema.

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?

"Best for real, full-resolution assets — lossless and cheap on context" gives a clear selection criterion against the sibling that returns bytes. It stops short of explicitly naming that sibling or stating when-not-to-use conditions (e.g., when the caller needs the image inline for vision analysis), so it is strong but not exhaustive.

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

Deploy Server

Other Tools