MCPcopy Create free account
hub / github.com/modelcontextprotocol/go-sdk / Subscribe

Method Subscribe

mcp/client.go:1027–1030  ·  view source on GitHub ↗

Subscribe sends a "resources/subscribe" request to the server, asking for notifications when the specified resource changes.

(ctx context.Context, params *SubscribeParams)

Source from the content-addressed store, hash-verified

1025// Subscribe sends a "resources/subscribe" request to the server, asking for
1026// notifications when the specified resource changes.
1027func (cs *ClientSession) Subscribe(ctx context.Context, params *SubscribeParams) error {
1028 _, err := handleSend[*emptyResult](ctx, methodSubscribe, newClientRequest(cs, orZero[Params](params)))
1029 return err
1030}
1031
1032// Unsubscribe sends a "resources/unsubscribe" request to the server, cancelling
1033// a previous subscription.

Callers 1

TestEndToEndFunction · 0.80

Calls 1

newClientRequestFunction · 0.85

Tested by 1

TestEndToEndFunction · 0.64