mcpAudio

Builds an audio MCP content block. data is a base64-encoded string of the audio bytes and mimeType is the audio's MIME type (e.g. "audio/mpeg"). The block passes through the automatic result coercion untouched, so use it when a tool wants exact control over what the client renders. An omitted mimeType is left out rather than written as null.

mcpAudio( data [, mimeType] ) → returns struct

This function requires RustCFML.  Not supported on Lucee, Adobe ColdFusion, etc.

Argument Reference

data string
Required

Base64-encoded audio bytes.

mimeType string

The MIME type of the audio, e.g. "audio/mpeg".

Links more information about mcpAudio

Examples
Sample code invoking the mcpAudio function

A tool can return an explicit audio block alongside a text block.

function greeting() tool="greeting" {
    var bytes = synthesizeGreeting();
    return [
        mcpText( "Your greeting is ready:" ),
        mcpAudio( toBase64( bytes ), "audio/mpeg" )
    ];
}

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub