Skip to content

MCP image edit and variation tools fail with 413 #140

Description

@JGoutin

Found at the 1.16 milestone gate. Pre-existing, not a 1.16 regression — verified
by checking out and running the same two tests at three points:

Revision Result
1-16 (milestone head) 2 failed
8b81712d (pre-milestone) 2 failed
v1.15.0 (released) 2 failed

So it ships today.

Symptom

openai_image_edit and openai_image_variation, called as MCP tools, fail at the
transport:

httpx.HTTPStatusError: Client error '413 Request Entity Too Large'
    for url 'http://mcp-test/mcp'

Reproduce:

uv run pytest tests/test_mcp_tools.py::TestImageTools -q --expensive

Deterministic — it reproduced on every run, unlike the flaky Mistral
tool-continuation test alongside it, which passed on retry.

What is known

The 413 does not come from this codebase. Nothing in stdapi/mcp.py or
stdapi/main.py produces one, and the only 413 the gateway raises is
input_file.py's max_input_file_size check, which is disabled by default
(0 means unlimited) and is not configured in the test environment. The status
appears at the MCP mount itself, so the limit most likely belongs to the MCP
Streamable HTTP transport or to fastapi-mcp.

These are the only two MCP tools that carry an image into the request, which is
why they are the only ones affected: the other image tool (openai_image_generation)
sends a prompt and passes.

Why it matters

An AI agent driving this gateway over MCP cannot edit an image or produce a
variation at all. The text and generation tools are unaffected.

Not yet determined

  • Which component imposes the limit, and whether it is configurable.
  • Whether a smaller image succeeds, which would confirm a body-size ceiling rather
    than a shape problem, and give the threshold.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status
    Backlog

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions