imageContent()
Create image content from a buffer, file path, or URL.Parameters
Image source (must provide exactly one)
Returns
Image content object
Features
- Auto-detection: Automatically detects MIME type using
file-typepackage - Base64 encoding: Converts image data to base64 for MCP protocol
- Format validation: Warns if content doesn’t appear to be a valid image
- Error handling: Clear error messages for fetch failures, file read errors
Supported Formats
Any image format supported by thefile-type package:
- PNG (
.png) - JPEG (
.jpg,.jpeg) - GIF (
.gif) - WebP (
.webp) - SVG (
.svg) - BMP (
.bmp) - ICO (
.ico) - And many more…
Error Handling
audioContent()
Create audio content from a buffer, file path, or URL.Parameters
Audio source (must provide exactly one)
Returns
Audio content object
Features
- Auto-detection: Automatically detects MIME type using
file-typepackage - Base64 encoding: Converts audio data to base64 for MCP protocol
- Format validation: Warns if content doesn’t appear to be valid audio
- Error handling: Clear error messages for fetch failures, file read errors
Supported Formats
Any audio format supported by thefile-type package:
- MP3 (
.mp3) - WAV (
.wav) - OGG (
.ogg) - FLAC (
.flac) - AAC (
.aac) - M4A (
.m4a) - OPUS (
.opus) - And more…