Enable AI to see images when using the read tool

Return JPG/PNG images as structured image content parts from ReadTool
instead of embedding base64 data URLs as plain text. Since OpenAI tool
messages only support text content, images are injected as a follow-up
user message with image_url parts that vision models can interpret.
This commit is contained in:
Alex Gleason committed 2026-03-28 18:27:41 -05:00
1 parent d6e8b9bc84
commit 2641252c6a
3 files changed
+38 -3

No files matched your search

+6
View File
@@ -1,8 +1,14 @@
import type z from "zod";
export interface ToolResultImage {
type: 'image';
url: string; // data URL (e.g. data:image/png;base64,...)
}
export interface ToolResult {
content: string;
cost?: number;
images?: ToolResultImage[];
}
export interface Tool<TParams> {