Builds a resource MCP content block. The resource argument is the embedded resource content (typically a struct with a uri and the resource payload). The block passes through the automatic result coercion untouched, so use it when a tool wants exact control over what the client renders.
mcpResource( resource )
→ returns struct
Embed a resource directly in a tool response.
function page() tool="page" {
var bytes = fileRead( expandPath( "/pages/intro.txt" ) );
return mcpResource( {
uri = "doc://pages/intro",
mimeType = "text/plain",
text = toString( bytes )
} );
}
Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.