Skip to main content
The Model Context Protocol allows clients to get notified when a resource has changed. This allows clients to do things like refresh the LLMs context when an underlying resource has changed. Lets say you have some application logs in a resource, the server could periodically refresh the application log resource to allow the client to get latest logs.

Implementation

In mcp-golang, the server will send a notification to the client when any of the following events occur:
  • A new tool is registered via the RegisterTool function
  • A new prompt is registered via the RegisterPrompt function
  • A new resource is registered via the RegisterResource function
  • A prompt is deregistered via the DeregisterPrompt function
  • A tool is deregistered via the DeregisterTool function
  • A resource is deregistered via the DeregisterResource function
A silly e2e example of this is the server below. It registers and deregisters a tool, prompt, and resource every second causing 3 notifications to be sent to the client each second.