Media
Media tools manage file attachments linked to coverage items. Files are stored in Supabase Storage (pr-media bucket) and metadata is tracked in the media table.
The upload flow is two-step:
- Call
upload_media_urlto get a presigned upload URL. - Upload the file to that URL using HTTP PUT.
- Call
attach_mediato record the metadata.
upload_media_url
Get a presigned upload URL for media attached to a coverage item.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| coverage_id | string (UUID) | Yes | Coverage item to attach media to |
| filename | string | Yes | Original filename |
| mime_type | string | Yes | MIME type (e.g. video/mp4, application/pdf) |
Example
json
{
"name": "upload_media_url",
"arguments": {
"coverage_id": "550e8400-e29b-41d4-a716-446655440000",
"filename": "interview-clip.mp4",
"mime_type": "video/mp4"
}
}Response Shape
json
{
"media_id": "...",
"upload_url": "https://...",
"storage_path": "coverage-id/media-id/interview-clip.mp4",
"token": "...",
"instructions": "Upload your file to the upload_url using PUT with the appropriate Content-Type header. Then call attach_media to save the metadata."
}attach_media
Record media metadata after uploading to storage.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| coverage_id | string (UUID) | Yes | Coverage ID |
| type | string | Yes | article_pdf, video, video_clip, audio, audio_clip, image, document |
| filename | string | Yes | Original filename |
| storage_path | string | Yes | Path returned from upload_media_url |
| mime_type | string | Yes | MIME type |
| size_bytes | number | No | File size in bytes |
| duration_seconds | number | No | Duration for audio/video files |
| metadata | object | No | Additional metadata as key-value pairs |
Example
json
{
"name": "attach_media",
"arguments": {
"coverage_id": "550e8400-e29b-41d4-a716-446655440000",
"type": "video_clip",
"filename": "interview-clip.mp4",
"storage_path": "550e8400.../abc123.../interview-clip.mp4",
"mime_type": "video/mp4",
"size_bytes": 15728640,
"duration_seconds": 120
}
}get_media
Get media details and a temporary download URL (valid for 1 hour).
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | string (UUID) | Yes | Media ID |
Example
json
{
"name": "get_media",
"arguments": {
"id": "550e8400-e29b-41d4-a716-446655440000"
}
}list_media
List media for a coverage item.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| coverage_id | string (UUID) | Yes | Coverage ID |
| include_archived | boolean | No | Include archived media (default: false) |
Example
json
{
"name": "list_media",
"arguments": {
"coverage_id": "550e8400-e29b-41d4-a716-446655440000"
}
}