@agentscope-ai/agentscope 0.0.2

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.
Files changed (136) hide show
  1. package/dist/agent/index.d.mts +234 -0
  2. package/dist/agent/index.d.ts +234 -0
  3. package/dist/agent/index.js +1412 -0
  4. package/dist/agent/index.js.map +1 -0
  5. package/dist/agent/index.mjs +1375 -0
  6. package/dist/agent/index.mjs.map +1 -0
  7. package/dist/base-BOx3UzOl.d.mts +41 -0
  8. package/dist/base-BoIps2RL.d.ts +41 -0
  9. package/dist/base-C7jwyH4Z.d.mts +52 -0
  10. package/dist/base-Cwi4bjze.d.ts +127 -0
  11. package/dist/base-DYlBMCy_.d.mts +127 -0
  12. package/dist/base-NX-knWOv.d.ts +52 -0
  13. package/dist/block-VsnHrllL.d.mts +48 -0
  14. package/dist/block-VsnHrllL.d.ts +48 -0
  15. package/dist/event/index.d.mts +181 -0
  16. package/dist/event/index.d.ts +181 -0
  17. package/dist/event/index.js +58 -0
  18. package/dist/event/index.js.map +1 -0
  19. package/dist/event/index.mjs +33 -0
  20. package/dist/event/index.mjs.map +1 -0
  21. package/dist/formatter/index.d.mts +187 -0
  22. package/dist/formatter/index.d.ts +187 -0
  23. package/dist/formatter/index.js +647 -0
  24. package/dist/formatter/index.js.map +1 -0
  25. package/dist/formatter/index.mjs +616 -0
  26. package/dist/formatter/index.mjs.map +1 -0
  27. package/dist/index-BTJDlKvQ.d.mts +195 -0
  28. package/dist/index-BcatlwXQ.d.ts +195 -0
  29. package/dist/index-CAxQAkiP.d.mts +21 -0
  30. package/dist/index-CAxQAkiP.d.ts +21 -0
  31. package/dist/mcp/index.d.mts +9 -0
  32. package/dist/mcp/index.d.ts +9 -0
  33. package/dist/mcp/index.js +432 -0
  34. package/dist/mcp/index.js.map +1 -0
  35. package/dist/mcp/index.mjs +408 -0
  36. package/dist/mcp/index.mjs.map +1 -0
  37. package/dist/message/index.d.mts +10 -0
  38. package/dist/message/index.d.ts +10 -0
  39. package/dist/message/index.js +67 -0
  40. package/dist/message/index.js.map +1 -0
  41. package/dist/message/index.mjs +37 -0
  42. package/dist/message/index.mjs.map +1 -0
  43. package/dist/message-CkN21KaY.d.mts +99 -0
  44. package/dist/message-CzLeTlua.d.ts +99 -0
  45. package/dist/model/index.d.mts +377 -0
  46. package/dist/model/index.d.ts +377 -0
  47. package/dist/model/index.js +1880 -0
  48. package/dist/model/index.js.map +1 -0
  49. package/dist/model/index.mjs +1849 -0
  50. package/dist/model/index.mjs.map +1 -0
  51. package/dist/storage/index.d.mts +68 -0
  52. package/dist/storage/index.d.ts +68 -0
  53. package/dist/storage/index.js +250 -0
  54. package/dist/storage/index.js.map +1 -0
  55. package/dist/storage/index.mjs +212 -0
  56. package/dist/storage/index.mjs.map +1 -0
  57. package/dist/tool/index.d.mts +311 -0
  58. package/dist/tool/index.d.ts +311 -0
  59. package/dist/tool/index.js +1494 -0
  60. package/dist/tool/index.js.map +1 -0
  61. package/dist/tool/index.mjs +1447 -0
  62. package/dist/tool/index.mjs.map +1 -0
  63. package/dist/toolkit-CEpulFi0.d.ts +99 -0
  64. package/dist/toolkit-CGEZSZPa.d.mts +99 -0
  65. package/jest.config.js +11 -0
  66. package/package.json +92 -0
  67. package/src/_utils/common.ts +104 -0
  68. package/src/_utils/index.ts +1 -0
  69. package/src/agent/agent-base.ts +0 -0
  70. package/src/agent/agent.test.ts +1028 -0
  71. package/src/agent/agent.ts +1032 -0
  72. package/src/agent/index.ts +2 -0
  73. package/src/agent/interfaces.ts +23 -0
  74. package/src/agent/test-compression.ts +72 -0
  75. package/src/event/index.ts +250 -0
  76. package/src/formatter/base.ts +133 -0
  77. package/src/formatter/dashscope-chat-formatter.test.ts +372 -0
  78. package/src/formatter/dashscope-chat-formatter.ts +163 -0
  79. package/src/formatter/deepseek-chat-formatter.ts +130 -0
  80. package/src/formatter/index.ts +5 -0
  81. package/src/formatter/ollama-chat-formatter.ts +67 -0
  82. package/src/formatter/openai-chat-formatter.test.ts +263 -0
  83. package/src/formatter/openai-chat-formatter.ts +301 -0
  84. package/src/formatter/openai.md +767 -0
  85. package/src/mcp/base.ts +114 -0
  86. package/src/mcp/http.test.ts +303 -0
  87. package/src/mcp/http.ts +224 -0
  88. package/src/mcp/index.ts +2 -0
  89. package/src/mcp/stdio.test.ts +91 -0
  90. package/src/mcp/stdio.ts +119 -0
  91. package/src/message/block.ts +60 -0
  92. package/src/message/enums.ts +4 -0
  93. package/src/message/index.ts +12 -0
  94. package/src/message/message.test.ts +80 -0
  95. package/src/message/message.ts +131 -0
  96. package/src/model/base.ts +226 -0
  97. package/src/model/dashscope-model.test.ts +335 -0
  98. package/src/model/dashscope-model.ts +441 -0
  99. package/src/model/deepseek-model.test.ts +279 -0
  100. package/src/model/deepseek-model.ts +401 -0
  101. package/src/model/index.ts +7 -0
  102. package/src/model/ollama-model.test.ts +307 -0
  103. package/src/model/ollama-model.ts +356 -0
  104. package/src/model/openai-model.ts +327 -0
  105. package/src/model/response.ts +22 -0
  106. package/src/model/usage.ts +12 -0
  107. package/src/storage/base.ts +52 -0
  108. package/src/storage/file-system.test.ts +587 -0
  109. package/src/storage/file-system.ts +269 -0
  110. package/src/storage/index.ts +2 -0
  111. package/src/tool/base.ts +23 -0
  112. package/src/tool/bash.test.ts +174 -0
  113. package/src/tool/bash.ts +152 -0
  114. package/src/tool/edit.test.ts +83 -0
  115. package/src/tool/edit.ts +95 -0
  116. package/src/tool/glob.test.ts +63 -0
  117. package/src/tool/glob.ts +166 -0
  118. package/src/tool/grep.test.ts +74 -0
  119. package/src/tool/grep.ts +256 -0
  120. package/src/tool/index.ts +10 -0
  121. package/src/tool/read.test.ts +77 -0
  122. package/src/tool/read.ts +117 -0
  123. package/src/tool/response.ts +82 -0
  124. package/src/tool/task.test.ts +299 -0
  125. package/src/tool/task.ts +399 -0
  126. package/src/tool/toolkit.test.ts +636 -0
  127. package/src/tool/toolkit.ts +601 -0
  128. package/src/tool/write.test.ts +52 -0
  129. package/src/tool/write.ts +57 -0
  130. package/src/type/index.ts +52 -0
  131. package/tsconfig.build.json +4 -0
  132. package/tsconfig.cjs.json +11 -0
  133. package/tsconfig.esm.json +10 -0
  134. package/tsconfig.json +14 -0
  135. package/tsup.config.ts +20 -0
  136. package/typedoc.json +52 -0
