Skip to content

Commit a89e329

Browse files
authored
Revert "feat: otel instrumentation as per MCP semantic convention (#306)" (#317)
This reverts commit 807cc5f.
1 parent abfd22a commit a89e329

File tree

25 files changed

+322
-2621
lines changed

25 files changed

+322
-2621
lines changed

package-lock.json

Lines changed: 0 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/toolbox-adk/src/toolbox_adk/client.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ export class ToolboxClient {
4747
session?: AxiosInstance | null,
4848
clientHeaders?: ClientHeadersConfig | null,
4949
protocol: Protocol = Protocol.MCP,
50-
telemetryEnabled = false,
5150
) {
5251
this.coreClient = new CoreToolboxClient(
5352
url,
@@ -56,7 +55,6 @@ export class ToolboxClient {
5655
protocol,
5756
'toolbox-adk-js',
5857
VERSION,
59-
telemetryEnabled,
6058
);
6159
}
6260

@@ -109,12 +107,4 @@ export class ToolboxClient {
109107
);
110108
return coreTools.map(coreTool => new ToolboxTool(coreTool));
111109
}
112-
113-
/**
114-
* Closes the client and flushes any pending telemetry (e.g. session duration metric).
115-
* Should be called when the client is no longer needed.
116-
*/
117-
async close(): Promise<void> {
118-
await this.coreClient.close();
119-
}
120110
}

packages/toolbox-adk/test/test.client.ts

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import {VERSION} from '../src/toolbox_adk/version.js';
2828
type MockCoreClient = {
2929
loadTool: typeof mockLoadTool;
3030
loadToolset: typeof mockLoadToolset;
31-
close: typeof mockClose;
3231
};
3332

3433
// Define the signature of the mock constructor itself
@@ -39,11 +38,8 @@ type MockCoreClientConstructor = (
3938
protocol?: string | null,
4039
clientName?: string,
4140
clientVersion?: string,
42-
telemetryEnabled?: boolean,
4341
) => MockCoreClient;
4442

45-
const mockClose = jest.fn<() => Promise<void>>();
46-
4743
const mockLoadTool =
4844
jest.fn<
4945
(
@@ -68,7 +64,6 @@ const MockCoreToolboxClient = jest
6864
.mockImplementation(() => ({
6965
loadTool: mockLoadTool,
7066
loadToolset: mockLoadToolset,
71-
close: mockClose,
7267
}));
7368

7469
const MockToolboxTool = jest.fn();
@@ -93,7 +88,6 @@ describe('ToolboxClient', () => {
9388
beforeEach(() => {
9489
mockLoadTool.mockReset();
9590
mockLoadToolset.mockReset();
96-
mockClose.mockReset();
9791
MockCoreToolboxClient.mockClear();
9892
MockToolboxTool.mockClear();
9993
});
@@ -111,7 +105,6 @@ describe('ToolboxClient', () => {
111105
'mcp-default',
112106
'toolbox-adk-js',
113107
VERSION,
114-
false,
115108
);
116109
});
117110

@@ -186,28 +179,4 @@ describe('ToolboxClient', () => {
186179

187180
expect(mockLoadToolset).toHaveBeenCalledWith(undefined, {}, {}, false);
188181
});
189-
190-
it.each([false, true])(
191-
'should forward telemetryEnabled=%s to core client',
192-
telemetryEnabled => {
193-
new ToolboxClient(
194-
'http://test.url',
195-
null,
196-
null,
197-
undefined,
198-
telemetryEnabled,
199-
);
200-
const callArgs = MockCoreToolboxClient.mock.calls[0] as unknown[];
201-
expect(callArgs[6]).toBe(telemetryEnabled);
202-
},
203-
);
204-
205-
it('should delegate close() to coreClient.close()', async () => {
206-
mockClose.mockResolvedValue(undefined);
207-
const client = new ToolboxClient('http://test.url');
208-
209-
await client.close();
210-
211-
expect(mockClose).toHaveBeenCalledTimes(1);
212-
});
213182
});

packages/toolbox-core/package.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,7 @@
6161
"uuid": "^11.1.0"
6262
},
6363
"peerDependencies": {
64-
"zod": "^3.24.4",
65-
"@opentelemetry/api": "^1.9.0"
66-
},
67-
"peerDependenciesMeta": {
68-
"@opentelemetry/api": {
69-
"optional": true
70-
}
64+
"zod": "^3.24.4"
7165
},
7266
"devDependencies": {
7367
"rimraf": "^6.1.2"

packages/toolbox-core/src/toolbox_core/client.ts

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,8 @@ class ToolboxClient {
5757
* requests. If not provided, a new one will be created.
5858
* @param {ClientHeadersConfig} [clientHeaders] - Optional initial headers to
5959
* be included in each request.
60-
* @param {Protocol} [protocol] - MCP protocol version to use. Defaults to
61-
* the latest supported version. Pass a specific version (e.g.,
62-
* `Protocol.MCP_v20241105`) to pin to an older revision.
6360
* @param {string} [clientName] - Optional name of the client package.
6461
* @param {string} [clientVersion] - Optional version of the client package.
65-
* @param {boolean} [telemetryEnabled] - Set to `true` to enable OpenTelemetry
66-
* tracing and metrics. Requires the optional `@opentelemetry/api` peer
67-
* dependency. Silently ignored if the package is not installed.
6862
*/
6963
constructor(
7064
url: string,
@@ -73,7 +67,6 @@ class ToolboxClient {
7367
protocol: Protocol = Protocol.MCP,
7468
clientName?: string,
7569
clientVersion?: string,
76-
telemetryEnabled = false,
7770
) {
7871
this.#clientHeaders = clientHeaders || {};
7972
warnIfHttpAndHeaders(url, this.#clientHeaders);
@@ -95,7 +88,6 @@ class ToolboxClient {
9588
protocol,
9689
clientName,
9790
clientVersion,
98-
telemetryEnabled,
9991
);
10092
break;
10193
case Protocol.MCP_v20250326:
@@ -105,7 +97,6 @@ class ToolboxClient {
10597
protocol,
10698
clientName,
10799
clientVersion,
108-
telemetryEnabled,
109100
);
110101
break;
111102
case Protocol.MCP_v20250618:
@@ -115,7 +106,6 @@ class ToolboxClient {
115106
protocol,
116107
clientName,
117108
clientVersion,
118-
telemetryEnabled,
119109
);
120110
break;
121111
case Protocol.MCP_v20251125:
@@ -125,7 +115,6 @@ class ToolboxClient {
125115
protocol,
126116
clientName,
127117
clientVersion,
128-
telemetryEnabled,
129118
);
130119
break;
131120
default:
@@ -371,14 +360,6 @@ class ToolboxClient {
371360

372361
return tools;
373362
}
374-
375-
/**
376-
* Closes the client and flushes any pending telemetry (e.g. session duration metric).
377-
* Should be called when the client is no longer needed.
378-
*/
379-
async close(): Promise<void> {
380-
await this.#transport.close();
381-
}
382363
}
383364

384365
export {ToolboxClient};

0 commit comments

Comments
 (0)