Overview
Many ABP capabilities produce or consume binary data:
ABP defines standard formats for representing and transferring binary data across different transports.
Why Binary Handling Needs Standardization
Without standardization, each app implements binary handling differently, making agents unable to reliably consume binary responses.Design Decisions
What We Explicitly Chose NOT to Do
- No streaming — Adds complexity, most browser operations produce complete files
- No chunked transfer — Can be added later if large file handling proves insufficient
- No compression requirement — Apps MAY compress, but it’s not mandated
- No binary WebSocket frames in v1 — Base64 is simpler and sufficient for most cases
BinaryData Format
Binary data in ABP responses uses a standard wrapper:Example Response with Binary Data
mimeTypeis REQUIRED — agents need this to handle data correctlyencodingis REQUIRED when content is a string — tells the agent how to decodesizeis RECOMMENDED — helps agents allocate buffers and show progressfilenameis OPTIONAL — provides a sensible default for saving
BinaryDataReference (Large Files)
For files larger than a reasonable threshold (recommended: 10MB), apps SHOULD provide a download URL instead of inline content:Example Large File Response
Agent Handling
Transport-Specific Handling
Each transport has different capabilities for binary data:Puppeteer/Playwright Transport
Puppeteer supports direct binary transfer via structured cloning:postMessage Transport
postMessage supports structured cloning with transferable objects (zero-copy):WebSocket Transport
WebSocket uses Base64 encoding for JSON compatibility:Transport Comparison
Binary Input
Some capabilities accept binary input (e.g., image processing):For Puppeteer/postMessage
Agents MAY send ArrayBuffer directly:Capability Schema Conventions
Capabilities that produce binary output SHOULD document this in their schema:Best Practices
For App Developers
- Always include
mimeType— Agents need this to handle the data correctly - Include
sizewhen known — Helps agents allocate buffers and show progress - Use
downloadUrlfor files > 10MB — Avoids memory issues - Set reasonable
expiresAtfor download URLs (1 hour minimum recommended) - For WebSocket, always set
encoding: 'base64'when content is Base64
Example: Size-Based Routing
For Agent/Client Developers
- Check for
downloadUrlfirst — Handle large files appropriately - Verify
sizematches actual content when provided - Use
filenamefor saving if provided, generate sensible default otherwise - Handle both inline content and download URLs transparently
Union Type
For TypeScript implementations, use a union type:Next Steps
Data Flow
MCP Bridge’s client-side routing logic
Building ABP Apps
Build your first ABP app
API Reference
Full API specification