TsgcWSAPIClient_MCP › Events › OnMCPResourcesUpdated

OnMCPResourcesUpdated Event

Fires when a watched resource changed (notifications/resources/updated).

Syntax

property OnMCPResourcesUpdated: TsgcAI_MCP_Client_OnResourcesUpdatedEvent;
// TsgcAI_MCP_Client_OnResourcesUpdatedEvent = procedure(Sender: TObject; const aNotification: TsgcAI_MCP_Notification_Resources_Updated) of object

Default Value

—

Remarks

The server sends notifications/resources/updated to a subscription that watches the resource, or to a legacy session that called resources/subscribe. aNotification.Uri is the URI of the changed resource; call RequestResource to read the new content.

With the HTTP transports the event runs in a background thread; use TThread.Queue or TThread.Synchronize to update visual controls. See Subscriptions.

Example

procedure TMainForm.MCPResourcesUpdated(Sender: TObject;
  const aNotification: TsgcAI_MCP_Notification_Resources_Updated);
begin
  Log('updated ' + aNotification.Uri);
  MCP.RequestResource(aNotification.Uri);
end;

Back to Events