How does the client handle logging and progress callbacks?
MCP Advanced: Logging, Progress Notifications, Context Methods for Long Tasks
Audio flashcard · 0:29Nortren·
How does the client handle logging and progress callbacks?
0:29
The client handles these by defining two separate callback functions. The logging callback receives a LoggingMessageNotificationParams object and can print or display the log data however the application needs. The progress callback receives progress, total, and message parameters and can calculate percentages or update UI elements. You pass the logging callback when creating the ClientSession, and the progress callback when making individual tool calls via the call_tool method. This separation lets you handle different notification types independently.
github.com