@@ -46,7 +46,7 @@ export abstract class ToolBase {
4646 logger . debug ( LogId . toolExecute , "tool" , `Executing ${ this . name } with args: ${ JSON . stringify ( args ) } ` ) ;
4747
4848 const result = await this . execute ( ...args ) ;
49- await this . emitToolEvent ( startTime , result , ...args ) ;
49+ await this . emitToolEvent ( startTime , result , ...args ) . catch ( ( ) => { } ) ;
5050 return result ;
5151 } catch ( error : unknown ) {
5252 logger . error ( LogId . toolExecuteFailure , "tool" , `Error executing ${ this . name } : ${ error as string } ` ) ;
@@ -143,38 +143,33 @@ export abstract class ToolBase {
143143 ...args : Parameters < ToolCallback < typeof this . argsShape > >
144144 ) : TelemetryToolMetadata {
145145 const toolMetadata : TelemetryToolMetadata = { } ;
146- try {
147- if ( ! args . length ) {
148- return toolMetadata ;
149- }
146+ if ( ! args . length ) {
147+ return toolMetadata ;
148+ }
150149
151- // Create a typed parser for the exact shape we expect
152- const argsShape = z . object ( this . argsShape ) ;
153- const parsedResult = argsShape . safeParse ( args [ 0 ] ) ;
154-
155- if ( ! parsedResult . success ) {
156- logger . debug (
157- LogId . telmetryMetadataError ,
158- "tool" ,
159- `Error parsing tool arguments: ${ parsedResult . error . message } `
160- ) ;
161- return toolMetadata ;
162- }
150+ // Create a typed parser for the exact shape we expect
151+ const argsShape = z . object ( this . argsShape ) ;
152+ const parsedResult = argsShape . safeParse ( args [ 0 ] ) ;
163153
164- const data = parsedResult . data ;
154+ if ( ! parsedResult . success ) {
155+ logger . debug (
156+ LogId . telmetryMetadataError ,
157+ "tool" ,
158+ `Error parsing tool arguments: ${ parsedResult . error . message } `
159+ ) ;
160+ return toolMetadata ;
161+ }
165162
166- // Extract projectId using type guard
167- if ( "projectId" in data && typeof data . projectId === "string" && data . projectId . trim ( ) !== "" ) {
168- toolMetadata . projectId = data . projectId ;
169- }
163+ const data = parsedResult . data ;
170164
171- // Extract orgId using type guard
172- if ( "orgId" in data && typeof data . orgId === "string" && data . orgId . trim ( ) !== "" ) {
173- toolMetadata . orgId = data . orgId ;
174- }
175- } catch ( error ) {
176- const errorMessage = error instanceof Error ? error . message : String ( error ) ;
177- logger . debug ( LogId . telmetryMetadataError , "tool" , `Error resolving tool metadata: ${ errorMessage } ` ) ;
165+ // Extract projectId using type guard
166+ if ( "projectId" in data && typeof data . projectId === "string" && data . projectId . trim ( ) !== "" ) {
167+ toolMetadata . projectId = data . projectId ;
168+ }
169+
170+ // Extract orgId using type guard
171+ if ( "orgId" in data && typeof data . orgId === "string" && data . orgId . trim ( ) !== "" ) {
172+ toolMetadata . orgId = data . orgId ;
178173 }
179174 return toolMetadata ;
180175 }
@@ -199,7 +194,6 @@ export abstract class ToolBase {
199194 timestamp : new Date ( ) . toISOString ( ) ,
200195 source : "mdbmcp" ,
201196 properties : {
202- ...this . telemetry . getCommonProperties ( ) ,
203197 command : this . name ,
204198 category : this . category ,
205199 component : "tool" ,
0 commit comments