File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -75,6 +75,7 @@ export interface ClientMetrics {
7575 isConnected : boolean ;
7676 activeConnections : number ;
7777 totalConnections : number ;
78+ toolCallCount : number ;
7879}
7980
8081/**
@@ -224,6 +225,7 @@ export interface TransportMetricsResponse {
224225 isConnected : boolean ;
225226 activeConnections : number ;
226227 totalConnections : number ;
228+ toolCallCount : number ;
227229 } > ;
228230
229231 sessions : SessionData [ ] ;
@@ -525,6 +527,7 @@ export class MetricsCounter {
525527 isConnected : true ,
526528 activeConnections : 1 ,
527529 totalConnections : 1 ,
530+ toolCallCount : 0 ,
528531 } ;
529532 this . metrics . clients . set ( clientKey , clientMetrics ) ;
530533 } else {
@@ -608,6 +611,15 @@ export class MetricsCounter {
608611 }
609612
610613 clientMethodMetrics . count ++ ;
614+
615+ // If this is a tool call, increment the client's tool call count
616+ if ( method . startsWith ( 'tools/call:' ) ) {
617+ const clientKey = getClientKey ( clientInfo . name , clientInfo . version ) ;
618+ const clientMetrics = this . metrics . clients . get ( clientKey ) ;
619+ if ( clientMetrics ) {
620+ clientMetrics . toolCallCount ++ ;
621+ }
622+ }
611623 }
612624
613625 if ( isError ) {
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ type ClientData = {
1717 isConnected : boolean ;
1818 lastSeen : string ;
1919 firstSeen : string ;
20+ toolCallCount : number ;
2021} ;
2122
2223/**
@@ -102,6 +103,11 @@ export function StatelessTransportMetrics({ metrics }: StatelessTransportMetrics
102103 header : createSortableHeader ( 'Initializations' , 'right' ) ,
103104 cell : ( { row } ) => < div className = "text-right font-mono text-sm" > { row . getValue < number > ( 'requestCount' ) } </ div > ,
104105 } ,
106+ {
107+ accessorKey : 'toolCallCount' ,
108+ header : createSortableHeader ( 'Tool Calls' , 'right' ) ,
109+ cell : ( { row } ) => < div className = "text-right font-mono text-sm" > { row . getValue < number > ( 'toolCallCount' ) } </ div > ,
110+ } ,
105111 {
106112 accessorKey : 'isConnected' ,
107113 header : createSortableHeader ( 'Status' ) ,
You can’t perform that action at this time.
0 commit comments