tmcp 1.16.3 → 1.16.4
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 +1 -1
- package/src/index.js +21 -3
- package/src/internal/internal.d.ts +1 -0
- package/src/types/index.d.ts +1 -0
- package/src/types/index.d.ts.map +1 -1
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -401,8 +401,8 @@ export class McpServer {
|
|
|
401
401
|
*/
|
|
402
402
|
#init_tools() {
|
|
403
403
|
if (!this.#options.capabilities?.tools) return;
|
|
404
|
-
this.#server.addMethod('tools/list', async () => {
|
|
405
|
-
const
|
|
404
|
+
this.#server.addMethod('tools/list', async ({ cursor } = {}) => {
|
|
405
|
+
const all_tools = (
|
|
406
406
|
await Promise.all(
|
|
407
407
|
[...this.#tools].map(async ([name, tool]) => {
|
|
408
408
|
if (
|
|
@@ -439,8 +439,26 @@ export class McpServer {
|
|
|
439
439
|
}),
|
|
440
440
|
)
|
|
441
441
|
).filter((tool) => tool !== null);
|
|
442
|
+
|
|
443
|
+
const pagination_options = this.#options.pagination?.tools;
|
|
444
|
+
if (!pagination_options || pagination_options.size == null) {
|
|
445
|
+
return { tools: all_tools };
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
const page_length = pagination_options.size;
|
|
449
|
+
const offset = cursor ? await decode_cursor(cursor) : 0;
|
|
450
|
+
const start_index = offset;
|
|
451
|
+
const end_index = start_index + page_length;
|
|
452
|
+
|
|
453
|
+
const tools = all_tools.slice(start_index, end_index);
|
|
454
|
+
const has_next = end_index < all_tools.length;
|
|
455
|
+
const next_cursor = has_next
|
|
456
|
+
? await encode_cursor(end_index)
|
|
457
|
+
: null;
|
|
458
|
+
|
|
442
459
|
return {
|
|
443
|
-
tools
|
|
460
|
+
tools,
|
|
461
|
+
...(next_cursor && { nextCursor: next_cursor }),
|
|
444
462
|
};
|
|
445
463
|
});
|
|
446
464
|
this.#server.addMethod(
|
|
@@ -73,6 +73,7 @@ export type ServerOptions<TSchema extends StandardSchemaV1 | undefined> = {
|
|
|
73
73
|
instructions?: string;
|
|
74
74
|
adapter: JsonSchemaAdapter<TSchema> | undefined;
|
|
75
75
|
pagination?: {
|
|
76
|
+
tools?: { size?: number };
|
|
76
77
|
resources?: { size?: number };
|
|
77
78
|
prompts?: { size?: number };
|
|
78
79
|
};
|
package/src/types/index.d.ts
CHANGED
package/src/types/index.d.ts.map
CHANGED
|
@@ -74,6 +74,6 @@
|
|
|
74
74
|
null,
|
|
75
75
|
null
|
|
76
76
|
],
|
|
77
|
-
"mappings": ";;;;;cAiLaA,SAASA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aCg0CyBC,KAAKA;aDn7CFC,aAAaA;;aC08CHC,kBAAkBA;aAGrBC,eAAeA;aAvBZC,kBAAkBA;aAUKC,UAAUA;aAmBzBC,0BAA0BA;aAGjCC,mBAAmBA;aAY9BC,QAAQA;aAYJC,YAAYA;aAlDVC,UAAUA;aAwDZC,YAAYA;aAGRC,gBAAgBA;aAGjBC,eAAeA;aAGbC,iBAAiBA;aAMPC,2BAA2BA;aAHnCC,mBAAmBA;aAhDxBC,cAAcA;MCj/C1DC,UAAUA;;;;;MAyCVC,aAAaA
|
|
77
|
+
"mappings": ";;;;;cAiLaA,SAASA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aCg0CyBC,KAAK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