setLoggingLevel method
Future<void>
setLoggingLevel(
- McpLogLevel level, {
- Map<
String, dynamic> ? meta, - RequestOptions? options,
Set the logging level for the server
In the modern era (2026-07-28) there is no session to set: the level is
sent as _meta logLevel on every later request instead.
Implementation
Future<void> setLoggingLevel(McpLogLevel level,
{Map<String, dynamic>? meta, RequestOptions? options}) async {
if (!_initialized) {
throw McpError('Client is not initialized');
}
if (_statelessMode) {
_logLevel = level;
return;
}
// Spec method name is camelCase: `logging/setLevel`.
await _sendRequest(
'logging/setLevel', _withMeta({'level': level.name}, meta), options);
}