@@ -0,0 +1,432 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/mcp/index.ts
21
+ var mcp_exports = {};
22
+ __export(mcp_exports, {
23
+ HTTPMCPClient: () => HTTPMCPClient,
24
+ StdioMCPClient: () => StdioMCPClient
25
+ });
26
+ module.exports = __toCommonJS(mcp_exports);
27
+
28
+ // src/mcp/http.ts
29
+ var import_client = require("@modelcontextprotocol/sdk/client/index.js");
30
+ var import_sse = require("@modelcontextprotocol/sdk/client/sse.js");
31
+ var import_streamableHttp = require("@modelcontextprotocol/sdk/client/streamableHttp.js");
32
+ var import_types2 = require("@modelcontextprotocol/sdk/types.js");
33
+
34
+ // src/mcp/base.ts
35
+ var import_types = require("@modelcontextprotocol/sdk/types.js");
36
+
37
+ // src/tool/response.ts
38
+ function createToolResponse({
39
+ content,
40
+ state,
41
+ id = crypto.randomUUID(),
42
+ createdAt = (/* @__PURE__ */ new Date()).toISOString(),
43
+ metadata = {},
44
+ stream = false,
45
+ isLast = true,
46
+ isInterrupted = false
47
+ }) {
48
+ return {
49
+ content,
50
+ id,
51
+ createdAt,
52
+ metadata,
53
+ state,
54
+ stream,
55
+ isLast,
56
+ isInterrupted
57
+ };
58
+ }
59
+
60
+ // src/mcp/base.ts
61
+ var MCPTool = class {
62
+ name;
63
+ description;
64
+ inputSchema;
65
+ requireUserConfirm = false;
66
+ call;
67
+ getClient;
68
+ releaseClient;
69
+ /**
70
+ * Initialize an MCPTool instance
71
+ * @param root0
72
+ * @param root0.name
73
+ * @param root0.description
74
+ * @param root0.inputSchema
75
+ * @param root0.getClient
76
+ * @param root0.releaseClient
77
+ */
78
+ constructor({
79
+ name,
80
+ description,
81
+ inputSchema,
82
+ getClient,
83
+ releaseClient
84
+ }) {
85
+ this.name = name;
86
+ this.description = description;
87
+ this.inputSchema = inputSchema;
88
+ this.getClient = getClient;
89
+ this.releaseClient = releaseClient;
90
+ this.call = this._call.bind(this);
91
+ }
92
+ /**
93
+ * Call the MCP tool with the specified input arguments. This method sends a request to the MCP server to execute
94
+ * the tool and returns the result as a ToolResponse.
95
+ *
96
+ * @param arguments
97
+ * @param input
98
+ * @returns A ToolResponse object containing the result of the tool execution, or an error message if the call fails.
99
+ */
100
+ async _call(input) {
101
+ const client = await this.getClient();
102
+ try {
103
+ const request = {
104
+ method: "tools/call",
105
+ params: {
106
+ name: this.name,
107
+ arguments: input
108
+ }
109
+ };
110
+ const result = await client.request(request, import_types.CallToolResultSchema);
111
+ const content = [];
112
+ result.content.forEach((item) => {
113
+ if (item.type === "text") {
114
+ content.push({ type: "text", text: item.text, id: crypto.randomUUID() });
115
+ } else if (item.type === "image" || item.type === "audio") {
116
+ content.push({
117
+ id: crypto.randomUUID(),
118
+ type: "data",
119
+ source: { type: "base64", mediaType: item.mimeType, data: item.data }
120
+ });
121
+ } else {
122
+ console.warn(
123
+ `Unsupported content type '${item.type}' in tool result, skipping...`
124
+ );
125
+ }
126
+ });
127
+ return createToolResponse({ content, state: "success" });
128
+ } catch (error) {
129
+ return createToolResponse({
130
+ content: [
131
+ {
132
+ id: crypto.randomUUID(),
133
+ type: "text",
134
+ text: `Error calling tool '${this.name}': ${error}`
135
+ }
136
+ ],
137
+ state: "error"
138
+ });
139
+ } finally {
140
+ await this.releaseClient(client);
141
+ }
142
+ }
143
+ };
144
+
145
+ // src/mcp/http.ts
146
+ var HTTPMCPClient = class {
147
+ name;
148
+ requestOptions;
149
+ client;
150
+ transport;
151
+ transportType;
152
+ url;
153
+ transportOpts;
154
+ stateful;
155
+ /**
156
+ * Initialize the HTTPStatefulMCPClient with the specified transport type, URL, and options.
157
+ *
158
+ * @param root0
159
+ * @param root0.name
160
+ * @param root0.transportType
161
+ * @param root0.url
162
+ * @param root0.stateful
163
+ * @param root0.transportOpts
164
+ * @param root0.requestOptions
165
+ */
166
+ constructor({
167
+ name,
168
+ transportType,
169
+ url,
170
+ stateful = true,
171
+ transportOpts,
172
+ requestOptions
173
+ }) {
174
+ this.name = name;
175
+ this.transportType = transportType;
176
+ this.transportOpts = transportOpts;
177
+ this.requestOptions = requestOptions;
178
+ this.url = url;
179
+ this.stateful = stateful;
180
+ }
181
+ /**
182
+ * Connect to the MCP server with the specified transport and URL. This method must be called before making any
183
+ * requests to the server.
184
+ */
185
+ async connect() {
186
+ if (!this.stateful) {
187
+ console.log(
188
+ `MCP client '${this.name}' initialized with stateful=false will connect and close the connection automatically for each request, no need to call 'connect()' method explicitly.`
189
+ );
190
+ } else {
191
+ await this._connect();
192
+ }
193
+ }
194
+ /**
195
+ * The internal method to establish the connection to the MCP server. It initializes the appropriate transport
196
+ * based on the specified transport type and creates a new Client instance to manage the connection and requests.
197
+ */
198
+ async _connect() {
199
+ const baseUrl = new URL(this.url);
200
+ if (this.transportType === "streamable-http") {
201
+ this.transport = new import_streamableHttp.StreamableHTTPClientTransport(baseUrl, this.transportOpts);
202
+ } else {
203
+ this.transport = new import_sse.SSEClientTransport(baseUrl, this.transportOpts);
204
+ }
205
+ this.client = new import_client.Client({
206
+ name: this.name,
207
+ version: "1.0.0"
208
+ });
209
+ await this.client.connect(this.transport, this.requestOptions);
210
+ console.log(`MCP client '${this.name}' is connected`);
211
+ }
212
+ /**
213
+ * List all tools available on the MCP server.
214
+ *
215
+ * @returns An array of MCPTool instances representing the tools available on the server.
216
+ */
217
+ async listTools() {
218
+ let listClient;
219
+ if (this.stateful) {
220
+ if (!this.client) {
221
+ throw new Error(
222
+ `Client not initialized, call 'connect()' method first for the MCP client named '${this.name}'`
223
+ );
224
+ }
225
+ listClient = this.client;
226
+ } else {
227
+ listClient = await this._createClient();
228
+ }
229
+ try {
230
+ const toolsRequest = {
231
+ method: "tools/list",
232
+ params: {}
233
+ };
234
+ const toolsResult = await listClient.request(toolsRequest, import_types2.ListToolsResultSchema);
235
+ if (toolsResult.tools === void 0) {
236
+ return [];
237
+ }
238
+ return toolsResult.tools.map((tool) => {
239
+ if (this.stateful) {
240
+ return new MCPTool({
241
+ name: tool.name,
242
+ description: tool.description || "",
243
+ inputSchema: tool.inputSchema,
244
+ getClient: async () => this.client,
245
+ releaseClient: async () => {
246
+ }
247
+ });
248
+ } else {
249
+ return new MCPTool({
250
+ name: tool.name,
251
+ description: tool.description || "",
252
+ inputSchema: tool.inputSchema,
253
+ getClient: () => this._createClient(),
254
+ releaseClient: async (c) => {
255
+ await c.close();
256
+ }
257
+ });
258
+ }
259
+ });
260
+ } finally {
261
+ if (!this.stateful) {
262
+ await listClient.close();
263
+ }
264
+ }
265
+ }
266
+ /**
267
+ * Close the connection to the MCP server and clean up any resources used by the client.
268
+ */
269
+ async close() {
270
+ if (!this.stateful) {
271
+ console.log(
272
+ `MCP client '${this.name}' initialized with stateful=false will connect and close the connection automatically for each request, no need to call 'close()' method explicitly.`
273
+ );
274
+ } else {
275
+ await this._close();
276
+ }
277
+ }
278
+ /**
279
+ * The internal method to close the connection to the MCP server.
280
+ */
281
+ async _close() {
282
+ try {
283
+ await this.client?.close();
284
+ } finally {
285
+ console.log(`MCP client '${this.name} is closed.'`);
286
+ this.client = void 0;
287
+ this.transport = void 0;
288
+ }
289
+ }
290
+ /**
291
+ * Create a new client instance without storing it in this.client.
292
+ * Used for stateless operations where each request needs its own client.
293
+ * @returns A new connected Client instance
294
+ */
295
+ async _createClient() {
296
+ const baseUrl = new URL(this.url);
297
+ const transport = this.transportType === "streamable-http" ? new import_streamableHttp.StreamableHTTPClientTransport(baseUrl, this.transportOpts) : new import_sse.SSEClientTransport(baseUrl, this.transportOpts);
298
+ const client = new import_client.Client({
299
+ name: this.name,
300
+ version: "1.0.0"
301
+ });
302
+ await client.connect(transport, this.requestOptions);
303
+ return client;
304
+ }
305
+ /**
306
+ * Get a callable function for a specific tool by its name.
307
+ * @param root0
308
+ * @param root0.name
309
+ * @returns An instance of MCPTool that can be called to execute the tool's functionality.
310
+ */
311
+ async getCallableFunction({ name }) {
312
+ if (this.stateful && !this.client) {
313
+ throw new Error(
314
+ `Client not initialized, call 'connect()' method first for the MCP client named '${this.name}'`
315
+ );
316
+ }
317
+ const tools = await this.listTools();
318
+ const targetTool = tools.find((tool) => tool.name === name);
319
+ if (!targetTool) {
320
+ throw new Error(
321
+ `Tool '${name}' not found in MCP server '${this.name}'. Available tools: ${tools.map((t) => t.name).join(", ")}`
322
+ );
323
+ }
324
+ return targetTool;
325
+ }
326
+ };
327
+
328
+ // src/mcp/stdio.ts
329
+ var import_client2 = require("@modelcontextprotocol/sdk/client/index.js");
330
+ var import_stdio = require("@modelcontextprotocol/sdk/client/stdio.js");
331
+ var import_types3 = require("@modelcontextprotocol/sdk/types.js");
332
+ var StdioMCPClient = class {
333
+ name;
334
+ stdioServerParameters;
335
+ transport;
336
+ client;
337
+ /**
338
+ * Initialize the StdioMCPClient with the given Stdio parameters.
339
+ *
340
+ * @param root0
341
+ * @param root0.name
342
+ */
343
+ constructor({
344
+ name,
345
+ ...rest
346
+ }) {
347
+ this.name = name;
348
+ this.stdioServerParameters = rest;
349
+ }
350
+ /**
351
+ * Connect to the MCP server using Stdio transport. Note the Stdio client will start an
352
+ * MCP server process under the hood.
353
+ */
354
+ async connect() {
355
+ this.transport = new import_stdio.StdioClientTransport(this.stdioServerParameters);
356
+ this.client = new import_client2.Client({
357
+ name: this.name,
358
+ version: "1.0.0"
359
+ });
360
+ await this.client.connect(this.transport);
361
+ }
362
+ /**
363
+ * Close the connection and stop the MCP server process.
364
+ */
365
+ async close() {
366
+ try {
367
+ if (this.client) {
368
+ await this.client.close();
369
+ }
370
+ } finally {
371
+ this.client = void 0;
372
+ this.transport = void 0;
373
+ }
374
+ }
375
+ /**
376
+ * List all tools available on the MCP server.
377
+ *
378
+ * @returns An array of MCPTool instances representing the tools available on the server.
379
+ */
380
+ async listTools() {
381
+ if (!this.client) {
382
+ throw new Error(
383
+ `Client not initialized, call 'connect()' method first for the MCP client named '${this.name}'`
384
+ );
385
+ }
386
+ const toolsRequest = {
387
+ method: "tools/list",
388
+ params: {}
389
+ };
390
+ const toolsResult = await this.client.request(toolsRequest, import_types3.ListToolsResultSchema);
391
+ if (toolsResult.tools === void 0) {
392
+ return [];
393
+ }
394
+ return toolsResult.tools.map((tool) => {
395
+ return new MCPTool({
396
+ name: tool.name,
397
+ description: tool.description || "",
398
+ inputSchema: tool.inputSchema,
399
+ getClient: async () => this.client,
400
+ releaseClient: async () => {
401
+ }
402
+ });
403
+ });
404
+ }
405
+ /**
406
+ * Get a callable function for a specific tool by its name.
407
+ * @param root0
408
+ * @param root0.name
409
+ * @returns An instance of MCPTool that can be called to execute the tool's functionality.
410
+ */
411
+ async getCallableFunction({ name }) {
412
+ if (!this.client) {
413
+ throw new Error(
414
+ `Client not initialized, call 'connect()' method first for the MCP client named '${this.name}'`
415
+ );
416
+ }
417
+ const tools = await this.listTools();
418
+ const targetTool = tools.find((tool) => tool.name === name);
419
+ if (!targetTool) {
420
+ throw new Error(
421
+ `Tool '${name}' not found in MCP server '${this.name}'. Available tools: ${tools.map((t) => t.name).join(", ")}`
422
+ );
423
+ }
424
+ return targetTool;
425
+ }
426
+ };
427
+ // Annotate the CommonJS export names for ESM import in node:
428
+ 0 && (module.exports = {
429
+ HTTPMCPClient,
430
+ StdioMCPClient
431
+ });
432
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/mcp/index.ts","../../src/mcp/http.ts","../../src/mcp/base.ts","../../src/tool/response.ts","../../src/mcp/stdio.ts"],"sourcesContent":["export * from './http';\nexport * from './stdio';\n","import { Client } from '@modelcontextprotocol/sdk/client/index.js';\nimport {\n SSEClientTransport,\n SSEClientTransportOptions,\n} from '@modelcontextprotocol/sdk/client/sse.js';\nimport { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';\nimport { StreamableHTTPClientTransportOptions } from '@modelcontextprotocol/sdk/client/streamableHttp.js';\nimport type { RequestOptions } from '@modelcontextprotocol/sdk/shared/protocol.js';\nimport { ListToolsRequest, ListToolsResultSchema, Tool } from '@modelcontextprotocol/sdk/types.js';\n\nimport { MCPTool } from './base';\n\n/**\n * The HTTP MCP client class that connects to an MCP server using either Streamable HTTP or Server-Sent Events (SSE)\n * transport.\n * Note the client is stateful, meaning that developers should manually call the `connect()` and `close()` methods to\n * manage the connection lifecycle.\n */\nexport class HTTPMCPClient {\n name: string;\n private requestOptions?: RequestOptions;\n private client?: Client;\n private transport?: StreamableHTTPClientTransport | SSEClientTransport;\n private transportType: 'streamable-http' | 'sse';\n private url: string;\n private transportOpts?: StreamableHTTPClientTransportOptions | SSEClientTransportOptions;\n private stateful: boolean;\n\n /**\n * Initialize the HTTPStatefulMCPClient with the specified transport type, URL, and options.\n *\n * @param root0\n * @param root0.name\n * @param root0.transportType\n * @param root0.url\n * @param root0.stateful\n * @param root0.transportOpts\n * @param root0.requestOptions\n */\n constructor({\n name,\n transportType,\n url,\n stateful = true,\n transportOpts,\n requestOptions,\n }: {\n name: string;\n transportType: 'streamable-http' | 'sse';\n url: string;\n stateful?: boolean;\n transportOpts?: StreamableHTTPClientTransportOptions | SSEClientTransportOptions;\n requestOptions?: RequestOptions;\n }) {\n this.name = name;\n this.transportType = transportType;\n this.transportOpts = transportOpts;\n this.requestOptions = requestOptions;\n this.url = url;\n this.stateful = stateful;\n }\n\n /**\n * Connect to the MCP server with the specified transport and URL. This method must be called before making any\n * requests to the server.\n */\n async connect() {\n if (!this.stateful) {\n console.log(\n `MCP client '${this.name}' initialized with stateful=false will connect and close the connection automatically for each request, no need to call 'connect()' method explicitly.`\n );\n } else {\n await this._connect();\n }\n }\n\n /**\n * The internal method to establish the connection to the MCP server. It initializes the appropriate transport\n * based on the specified transport type and creates a new Client instance to manage the connection and requests.\n */\n protected async _connect() {\n const baseUrl = new URL(this.url);\n if (this.transportType === 'streamable-http') {\n this.transport = new StreamableHTTPClientTransport(baseUrl, this.transportOpts);\n } else {\n this.transport = new SSEClientTransport(baseUrl, this.transportOpts);\n }\n this.client = new Client({\n name: this.name,\n version: '1.0.0',\n });\n await this.client.connect(this.transport, this.requestOptions);\n console.log(`MCP client '${this.name}' is connected`);\n }\n\n /**\n * List all tools available on the MCP server.\n *\n * @returns An array of MCPTool instances representing the tools available on the server.\n */\n async listTools(): Promise<MCPTool[]> {\n let listClient: Client;\n\n if (this.stateful) {\n if (!this.client) {\n throw new Error(\n `Client not initialized, call 'connect()' method first for the MCP client named '${this.name}'`\n );\n }\n listClient = this.client;\n } else {\n listClient = await this._createClient();\n }\n\n try {\n const toolsRequest: ListToolsRequest = {\n method: 'tools/list',\n params: {},\n };\n\n const toolsResult = await listClient.request(toolsRequest, ListToolsResultSchema);\n if (toolsResult.tools === undefined) {\n return [];\n }\n\n return toolsResult.tools.map((tool: Tool) => {\n if (this.stateful) {\n return new MCPTool({\n name: tool.name,\n description: tool.description || '',\n inputSchema: tool.inputSchema,\n getClient: async () => this.client!,\n releaseClient: async () => {},\n });\n } else {\n return new MCPTool({\n name: tool.name,\n description: tool.description || '',\n inputSchema: tool.inputSchema,\n getClient: () => this._createClient(),\n releaseClient: async (c: Client) => {\n await c.close();\n },\n });\n }\n });\n } finally {\n if (!this.stateful) {\n await listClient.close();\n }\n }\n }\n\n /**\n * Close the connection to the MCP server and clean up any resources used by the client.\n */\n async close() {\n if (!this.stateful) {\n console.log(\n `MCP client '${this.name}' initialized with stateful=false will connect and close the connection automatically for each request, no need to call 'close()' method explicitly.`\n );\n } else {\n await this._close();\n }\n }\n\n /**\n * The internal method to close the connection to the MCP server.\n */\n protected async _close() {\n try {\n await this.client?.close();\n } finally {\n console.log(`MCP client '${this.name} is closed.'`);\n this.client = undefined;\n this.transport = undefined;\n }\n }\n\n /**\n * Create a new client instance without storing it in this.client.\n * Used for stateless operations where each request needs its own client.\n * @returns A new connected Client instance\n */\n protected async _createClient(): Promise<Client> {\n const baseUrl = new URL(this.url);\n const transport =\n this.transportType === 'streamable-http'\n ? new StreamableHTTPClientTransport(baseUrl, this.transportOpts)\n : new SSEClientTransport(baseUrl, this.transportOpts);\n\n const client = new Client({\n name: this.name,\n version: '1.0.0',\n });\n await client.connect(transport, this.requestOptions);\n return client;\n }\n\n /**\n * Get a callable function for a specific tool by its name.\n * @param root0\n * @param root0.name\n * @returns An instance of MCPTool that can be called to execute the tool's functionality.\n */\n async getCallableFunction({ name }: { name: string }) {\n if (this.stateful && !this.client) {\n throw new Error(\n `Client not initialized, call 'connect()' method first for the MCP client named '${this.name}'`\n );\n }\n\n const tools = await this.listTools();\n const targetTool = tools.find(tool => tool.name === name);\n\n if (!targetTool) {\n throw new Error(\n `Tool '${name}' not found in MCP server '${this.name}'. Available tools: ${tools.map(t => t.name).join(', ')}`\n );\n }\n\n return targetTool;\n }\n}\n","import { Client } from '@modelcontextprotocol/sdk/client/index.js';\nimport { CallToolRequest, CallToolResultSchema } from '@modelcontextprotocol/sdk/types.js';\nimport z from 'zod';\n\nimport { Tool, ToolResponse } from '../tool';\nimport { createToolResponse } from '../tool/response';\nimport { ToolInputSchema } from '../type';\n\n/**\n * Type definition for getting a client instance\n */\ntype GetClient = () => Promise<Client>;\n\n/**\n * Type definition for releasing a client instance\n */\ntype ReleaseClient = (client: Client) => Promise<void>;\n\n/**\n * MCPTool class that wraps an MCP tool and provides a callable interface\n */\nexport class MCPTool implements Tool {\n name: string;\n description: string;\n inputSchema: z.ZodObject | ToolInputSchema;\n requireUserConfirm = false;\n call: (input: Record<string, unknown>) => Promise<ToolResponse>;\n\n private getClient: GetClient;\n private releaseClient: ReleaseClient;\n\n /**\n * Initialize an MCPTool instance\n * @param root0\n * @param root0.name\n * @param root0.description\n * @param root0.inputSchema\n * @param root0.getClient\n * @param root0.releaseClient\n */\n constructor({\n name,\n description,\n inputSchema,\n getClient,\n releaseClient,\n }: {\n name: string;\n description: string;\n inputSchema: z.ZodObject | ToolInputSchema;\n getClient: GetClient;\n releaseClient: ReleaseClient;\n }) {\n this.name = name;\n this.description = description;\n this.inputSchema = inputSchema;\n this.getClient = getClient;\n this.releaseClient = releaseClient;\n this.call = this._call.bind(this);\n }\n\n /**\n * Call the MCP tool with the specified input arguments. This method sends a request to the MCP server to execute\n * the tool and returns the result as a ToolResponse.\n *\n * @param arguments\n * @param input\n * @returns A ToolResponse object containing the result of the tool execution, or an error message if the call fails.\n */\n async _call(input: Record<string, unknown>) {\n const client = await this.getClient();\n try {\n const request: CallToolRequest = {\n method: 'tools/call',\n params: {\n name: this.name,\n arguments: input,\n },\n };\n const result = await client.request(request, CallToolResultSchema);\n\n const content: ToolResponse['content'] = [];\n result.content.forEach(item => {\n if (item.type === 'text') {\n content.push({ type: 'text', text: item.text, id: crypto.randomUUID() });\n } else if (item.type === 'image' || item.type === 'audio') {\n content.push({\n id: crypto.randomUUID(),\n type: 'data',\n source: { type: 'base64', mediaType: item.mimeType, data: item.data },\n });\n } else {\n console.warn(\n `Unsupported content type '${item.type}' in tool result, skipping...`\n );\n }\n });\n return createToolResponse({ content, state: 'success' });\n } catch (error) {\n return createToolResponse({\n content: [\n {\n id: crypto.randomUUID(),\n type: 'text',\n text: `Error calling tool '${this.name}': ${error}`,\n },\n ],\n state: 'error',\n });\n } finally {\n await this.releaseClient(client);\n }\n }\n}\n","import { DataBlock, TextBlock } from '../message';\nimport { JSONSerializableObject } from '../type';\n\n/**\n * The tool response structure.\n */\nexport interface ToolResponse {\n content: Array<TextBlock | DataBlock>;\n id: string;\n createdAt: string;\n metadata: Record<string, JSONSerializableObject>;\n state: 'success' | 'error' | 'interrupted' | 'running';\n isLast: boolean;\n isInterrupted: boolean;\n}\n\n/**\n * Create a tool response object with the given parameters.\n *\n * @param root0\n * @param root0.content\n * @param root0.state\n * @param root0.id\n * @param root0.createdAt\n * @param root0.metadata\n * @param root0.stream\n * @param root0.isLast\n * @param root0.isInterrupted\n * @returns A ToolResponse object\n */\nexport function createToolResponse({\n content,\n state,\n id = crypto.randomUUID(),\n createdAt = new Date().toISOString(),\n metadata = {},\n stream = false,\n isLast = true,\n isInterrupted = false,\n}: {\n content: Array<TextBlock | DataBlock>;\n state: 'success' | 'error' | 'interrupted' | 'running';\n id?: string;\n createdAt?: string;\n metadata?: Record<string, JSONSerializableObject>;\n stream?: boolean;\n isLast?: boolean;\n isInterrupted?: boolean;\n}) {\n return {\n content,\n id,\n createdAt,\n metadata,\n state,\n stream,\n isLast,\n isInterrupted,\n } as ToolResponse;\n}\n\n/**\n * If the given object conforms to the ToolResponse structure.\n *\n * @param obj\n * @returns True if the object is a ToolResponse, false otherwise\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function isToolResponse(obj: any): boolean {\n return (\n obj &&\n typeof obj === 'object' &&\n typeof obj.id === 'string' &&\n typeof obj.createdAt === 'string' &&\n Array.isArray(obj.content) &&\n typeof obj.metadata === 'object' &&\n typeof obj.stream === 'boolean' &&\n typeof obj.isLast === 'boolean' &&\n typeof obj.isInterrupted === 'boolean' &&\n ['success', 'error', 'interrupted', 'running'].includes(obj.state)\n );\n}\n","import { Client } from '@modelcontextprotocol/sdk/client/index.js';\nimport {\n StdioClientTransport,\n StdioServerParameters,\n} from '@modelcontextprotocol/sdk/client/stdio.js';\nimport { ListToolsRequest, ListToolsResultSchema, Tool } from '@modelcontextprotocol/sdk/types.js';\n\nimport { MCPTool } from './base';\n\n/**\n * The STDIO MCP client class.\n */\nexport class StdioMCPClient {\n name: string;\n private stdioServerParameters: StdioServerParameters;\n private transport?: StdioClientTransport;\n private client?: Client;\n\n /**\n * Initialize the StdioMCPClient with the given Stdio parameters.\n *\n * @param root0\n * @param root0.name\n */\n constructor({\n name,\n ...rest\n }: {\n name: string;\n } & StdioServerParameters) {\n this.name = name;\n this.stdioServerParameters = rest;\n }\n\n /**\n * Connect to the MCP server using Stdio transport. Note the Stdio client will start an\n * MCP server process under the hood.\n */\n async connect() {\n this.transport = new StdioClientTransport(this.stdioServerParameters);\n this.client = new Client({\n name: this.name,\n version: '1.0.0',\n });\n await this.client.connect(this.transport);\n }\n\n /**\n * Close the connection and stop the MCP server process.\n */\n async close() {\n try {\n if (this.client) {\n await this.client.close();\n }\n } finally {\n this.client = undefined;\n this.transport = undefined;\n }\n }\n\n /**\n * List all tools available on the MCP server.\n *\n * @returns An array of MCPTool instances representing the tools available on the server.\n */\n async listTools(): Promise<MCPTool[]> {\n if (!this.client) {\n throw new Error(\n `Client not initialized, call 'connect()' method first for the MCP client named '${this.name}'`\n );\n }\n\n const toolsRequest: ListToolsRequest = {\n method: 'tools/list',\n params: {},\n };\n\n const toolsResult = await this.client.request(toolsRequest, ListToolsResultSchema);\n if (toolsResult.tools === undefined) {\n return [];\n }\n\n return toolsResult.tools.map((tool: Tool) => {\n return new MCPTool({\n name: tool.name,\n description: tool.description || '',\n inputSchema: tool.inputSchema,\n getClient: async () => this.client!,\n releaseClient: async () => {},\n });\n });\n }\n\n /**\n * Get a callable function for a specific tool by its name.\n * @param root0\n * @param root0.name\n * @returns An instance of MCPTool that can be called to execute the tool's functionality.\n */\n async getCallableFunction({ name }: { name: string }) {\n if (!this.client) {\n throw new Error(\n `Client not initialized, call 'connect()' method first for the MCP client named '${this.name}'`\n );\n }\n\n const tools = await this.listTools();\n const targetTool = tools.find(tool => tool.name === name);\n\n if (!targetTool) {\n throw new Error(\n `Tool '${name}' not found in MCP server '${this.name}'. Available tools: ${tools.map(t => t.name).join(', ')}`\n );\n }\n\n return targetTool;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,oBAAuB;AACvB,iBAGO;AACP,4BAA8C;AAG9C,IAAAA,gBAA8D;;;ACP9D,mBAAsD;;;AC6B/C,SAAS,mBAAmB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA,KAAK,OAAO,WAAW;AAAA,EACvB,aAAY,oBAAI,KAAK,GAAE,YAAY;AAAA,EACnC,WAAW,CAAC;AAAA,EACZ,SAAS;AAAA,EACT,SAAS;AAAA,EACT,gBAAgB;AACpB,GASG;AACC,SAAO;AAAA,IACH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACJ;AACJ;;;ADtCO,IAAM,UAAN,MAA8B;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA,qBAAqB;AAAA,EACrB;AAAA,EAEQ;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWR,YAAY;AAAA,IACR;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACJ,GAMG;AACC,SAAK,OAAO;AACZ,SAAK,cAAc;AACnB,SAAK,cAAc;AACnB,SAAK,YAAY;AACjB,SAAK,gBAAgB;AACrB,SAAK,OAAO,KAAK,MAAM,KAAK,IAAI;AAAA,EACpC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAM,MAAM,OAAgC;AACxC,UAAM,SAAS,MAAM,KAAK,UAAU;AACpC,QAAI;AACA,YAAM,UAA2B;AAAA,QAC7B,QAAQ;AAAA,QACR,QAAQ;AAAA,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