Skip to content

[WIP] add events for dart mcp server tool invocations #2112

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pkgs/unified_analytics/lib/src/enums.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ enum DashEvent {
description: 'Pub package resolution details',
toolOwner: DashTool.dartTool,
),
dartMCPEvent(
label: 'dart_mcp_server',
description: 'Information for a Dart MCP server event',
toolOwner: DashTool.dartTool,
),

// Events for Flutter devtools

Expand Down
26 changes: 26 additions & 0 deletions pkgs/unified_analytics/lib/src/event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -905,6 +905,32 @@ final class Event {
},
);

/// Event that is sent from the Dart MCP server when a tool is invoked.
///
/// The [client] is the name of the client, as given when it connected to the
/// MCP server, and [clientVersion] is the version of the client.
///
/// The [serverVersion] is the version of the Dart MCP server.
///
/// The [type] identifies the kind of event this is, and [eventData] is the
/// actual data for that event.
Event.dartMCPEvent({
required String client,
required String clientVersion,
required String serverVersion,
required String type,
CustomMetrics? additionalData,
}) : this._(
eventName: DashEvent.dartMCPEvent,
eventData: {
'client': client,
'clientVersion': clientVersion,
'serverVersion': serverVersion,
'type': type,
...?additionalData?.toMap(),
},
);

@override
int get hashCode => Object.hash(eventName, jsonEncode(eventData));

Expand Down
Loading