image_result_formatter
Enable vision models to see images from tool results
What it does
When a tool returns a base64-encoded image (screenshot, generated image, etc.), this plugin:
Detects base64 images
Recognizes data URLs (data:image/png;base64,...) and plain base64 strings.
Converts to vision format
Transforms the tool result into OpenAI vision API format so the LLM can see the image visually.
Quick Start
main.py
Python REPL
Interactive
Without vs With Plugin
Without Plugin
The LLM receives raw base64 text:
Tool result: "iVBORw0KGgoAAAANSUhEUgAAA..."LLM cannot interpret this as an image!
With Plugin
The LLM receives proper image format:
{type: "image_url", url: "data:image/png;..."}LLM can see and analyze the image!
How it works
main.py
Supported Formats
| Format | Example |
|---|---|
| PNG | data:image/png;base64,... |
| JPEG | data:image/jpeg;base64,... |
| WebP | data:image/webp;base64,... |
| GIF | data:image/gif;base64,... |
| Plain base64 | Long base64 strings (defaults to PNG) |
Use Cases
- Screenshots: Browser automation tools that capture pages
- Image generation: Tools that create images (charts, diagrams)
- Visual analysis: Any tool returning visual data for LLM interpretation
Events Used
| Event | Handler | Purpose |
|---|---|---|
after_tools | _format_image_result | Convert base64 to vision format |
Uses after_tools (not after_each_tool) because message modification must happen after all tools complete.
Source
connectonion/useful_plugins/image_result_formatter.py
main.py
