A resource is readable content an MCP server publishes at a URI. Where a
tool does something and a prompt asks something, a resource simply is
something a client can list and fetch: a settings document, a customer record,
a log, the file currently open in the editor. TTMSMCPResource covers the whole
surface: direct resources at a fixed URI, template resources that cover a whole
family of URIs, text and base64 binary content, per-instance MIME types, display
titles and icons, runtime listing, list-changed notifications, and per-URI
subscriptions that tell a client its copy is stale.
Fluent builder for declaring a resource in a single expression.
Minimal example
procedure TForm1.RegisterSettingsResource;
begin
{ Server is a TTMSMCPServer dropped on the form. }
Server.Resources.RegisterDirectResource(
'app_settings',
'config://application/settings',
'Current application settings',
'application/json',
function(const URI: string): TTMSMCPResourceContent
begin
{ Create a fresh content object per read. The framework serializes
it and frees it - do not free it here and do not cache it. }
Result := TTMSMCPResourceContent.FromText(URI, 'application/json',
SettingsAsJSON);
end);
end;