tmcp 1.7.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -3
- package/src/index.d.ts +4 -14
- package/src/index.js +12 -7
- package/src/validation/index.d.ts +431 -431
- package/src/validation/index.js +113 -113
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tmcp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "The main tmcp library",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -36,10 +36,11 @@
|
|
|
36
36
|
"@standard-schema/spec": "^1.0.0",
|
|
37
37
|
"@types/json-schema": "^7.0.15",
|
|
38
38
|
"@types/node": "^24.0.13",
|
|
39
|
-
"publint": "^0.3.12"
|
|
39
|
+
"publint": "^0.3.12",
|
|
40
|
+
"vitest": "^3.2.4"
|
|
40
41
|
},
|
|
41
42
|
"scripts": {
|
|
42
|
-
"test": "
|
|
43
|
+
"test": "vitest",
|
|
43
44
|
"typecheck": "tsc --noEmit",
|
|
44
45
|
"generate:types": "find ./src -name \"*.d.ts\" -not -path \"./src/internal/*\" -delete && tsc ./src/*.js --declaration --emitDeclarationOnly --target esnext --allowJs --moduleresolution nodenext --module nodenext && publint",
|
|
45
46
|
"prepublish": "pnpm generate:types"
|
package/src/index.d.ts
CHANGED
|
@@ -18,22 +18,12 @@ export class McpServer<StandardSchema extends StandardSchemaV1> {
|
|
|
18
18
|
name?: string;
|
|
19
19
|
}>;
|
|
20
20
|
currentClientCapabilities(): {
|
|
21
|
-
experimental?: {}
|
|
22
|
-
|
|
23
|
-
};
|
|
24
|
-
sampling?: {} & {
|
|
25
|
-
[key: string]: unknown;
|
|
26
|
-
};
|
|
27
|
-
elicitation?: {} & {
|
|
28
|
-
[key: string]: unknown;
|
|
29
|
-
};
|
|
21
|
+
experimental?: {};
|
|
22
|
+
sampling?: {};
|
|
23
|
+
elicitation?: {};
|
|
30
24
|
roots?: {
|
|
31
25
|
listChanged?: boolean;
|
|
32
|
-
} & {
|
|
33
|
-
[key: string]: unknown;
|
|
34
26
|
};
|
|
35
|
-
} & {
|
|
36
|
-
[key: string]: unknown;
|
|
37
27
|
};
|
|
38
28
|
/**
|
|
39
29
|
* @template {keyof McpEvents} TEvent
|
|
@@ -41,7 +31,7 @@ export class McpServer<StandardSchema extends StandardSchemaV1> {
|
|
|
41
31
|
* @param {McpEvents[TEvent]} callback
|
|
42
32
|
* @param {AddEventListenerOptions} [options]
|
|
43
33
|
*/
|
|
44
|
-
on<TEvent extends keyof McpEvents>(event: TEvent, callback: McpEvents[TEvent], options?: AddEventListenerOptions): void;
|
|
34
|
+
on<TEvent extends keyof McpEvents>(event: TEvent, callback: McpEvents[TEvent], options?: AddEventListenerOptions): () => void;
|
|
45
35
|
/**
|
|
46
36
|
* @template {StandardSchema | undefined} [TSchema=undefined]
|
|
47
37
|
* @param {{ name: string; description: string; title?: string; schema?: StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema> extends Record<string, unknown> ? TSchema : never; annotations?: ToolAnnotations }} options
|
package/src/index.js
CHANGED
|
@@ -270,13 +270,18 @@ export class McpServer {
|
|
|
270
270
|
this.#lazyily_create_client();
|
|
271
271
|
}
|
|
272
272
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
|
|
273
|
+
/**
|
|
274
|
+
* @param {Event} e
|
|
275
|
+
*/
|
|
276
|
+
const listener = (e) => {
|
|
277
|
+
callback(/** @type {CustomEvent} */ (e).detail);
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
this.#event_target.addEventListener(event, listener, options);
|
|
281
|
+
|
|
282
|
+
return () => {
|
|
283
|
+
this.#event_target.removeEventListener(event, listener, options);
|
|
284
|
+
};
|
|
280
285
|
}
|
|
281
286
|
|
|
282
287
|
/**
|