Skip to content

feat(vscode): add image attachment path mode for MCP file path handling#8818

Open
Brightlyviryaa wants to merge 3 commits intoKilo-Org:mainfrom
Brightlyviryaa:feat/image-attachment-path-mode
Open

feat(vscode): add image attachment path mode for MCP file path handling#8818
Brightlyviryaa wants to merge 3 commits intoKilo-Org:mainfrom
Brightlyviryaa:feat/image-attachment-path-mode

Conversation

@Brightlyviryaa
Copy link
Copy Markdown

Context

Add a configurable kilo-code.new.attachments.imageMode setting to control how attached images are sent to the CLI backend. When set to "path", images are saved as temp files and sent as file:// URLs instead of base64 data URLs. This enables smooth integration with MCP servers (like Z.AI image understanding) that expect file paths rather than raw image data.

Implementation

The implementation adds a new VS Code configuration setting attachments.imageMode with two values:

  • "data" (default): current behavior, sends data: URLs
  • "path": saves images to temp files (vscode.env.tempFilesStoragePath) and sends file:// URLs

Flow for path mode:

  1. User pastes/drops an image
  2. Webview sends saveImageToTemp message with base64 data
  3. Extension saves to temp dir and responds with imageSaved containing file:// path
  4. Image is attached to message using the file path

Key changes:

  • KiloProvider.ts: handles saveImageToTemp and requestImageMode messages
  • ImageModeContext.tsx: new context for reactive image mode state
  • useImageAttachments.ts: conditionally sends to temp or reads as dataURL based on mode
  • PromptInput.tsx: listens for imageSaved messages to handle async path responses

How to Test

  1. Open VS Code with the extension in dev mode (bun run extension)
  2. Paste a screenshot into the chat with default settings (should send base64)
  3. Go to VS Code settings and set kilo-code.new.attachments.imageMode to "path"
  4. Paste another screenshot — it should now be sent as a file:// path
  5. Verify the behavior differs based on the setting

Get in Touch

Brightlyviryaa on Kilo Code Discord

@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot bot commented Apr 13, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 files)
  • packages/kilo-vscode/src/KiloProvider.ts

Reviewed by gpt-5.4-20260305 · 573,491 tokens

- Add onDidChangeConfiguration listener to update webview when setting changes
- Pass correct mime type through imageSaved message
- Use filePath as-is (uri.toString() already includes file:// prefix)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant