Whatever message this page gives is out now! Go check it out!

Work with resources

Last update:
May 18, 2026
Learn how to discover and read resources exposed by an MCP server using a ColdFusion client.
Resources are read-only objects such as files, logs, or domain-specific data that the MCP server exposes to clients.
You can list available resources and read their contents if they are accessible.
  1. List available resources using listResources().
    ADDITIONAL INFORMATION:
<cfscript>
resources = mcpClient.listResources();
writeDump(resources);
</cfscript>
  1. Read a specific resource using readResource(uri).
    ADDITIONAL INFORMATION:
<cfscript>
uri = "file:///logs/app.log";
if (mcpClient.isResourceReadable(uri)) {
  resData = mcpClient.readResource(uri);
  logText = "";
  if (arrayLen(resData.contents) GT 0 && structKeyExists(resData.contents[1], "text")) {
    logText = resData.contents[1].text;
  }
  writeOutput("<pre>" & encodeForHtml(logText) & "</pre>");
} else {
  writeOutput("Resource not readable: " & uri);
}
</cfscript>
  1. Use isResourceReadable(uri) to verify access before attempting to read the resource.
Result
You can now inspect and retrieve read-only data exposed by the MCP server.

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page