Documentation
¶
Overview ¶
Package apiresponse holds the API gateway's rules for an upstream response: which bodies are safe to return inline, and which headers reach the caller. Moved out of pkg/toolkits/apigateway for its size budget.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Inlineable ¶
Inlineable reports whether a response with this Content-Type is safe to buffer and return inline through the MCP/JSON channel. Text-shaped bodies (text/*, JSON, XML, form, JavaScript) are inlineable: JSON-escaping them is roughly size-preserving. Binary bodies (application/zip, application/octet-stream, image/*, audio/*, video/*, application/pdf, ...) are NOT: json.Marshal escapes every control and invalid-UTF-8 byte as \uXXXX, inflating a high-entropy body several-fold, and the escaped copy is held alongside the raw buffer and the re-marshaled MCP envelope. Returning such a body inline both risks an OOM and is useless to the model. The gateway refuses those before buffering and steers the caller to api_export.
An empty or unparseable Content-Type returns true so the legacy buffered path (bounded by the per-request read cap) is unchanged for responses that declare no usable type.
Types ¶
This section is empty.