different-ai/openwork · error
MCP_RESPONSE_BODY_LIMIT
MCP_RESPONSE_BODY_LIMIT
Error message
MCP_RESPONSE_BODY_LIMIT
What it means
MCP_RESPONSE_BODY_LIMIT is raised when the provider response exceeds the gateway's maximum body size, thrown as ExternalMcpResponseBodyLimitError and classified as response_too_large. The limit protects the gateway from unbounded payloads (huge tool catalogs, giant tool outputs, endless event streams). It is non-retryable and owned by the provider admin because the provider must shrink the payload.
Source
Thrown at ee/apps/den-api/src/capability-sources/external-mcp-diagnostics.ts:1191
// The enterprise client aborts with a RequestTimeout MCP error of its own, so
// check for our marker before any JSON-RPC code is read as the provider's.
if (error instanceof ExternalMcpLifecycleDeadlineError || isEnterpriseMcpLifecycleDeadline(error)) {
return {
phase: fallbackPhase,
category: "lifecycle_deadline",
code: "MCP_LIFECYCLE_DEADLINE",
retryable: true,
actionOwner: "provider_admin",
operatorAction: fallbackPhase === "MCP_TOOL_EXECUTION"
? "Retry the capability, and reduce provider latency for this tool if it keeps running past the bounded deadline."
: "Reduce provider latency or catalog pagination so the complete MCP lifecycle finishes within the bounded deadline, then retry.",
}
}
if (error instanceof ExternalMcpResponseBodyLimitError) {
return {
phase: fallbackPhase,
category: "response_too_large",
code: "MCP_RESPONSE_BODY_LIMIT",
retryable: false,
actionOwner: "provider_admin",
operatorAction: "Reduce the provider response size, tool catalog, or event-stream payload before retrying.",
}
}
if (error instanceof PrivateUrlError) {
return {
phase: "CONFIGURATION",
category: "security_blocked",
code: "MCP_URL_BLOCKED",
retryable: false,
actionOwner: "organization_admin",
operatorAction: "Use a public HTTPS MCP URL or change the deployment's private-network policy through security review.",
}
}
if (hasForbiddenPortMessage(error)) {
return {
phase: "CONFIGURATION",View on GitHub (pinned to 2b7df46e8a)
Solutions
- Reduce the provider response size — trim tool outputs to summaries or bounded result windows.
- Shrink the exposed tool catalog (remove/deduplicate tools, paginate listing).
- Cap event-stream payload sizes, then retry once the response fits within the body limit.
Example fix
// before: tool returns the entire dataset
return { rows: await db.select().from(events) }
// after: bounded output
return { rows: await db.select().from(events).limit(100), truncated: true } Defensive patterns
Strategy: validation
Validate before calling
// estimate payload size before sending large results through a tool
const serialized = JSON.stringify(result)
if (serialized.length > 1_000_000) {
result = summarize(result) // truncate/summarize before returning from the tool
} Type guard
function isResponseBodyLimit(d: { code: string }): boolean {
return d.code === 'MCP_RESPONSE_BODY_LIMIT'
} Try / catch
try {
return await client.callTool(req)
} catch (e) {
if (isResponseBodyLimit(e.diagnostic)) {
// non-retryable: request a narrower result window instead of retrying the same call
return await client.callTool({ ...req, arguments: { ...req.arguments, limit: 100 } })
}
throw e
} Prevention
- Bound tool outputs (pagination, limits, summaries) at the provider.
- Keep tool catalogs lean and paginate discovery responses.
- Never stream unbounded logs or raw file dumps through tool results or event streams.
When it happens
Trigger: A tools/list response with an enormous catalog, a tool execution returning a very large result blob, or a text/event-stream that grows past the configured byte limit — any phase where the accumulated response body exceeds the limit before parsing completes.
Common situations: Providers exposing hundreds/thousands of tools in one unpaginated listing; tools returning entire datasets (full DB dumps, whole files) instead of summaries; misconfigured providers streaming verbose logs inside tool output; consumers requesting max-detail tool results.
Related errors
- MCP_PROVIDER_DECLARED_ERROR
- MCP_HTTP_404
- MCP_PROVIDER_HTTP_403
- MCP_HTTP_CONTENT_TYPE
- invalid_mcp_token_payload
AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01).
Data as JSON: /api/errors/a2de339a5ca03590.
Report an issue: GitHub.