Model Context Protocol – Advanced Patterns for Production

Lesson 2: Notifications and Real-Time Updates

Lesson Objectives

By the end of this lesson, students should be able to:

  • Explain the MCP notification model and when to use it
  • Implement resource change notifications in a server
  • Implement tool list change notifications
  • Design a server that uses notifications appropriately vs. on-demand tool calls

Lesson Content

What notifications are.

MCP notifications are server-to-client messages that do not require a response. They inform the client that something has changed – a resource has been updated, the tool list has changed, a long-running operation has progressed. Clients can act on notifications or ignore them based on their implementation.

When to use notifications vs. polling.

Without notifications, clients poll the server for changes – sending list_resources or list_tools requests periodically to check for updates. For resources that change infrequently, polling wastes transport overhead. For resources that change frequently, polling may miss changes between intervals.

Notifications are appropriate when:

  • Resources change at irregular intervals that polling cannot efficiently cover
  • Tool availability changes dynamically (a tool becomes available or unavailable at runtime)
  • A long-running tool call should report progress before completing

Resource change notifications.

# Notify client that a resource has changed
await app.notify_resource_updated("docs://api-reference")

# Notify client that the resource list has changed
await app.notify_resources_list_changed()

Clients that receive a resource update notification can re-read the resource to get fresh content. Clients that receive a resource list changed notification can re-request the resource list.

Tool list change notifications.

# Notify client that the available tools have changed
await app.notify_tools_list_changed()

Use this when your server dynamically enables or disables tools based on state – for example, a tool that is only available after the user has authenticated, or a tool that is disabled when a dependent service is unavailable.

Progress notifications for long-running tools.

For tools that take significant time (database migrations, large file processing, report generation), progress notifications let the client track status without the tool call blocking:

# Send progress update during a long tool execution
await app.notify_progress(token, current=50, total=100)

Clients can surface progress to the user in real time. Verify current progress notification API at modelcontextprotocol.io.

Enroll to continue this lesson.

The preview above shows the lesson objectives and opening lesson content. Enroll to view the full lesson, complete the practice work, and take the lesson quiz.

Log In / Create Account
Back to Course