@@ -3,8 +3,8 @@ import type { McpServer, RegisteredTool, ToolCallback } from "@modelcontextproto
33import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js" ;
44import { Session } from "../session.js" ;
55import logger , { LogId } from "../logger.js" ;
6- import { Telemetry , isTelemetryEnabled } from "../telemetry/telemetry.js" ;
7- import { type ToolEvent } from "../telemetry/types.js" ;
6+ import { Telemetry , isTelemetryEnabled } from "../telemetry/telemetry.js" ;
7+ import { type ToolEvent } from "../telemetry/types.js" ;
88import { UserConfig } from "../config.js" ;
99
1010export type ToolArgs < Args extends ZodRawShape > = z . objectOutputType < Args , ZodNever > ;
@@ -14,7 +14,7 @@ export type ToolCategory = "mongodb" | "atlas";
1414export type ToolMetadata = {
1515 projectId ?: string ;
1616 orgId ?: string ;
17- }
17+ } ;
1818
1919export abstract class ToolBase {
2020 protected abstract name : string ;
@@ -27,7 +27,6 @@ export abstract class ToolBase {
2727
2828 protected abstract argsShape : ZodRawShape ;
2929
30-
3130 protected abstract execute ( ...args : Parameters < ToolCallback < typeof this . argsShape > > ) : Promise < CallToolResult > ;
3231
3332 constructor (
@@ -133,17 +132,14 @@ export abstract class ToolBase {
133132 } ;
134133 }
135134
136-
137135 /**
138- *
136+ *
139137 * Resolves the tool metadata from the arguments passed to the tool
140- *
138+ *
141139 * @param args - The arguments passed to the tool
142140 * @returns The tool metadata
143141 */
144- protected resolveToolMetadata (
145- ...args : Parameters < ToolCallback < typeof this . argsShape > >
146- ) : ToolMetadata {
142+ protected resolveToolMetadata ( ...args : Parameters < ToolCallback < typeof this . argsShape > > ) : ToolMetadata {
147143 const toolMetadata : ToolMetadata = { } ;
148144 try {
149145 // Parse the arguments to extract project_id and org_id
@@ -156,21 +152,23 @@ export abstract class ToolBase {
156152 if ( parsedArgs . success && parsedArgs . data ?. orgId ) {
157153 toolMetadata . orgId = parsedArgs . data ?. orgId ;
158154 }
159- }
160- catch ( error ) {
155+ } catch ( error ) {
161156 logger . info ( LogId . telmetryMetadataError , "tool" , `Error resolving tool metadata: ${ error as string } ` ) ;
162157 }
163158 return toolMetadata ;
164159 }
165160
166-
167161 /**
168162 * Creates and emits a tool telemetry event
169163 * @param startTime - Start time in milliseconds
170164 * @param result - Whether the command succeeded or failed
171165 * @param args - The arguments passed to the tool
172166 */
173- private async emitToolEvent ( startTime : number , result : CallToolResult , ...args : Parameters < ToolCallback < typeof this . argsShape > > ) : Promise < void > {
167+ private async emitToolEvent (
168+ startTime : number ,
169+ result : CallToolResult ,
170+ ...args : Parameters < ToolCallback < typeof this . argsShape > >
171+ ) : Promise < void > {
174172 if ( ! isTelemetryEnabled ( ) ) {
175173 return ;
176174 }
0 commit comments