Send prepared media
send_mediaSends media to an in-scope Telegram chat using an opaque handle from prepare_media instead of a filesystem path, with optional caption, forum topic, and idempotency key.
Instructions
Phase 2 of the two-phase media send. Send media to a single in-scope chat using ONLY an opaque handle from prepare_media (no filesystem path is accepted). The target must be inside this endpoint scope; out-of-scope peers, and expired or mismatched handles, are rejected. Subject to the per-endpoint anti-ban quota and, when enabled, human confirmation. An optional idempotency key gives BEST-EFFORT retry de-dup (in-memory, per-process; reset on restart/policy change and NOT covering a send Telegram accepted but reported as failed) — do not assume a retry is safe.
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": {
"peer": "<peer>",
"handle": "<handle>"
},
"name": "send_media"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| peer | Yes | Chat reference: { kind:'id', value:'<decimal id>' } | { kind:'username', value:'@name' } | { kind:'me' }. | |
| handle | Yes | Opaque handle returned by prepare_media. Pass it back verbatim. It is bound to this session, this endpoint scope, and a short TTL; expired or mismatched handles are rejected. Never pass a filesystem path here. | |
| caption | No | Optional media caption, up to 1024 characters. | |
| topicId | No | Post into this forum topic of a forum supergroup (see list_topics). | |
| idempotencyKey | No | Optional caller-supplied idempotency key (url-safe). Reusing it on a retry gives BEST-EFFORT, in-memory de-dup only (not guaranteed across restarts, policy changes, or a send Telegram accepted but reported as failed). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chat_id | Yes | Chat the message was sent to. | |
| sent_at | Yes | Server-acknowledged send instant. | |
| message_id | Yes | Id of the newly created message. | |
| idempotency_key | Yes | The random_id used for idempotent dedup; echoed for traceability. |