@@ -18,6 +18,7 @@ import { requireAuth } from "../requireAuth.js";
18
18
import { Options } from "../options.js" ;
19
19
import { getProjectId } from "../projectUtils.js" ;
20
20
import { mcpAuthError , NO_PROJECT_ERROR } from "./errors.js" ;
21
+ import { trackGA4 } from "../track.js" ;
21
22
import { Config } from "../config.js" ;
22
23
23
24
const SERVER_VERSION = "0.0.1" ;
@@ -62,6 +63,7 @@ export class FirebaseMcpServer {
62
63
63
64
async mcpListTools ( ) : Promise < ListToolsResult > {
64
65
const hasActiveProject = ! ! ( await this . getProjectId ( ) ) ;
66
+ await trackGA4 ( "mcp_list_tools" , { } ) ;
65
67
return {
66
68
tools : this . availableTools . map ( ( t ) => t . mcp ) ,
67
69
_meta : {
@@ -117,8 +119,15 @@ export class FirebaseMcpServer {
117
119
118
120
try {
119
121
const config = Config . load ( { cwd : this . projectRoot } ) ;
120
- return tool . fn ( toolArgs , { projectId : await this . getProjectId ( ) , host : this , config } ) ;
122
+ const res = await tool . fn ( toolArgs , {
123
+ projectId : await this . getProjectId ( ) ,
124
+ host : this ,
125
+ config,
126
+ } ) ;
127
+ await trackGA4 ( "mcp_tool_call" , { tool_name : toolName , error : res . isError ? 1 : 0 } ) ;
128
+ return res ;
121
129
} catch ( err : unknown ) {
130
+ await trackGA4 ( "mcp_tool_call" , { tool_name : toolName , error : 1 } ) ;
122
131
return mcpError ( err ) ;
123
132
}
124
133
}
0 commit comments