LoadArtifactsTool should handle unsupported artifact MIME types gracefully
- Dominant language
- Go
- Stars
- 8.8k
- Forks
- 1k
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 88
Description
## Required Information
**Describe the Bug:**
`LoadArtifactsTool` appends loaded artifact parts directly into the next model request. When the artifact has inline data with a MIME type that Gemini does not accept inline (e.g. `application/csv`, pptx, docx), the follow-up `generateContent` call fails with `Unsupported MIME Type` instead of continuing with usable context.
Same class of issue as adk-python #4028, fixed there by commit `fdc98d5c`.
**Steps to Reproduce:**
1. Build an agent that uses `loadartifactstool`.
2. Save an artifact with inline MIME `application/csv` (or any non-supported inline MIME).
3. Have the model call `load_artifacts(["data.csv"])`.
4. The next model request fails because the inline `application/csv` part is not inline-supported by Gemini.
**Expected Behavior:**
Before appending a loaded artifact, classify its MIME type and fall back to a model-safe part:
- keep inline media supported by Gemini unchanged: `image/*`, `audio/*`, `video/*`, `application/pdf`
- convert text-like inline data to text: `text/*`, `application/csv`, `application/json`, `application/xml`
- replace unsupported binary inline data with a short placeholder that includes the artifact name, MIME type, and size
**Observed Behavior:**
The unsupported inline MIME part is forwarded as-is and the next request fails with `Unsupported MIME Type`.
**Environment Details:**
- ADK Library Version: latest `main`
- OS: macOS
- Go Version: 1.22+
**Model Information:**
- gemini-2.5-pro / gemini-2.5-flash
---
## Optional Information
Patch ready that mirrors the adk-python fix. Covers CSV, PDF (kept inline), unsupported binary, no-data, and empty-MIME fallback paths in tests.
Contributor guide
Research direction
Start at LoadArtifactsTool’s artifact-loading path and inspect where inline MIME parts are appended to the next model request. Use the existing artifact-loading tests, including the CSV, PDF, unsupported-binary, no-data, and empty-MIME cases; done means supported media remains inline, text-like data becomes text, and unsupported binary data gets a descriptive placeholder.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- ai
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100