Action payload · devices:media
media_chunk
Send ordered chunks for one upload UUID, starting at index 0. chunkIndex 0..199 and must be below chunkCount; chunkCount 1..200 and cannot exceed totalBytes; totalBytes 1..104,857,600 (100 MiB); each complete padded base64 string is at most 1,400,000 characters and its decoded bytes cannot exceed totalBytes. A single chunk must decode to exactly totalBytes. These cross-field checks return VALIDATION and are not fully represented by OpenAPI. Keep metadata consistent and use a separate requestId for each chunk. Use complete real file bytes: this example is only a PNG header. Intermediate acknowledgements are staged; final success is imported. The CLI uses 1 MiB byte chunks and renews the session.
Payload
{
"type": "media_chunk",
"uploadId": "d7be57c2-1912-433f-a540-4606b073e81c",
"chunkIndex": 0,
"chunkCount": 1,
"totalBytes": 8,
"fileName": "image.png",
"mime": "image/png",
"dataB64": "iVBORw0KGgo="
}Payload fields
typestringrequiredDiscriminator that selects the action or content shape.
"media_chunk"uploadIdstringrequiredOne UUID shared by all chunks of the same upload.
"d7be57c2-1912-433f-a540-4606b073e81c"chunkIndexintegerrequiredZero-based chunk index. Send in order, beginning at 0; it must be smaller than chunkCount.
0chunkCountintegerrequiredTotal chunks in this upload. Must not exceed totalBytes; keep it constant across chunks.
1totalBytesintegerrequiredDecoded byte size of the complete file. A one-chunk upload must decode to exactly this length.
8fileNamestringrequiredDestination filename with a matching media extension. Path separators are not allowed.
"image.png"Validation pattern
^[A-Za-z0-9][A-Za-z0-9._ -]*$mimestringrequiredMedia MIME type. It must match the actual source bytes.
"image/jpeg""image/png""video/mp4"dataB64stringrequiredComplete padded base64 bytes without a data URL prefix. Use the complete file or the current ordered chunk.
"iVBORw0KGgo="Validation pattern
^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$Unknown fields are rejected.
View JSON Schema
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"media_chunk"
],
"description": "Discriminator that selects the action or content shape."
},
"uploadId": {
"type": "string",
"format": "uuid",
"description": "One UUID shared by all chunks of the same upload."
},
"chunkIndex": {
"type": "integer",
"minimum": 0,
"maximum": 199,
"description": "Zero-based chunk index. Send in order, beginning at 0; it must be smaller than chunkCount."
},
"chunkCount": {
"type": "integer",
"minimum": 1,
"maximum": 200,
"description": "Total chunks in this upload. Must not exceed totalBytes; keep it constant across chunks."
},
"totalBytes": {
"type": "integer",
"minimum": 1,
"maximum": 104857600,
"description": "Decoded byte size of the complete file. A one-chunk upload must decode to exactly this length."
},
"fileName": {
"type": "string",
"minLength": 1,
"maxLength": 160,
"pattern": "^[A-Za-z0-9][A-Za-z0-9._ -]*$",
"description": "Destination filename with a matching media extension. Path separators are not allowed."
},
"mime": {
"type": "string",
"enum": [
"image/jpeg",
"image/png",
"video/mp4"
],
"description": "Media MIME type. It must match the actual source bytes."
},
"dataB64": {
"type": "string",
"minLength": 4,
"maxLength": 1400000,
"pattern": "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$",
"description": "Complete padded base64 bytes without a data URL prefix. Use the complete file or the current ordered chunk."
}
},
"required": [
"type",
"uploadId",
"chunkIndex",
"chunkCount",
"totalBytes",
"fileName",
"mime",
"dataB64"
],
"additionalProperties": false,
"description": "Send ordered chunks for one upload UUID, starting at index 0. chunkIndex 0..199 and must be below chunkCount; chunkCount 1..200 and cannot exceed totalBytes; totalBytes 1..104,857,600 (100 MiB); each complete padded base64 string is at most 1,400,000 characters and its decoded bytes cannot exceed totalBytes. A single chunk must decode to exactly totalBytes. These cross-field checks return VALIDATION and are not fully represented by OpenAPI. Keep metadata consistent and use a separate requestId for each chunk. Use complete real file bytes: this example is only a PNG header. Intermediate acknowledgements are staged; final success is imported. The CLI uses 1 MiB byte chunks and renews the session.",
"example": {
"type": "media_chunk",
"uploadId": "d7be57c2-1912-433f-a540-4606b073e81c",
"chunkIndex": 0,
"chunkCount": 1,
"totalBytes": 8,
"fileName": "image.png",
"mime": "image/png",
"dataB64": "iVBORw0KGgo="
}
}REST wraps this payload inside {requestId, command}. The matching MCP tool takes sessionId and requestId plus these fields, without the type discriminator.
Contract
Submit this as command to POST /sessions/{sessionId}/actions, pass it as the CLI action JSON, or use the matching MCP convenience tool. Command objects are strict and reject unknown fields.
Execution
Send ordered chunks for one upload UUID, starting at index 0. chunkIndex 0..199 and must be below chunkCount; chunkCount 1..200 and cannot exceed totalBytes; totalBytes 1..104,857,600 (100 MiB); each complete padded base64 string is at most 1,400,000 characters and its decoded bytes cannot exceed totalBytes. A single chunk must decode to exactly totalBytes. These cross-field checks return VALIDATION and are not fully represented by OpenAPI. Keep metadata consistent and use a separate requestId for each chunk. Use complete real file bytes: this example is only a PNG header. Intermediate acknowledgements are staged; final success is imported. The CLI uses 1 MiB byte chunks and renews the session.
Action status and driver result remain separate. A completed result can still require a fresh screenshot or hierarchy check to prove the intended visible effect.
Edge cases
- Cross-field validation requires chunkIndex < chunkCount, chunkCount <= totalBytes, decoded chunk bytes <= totalBytes, and exact decoded byte equality when chunkCount is 1.
- OpenAPI expresses field bounds but cannot fully express these byte relationships. Runtime VALIDATION issues are authoritative.
