feat(image-tool): support multiple images in a single tool call (#17512)

* feat(image-tool): support multiple images in a single tool call

- Change 'image' parameter to accept string | string[] (Type.Union)
- Add 'maxImages' parameter (default 5) to cap abuse/token explosion
- Update buildImageContext to create multiple image content parts
- Normalize single string input to array for unified processing
- Keep full backward compatibility: single string works as before
- Update tool descriptions for both vision and non-vision models
- MiniMax VLM falls back to first image (single-image API)
- Details output adapts: 'image' key for single, 'images' for multi

* bump default max images from 5 to 20
This commit is contained in:
Tyler Yust
2026-02-15 13:45:17 -08:00
committed by GitHub
parent 27deda2221
commit ff4f59ec90
2 changed files with 159 additions and 87 deletions

View File

@@ -192,9 +192,7 @@ describe("image tool implicit imageModel config", () => {
});
const tool = createImageTool({ config: cfg, agentDir, modelHasVision: true });
expect(tool).not.toBeNull();
expect(tool?.description).toContain(
"Only use this tool when the image was NOT already provided",
);
expect(tool?.description).toContain("Only use this tool when images were NOT already provided");
});
it("allows workspace images outside default local media roots", async () => {