@@ -5,7 +5,7 @@ import type { CallToolResult, ToolAnnotations } from "@modelcontextprotocol/sdk/
55import type { Session } from "../common/session.js" ;
66import { LogId } from "../common/logger.js" ;
77import type { Telemetry } from "../telemetry/telemetry.js" ;
8- import { type ToolEvent } from "../telemetry/types.js" ;
8+ import type { TelemetryToolMetadata , ToolEvent } from "../telemetry/types.js" ;
99import type { UserConfig } from "../common/config.js" ;
1010import type { Server } from "../server.js" ;
1111import type { Elicitation } from "../elicitation.js" ;
@@ -39,17 +39,6 @@ export type OperationType = "metadata" | "read" | "create" | "delete" | "update"
3939 */
4040export type ToolCategory = "mongodb" | "atlas" | "atlas-local" ;
4141
42- /**
43- * Telemetry metadata that can be provided by tools when emitting telemetry events.
44- * For MongoDB tools, this is typically empty, while for Atlas tools, this should include
45- * the project and organization IDs if available.
46- */
47- export type TelemetryToolMetadata = {
48- projectId ?: string ;
49- orgId ?: string ;
50- atlasLocaldeploymentId ?: string ;
51- } ;
52-
5342export type ToolConstructorParams = {
5443 session : Session ;
5544 config : UserConfig ;
@@ -304,21 +293,10 @@ export abstract class ToolBase {
304293 component : "tool" ,
305294 duration_ms : duration ,
306295 result : result . isError ? "failure" : "success" ,
296+ ...metadata ,
307297 } ,
308298 } ;
309299
310- if ( metadata ?. orgId ) {
311- event . properties . org_id = metadata . orgId ;
312- }
313-
314- if ( metadata ?. projectId ) {
315- event . properties . project_id = metadata . projectId ;
316- }
317-
318- if ( metadata ?. atlasLocaldeploymentId ) {
319- event . properties . atlas_local_deployment_id = metadata . atlasLocaldeploymentId ;
320- }
321-
322300 this . telemetry . emitEvents ( [ event ] ) ;
323301 }
324302
0 commit comments