current property

Map<String, dynamic>? get current

The _meta object of the request in flight, or null when the request carried none or the code is not running inside a request.

Handler signatures carry no request context, so the server publishes the request _meta on the zone for the whole dispatch — tools, resources, prompts, completion and list handlers all see it. Keys outside the reserved io.modelcontextprotocol/* prefix belong to the application (e.g. a forwarding host relaying its caller's context); read them with a namespaced key. The map is read-only.

Implementation

static Map<String, dynamic>? get current {
  final v = Zone.current[_currentZoneKey];
  return v is Map<String, dynamic> ? v : null;
}