Expand description
Bounded native-image delivery for multimodal MCP clients.
Small valid images pass through unchanged. Large images are decoded with explicit resource limits, resized, and encoded as a bounded JPEG before they enter JSON/base64. A live session also remembers recent content fingerprints so an accidental repeated call does not resend the same multi-megabyte image.
Structs§
- Read
Image Metadata - Safe metadata returned alongside native image content.
Enums§
- Read
Image Delivery - Detailed server-facing outcome. Direct library callers retain the historical
(
mime_type,base64_data) wrapper below.
Constants§
- MAX_
DELIVERED_ BYTES - Maximum binary image payload before base64 expansion. This turns the 17 MiB production outlier into a response of at most ~2.7 MiB of base64.
- MAX_
DELIVERED_ DIMENSION - Multimodal models downsample large inputs anyway; bounding the long edge preserves useful screenshot detail without shipping wallpaper-sized files.
- SUPPORTED_
MIME_ TYPES - Supported MCP image MIME types.
Functions§
- handle_
tool_ call - Backwards-compatible text-free library API. Direct callers explicitly get
an image every time; MCP callers use
handle_tool_call_detailedso repeat deliveries can be compacted safely. - handle_
tool_ call_ detailed - Server-facing image delivery with content-based, per-session deduplication.