fix(static-map): store large images as temporary resources to avoid 1MB tool result limit#140
Open
mattpodwysocki wants to merge 1 commit intomainfrom
Open
fix(static-map): store large images as temporary resources to avoid 1MB tool result limit#140mattpodwysocki wants to merge 1 commit intomainfrom
mattpodwysocki wants to merge 1 commit intomainfrom
Conversation
…MB limit Images over 700KB are stored in the temporary resource cache instead of being inlined as base64 in the tool result, preventing Claude Desktop's 1MB tool result limit from being exceeded. - TemporaryResourceManager: add 50MB byte cap with oldest-first eviction and mimeType field on stored resources - TemporaryDataResource: serve blob content for image/* mime types - StaticMapImageTool: inline base64 for small images, temp resource for large Closes #139 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
c5c5a99 to
3d56be3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
static_map_image_toolinlines the map image as a base64imagecontent item in the tool result. For large maps (e.g. 800x600 streets at zoom 12), the PNG can exceed 700KB raw, and base64 encoding adds ~33% overhead, pushing the tool result over Claude Desktop's 1MB limit:Fix
Images over 700KB are stored in the temporary resource cache instead of being inlined as base64:
imagecontent as before — no behavior change for most requestsmapbox://temp/static-map-{id}, retrievable viaresources/readwith a 30-minute TTL; tool result contains the resource URI as textAdditionally:
TemporaryResourceManagernow enforces a 50MB byte cap with oldest-first eviction to prevent unbounded memory growth (previously unbounded)TemporaryDataResourcenow servesblobcontent forimage/*mime types instead of always returning JSON textTest plan
stores large images as temporary resources instead of inlining base64Closes #139
🤖 Generated with Claude Code