Prepare media for sending
prepare_mediaStage a local media file and receive an opaque, time-limited handle for send_media, while the server confines paths to the permitted upload area and enforces size limits.
Instructions
Phase 1 of the two-phase media send. Stage a local file and receive an opaque, time-limited handle bound to this session and endpoint scope. The server confines the path to the permitted upload area and caps its size; files in the downloads directory are refused. Pass the returned handle to send_media; you never re-supply the raw path.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"localPath": "<localPath>"
},
"name": "prepare_media"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| localPath | Yes | Local filesystem path to the media file to stage for upload. Accepted ONLY here (phase 1); the server confines it to the allowed upload area, size-caps it, and returns an opaque, time-limited handle. You never pass a raw path to send_media. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| handle | Yes | Opaque, time-limited media handle bound to this session and scope; pass it to send_media verbatim. | |
| mime_type | Yes | Locally sniffed MIME type (trusted; not Telegram-originated). | |
| expires_at | Yes | Instant the handle expires (TTL). | |
| size_bytes | Yes | Staged file size in bytes. |