TsgcWSAPIClient_MCPMethods › SubscribeResource

SubscribeResource Method

Subscribes to change notifications for a specific resource (resources/subscribe).

Syntax

procedure SubscribeResource(const aUri: string);

Parameters

NameTypeDescription
aUriconst stringURI of the resource to watch. Must match one of the URIs advertised by the server in its resources/list catalogue.

Remarks

Sends the JSON-RPC resources/subscribe request. When the server detects that the resource has changed it dispatches a notifications/resources/updated notification which the component surfaces through the OnMCPResourcesUpdated handler. Call RequestResource inside the notification to pull the fresh payload. The server must advertise the resources.subscribe capability during initialize; otherwise the request fails with a JSON-RPC error.

Example

MCP.SubscribeResource('file:///project/config.yaml');

Back to Methods