SIGN IN SIGN UP

fix(server): reject json_schema when MCP tools are attached (#392)

handleChatCompletion builds the GenerationSchema up front, but the
toolsAreMCPInjected branch returns before the schema-guided generation branch is
ever reached, and mcpAutoExecuteResponse takes no schema parameter and uses
unconstrained generation. So `response_format: {"type": "json_schema"}` was
silently ignored whenever the server ran with --mcp.

Structured output is documented as a guarantee (#167). Any client that parses
the result -- which is the entire point of the feature -- broke the moment the
operator added --mcp, with no error and no warning. The failure is
config-dependent and invisible in the request/response pair, so it surfaced to
the client as an unexplained parse error somewhere else entirely.

Honouring the schema through the auto-execute path is a real feature, not a bug
fix, so this takes the honest-limitation route the project already applies to
embeddings and legacy completions: fail loudly and say why. The message names
the conflicting flag and both ways out.

Verified with two servers from the same binary and the identical request body:
plain server 200 with structured output, --mcp server 400
"response_format type 'json_schema' is not supported when the server has MCP
tools attached (--mcp)...". A normal (non-schema) request to the --mcp server
still returns 200 and still auto-executes the tool.

Diff taken from candidate PR #406, whose message is clearer than #404's.

Closes #392

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011ccLBbEaVVd4sJyUd5wyhA
A
Arthur Ficial committed
b6f86dcdc36ad4d9dfd93ec946ad39bd493abd93
Parent: e359a2c