-
Notifications
You must be signed in to change notification settings - Fork 33
Open
Description
Problem
static_map_image_tool embeds the map image as a base64-encoded image content item in the tool result. For large maps (e.g. 800x600 streets at zoom 12), the PNG can exceed 750KB, and base64 encoding adds ~33% overhead, pushing the tool result over Claude Desktop's 1MB limit.
Tool result is too large. Maximum size is 1MB.
Proposed Fix
Instead of embedding base64 in the tool result, store the image in a bounded in-memory cache and return a resource content item referencing it (e.g. mapbox://temp/static-map-{id}). Clients that support resource fetching can retrieve the image on demand; the tool result itself stays small.
The cache should:
- Have a max entry count (or total byte) cap to prevent memory exhaustion
- Use TTL expiry (same pattern as
DirectionsTooltemp resources) - Serve binary PNG/JPEG data with the correct mime type
References
DirectionsToolalready implements a temp resource cache for large route responses — reuse or extend that pattern- MCP Apps panel renders via iframe URL so is unaffected
- PR fix: return proper error when static map API returns non-2xx response #130 adds
response.okcheck for API errors (related)
🤖 Generated with Claude Code
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels