Copy an existing local file into the current session directory and return a direct download link.
share_file and content_publish are different tools:
share_file = copy a local file into session_files/{session_id}/ + return a download link.content_publish = register a file that is already in session_files/{session_id}/ + show it as an inline viewer/card.Use share_file when the user should keep/download the file. Use content_publish when the user should inspect it directly in chat.
Call this any time you produce a file the user will want to keep:
Do not use this just to create an inline preview. For SVG/HTML/PDF/image/video/STL preview cards, put the file in the session directory and call content_publish.
session_files/{session_id}/ by default./sessions/{session_id}/files/{filename}.Maximum file size: SHARE_FILE_MAX_SIZE_MB, default 1024 MB (1 GB).
| Parameter | Required | Description |
|---|---|---|
path |
yes | Absolute path to the file on disk |
filename |
no | Clean download name shown to the user (defaults to the original filename) |
path must be an absolute filesystem path. A relative path like game_project.zip or workspace/report.csv is rejected.
Option 1 — you just wrote the file with filesystem or terminal, you know the full path:
path: "/home/gmikcon/Projects/navi-1/workspace/game_project.zip"
Option 2 — you only have a relative path, resolve it first:
terminal(command="realpath game_project.zip") # → /home/gmikcon/Projects/navi-1/game_project.zip
Option 3 — use filesystem(action="info", path="workspace/game_project.zip") — the result includes the absolute path.
On success the tool returns:
Download ready: game_project.zip (4.2 MB) URL: http://server:8000/sessions/abc123/files/game_project.zip
You must include the URL in your reply to the user. Format it as a markdown link:
Here's your file: [game_project.zip](http://server:8000/sessions/abc123/files/game_project.zip)
Do not just say "the file is ready" without the link. The user cannot find the URL themselves.
# 1. Create the archive terminal(command="cd /home/gmikcon/Projects && zip -r /tmp/game_project.zip game_project/") # 2. Share it — use the absolute path from step 1 share_file(path="/tmp/game_project.zip", filename="game_project.zip") # 3. In your reply: "Here's the archive: [game_project.zip](http://...)"
| Wrong | Right |
|---|---|
path: "game_project.zip" |
path: "/home/gmikcon/Projects/navi-1/game_project.zip" |
path: "workspace/report.csv" |
path: "/home/gmikcon/Projects/navi-1/workspace/report.csv" |
| Saying "the file is ready" without the link | Posting the URL as a markdown link |
Calling share_file for an inline SVG/HTML preview |
Put the file in session dir and call content_publish |