@workglow/tasks 0.0.95 → 0.0.97

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/dist/browser.js CHANGED
@@ -1150,6 +1150,14 @@ Workflow12.prototype.multiply = CreateAdaptiveWorkflow(ScalarMultiplyTask, Vecto
1150
1150
  Workflow12.prototype.divide = CreateAdaptiveWorkflow(ScalarDivideTask, VectorDivideTask);
1151
1151
  Workflow12.prototype.sum = CreateAdaptiveWorkflow(ScalarSumTask, VectorSumTask);
1152
1152
 
1153
+ // src/common.ts
1154
+ import {
1155
+ createMcpClient,
1156
+ mcpClientFactory as mcpClientFactory5,
1157
+ mcpServerConfigSchema as mcpServerConfigSchema5,
1158
+ mcpTransportTypes
1159
+ } from "@workglow/util";
1160
+
1153
1161
  // src/task/ArrayTask.ts
1154
1162
  import {
1155
1163
  uuid4
@@ -6285,9 +6293,705 @@ var split = (input2, config = {}) => {
6285
6293
  return task.run(input2);
6286
6294
  };
6287
6295
  Workflow21.prototype.split = CreateWorkflow20(SplitTask);
6288
- // src/task/scalar/ScalarAbsTask.ts
6296
+ // src/task/mcp/McpListTask.ts
6289
6297
  import { CreateWorkflow as CreateWorkflow21, Task as Task19, Workflow as Workflow22 } from "@workglow/task-graph";
6298
+ import {
6299
+ mcpClientFactory,
6300
+ mcpServerConfigSchema
6301
+ } from "@workglow/util";
6302
+ var mcpListTypes = ["tools", "resources", "prompts"];
6290
6303
  var inputSchema19 = {
6304
+ type: "object",
6305
+ properties: {
6306
+ ...mcpServerConfigSchema,
6307
+ list_type: {
6308
+ type: "string",
6309
+ enum: mcpListTypes,
6310
+ title: "List Type",
6311
+ description: "The type of items to list from the MCP server"
6312
+ }
6313
+ },
6314
+ required: ["transport", "list_type"],
6315
+ additionalProperties: false
6316
+ };
6317
+ var iconSchema = {
6318
+ type: "object",
6319
+ properties: {
6320
+ src: { type: "string" },
6321
+ mimeType: { type: "string" },
6322
+ sizes: { type: "array", items: { type: "string" } },
6323
+ theme: { type: "string", enum: ["light", "dark"] }
6324
+ },
6325
+ additionalProperties: false
6326
+ };
6327
+ var outputSchemaTools = {
6328
+ type: "object",
6329
+ properties: {
6330
+ tools: {
6331
+ type: "array",
6332
+ items: {
6333
+ type: "object",
6334
+ properties: {
6335
+ name: { type: "string" },
6336
+ description: { type: "string" },
6337
+ inputSchema: {
6338
+ type: "object",
6339
+ properties: {
6340
+ type: { type: "string" },
6341
+ properties: { type: "object", additionalProperties: true },
6342
+ required: { type: "array", items: { type: "string" } }
6343
+ },
6344
+ additionalProperties: true
6345
+ },
6346
+ outputSchema: {
6347
+ type: "object",
6348
+ properties: {
6349
+ type: { type: "string" },
6350
+ properties: { type: "object", additionalProperties: true },
6351
+ required: { type: "array", items: { type: "string" } }
6352
+ },
6353
+ additionalProperties: true
6354
+ },
6355
+ annotations: {
6356
+ type: "object",
6357
+ properties: {
6358
+ title: { type: "string" },
6359
+ readOnlyHint: { type: "boolean" },
6360
+ destructiveHint: { type: "boolean" },
6361
+ idempotentHint: { type: "boolean" },
6362
+ openWorldHint: { type: "boolean" }
6363
+ },
6364
+ additionalProperties: false
6365
+ },
6366
+ execution: {
6367
+ type: "object",
6368
+ properties: {
6369
+ taskSupport: {
6370
+ type: "string",
6371
+ enum: ["optional", "required", "forbidden"]
6372
+ }
6373
+ },
6374
+ additionalProperties: false
6375
+ },
6376
+ _meta: { type: "object", additionalProperties: true },
6377
+ icons: { type: "array", items: iconSchema },
6378
+ title: { type: "string" }
6379
+ },
6380
+ required: ["name", "inputSchema"],
6381
+ additionalProperties: false
6382
+ },
6383
+ title: "Tools",
6384
+ description: "The tools available on the MCP server"
6385
+ }
6386
+ },
6387
+ additionalProperties: false
6388
+ };
6389
+ var outputSchemaResources = {
6390
+ type: "object",
6391
+ properties: {
6392
+ resources: {
6393
+ type: "array",
6394
+ items: {
6395
+ type: "object",
6396
+ properties: {
6397
+ uri: { type: "string" },
6398
+ name: { type: "string" },
6399
+ description: { type: "string" },
6400
+ mimeType: { type: "string" },
6401
+ annotations: {
6402
+ type: "object",
6403
+ properties: {
6404
+ audience: {
6405
+ type: "array",
6406
+ items: { type: "string", enum: ["user", "assistant"] }
6407
+ },
6408
+ priority: { type: "number" },
6409
+ lastModified: { type: "string" }
6410
+ },
6411
+ additionalProperties: false
6412
+ },
6413
+ _meta: { type: "object", additionalProperties: true },
6414
+ icons: { type: "array", items: iconSchema },
6415
+ title: { type: "string" }
6416
+ },
6417
+ required: ["uri", "name"],
6418
+ additionalProperties: false
6419
+ },
6420
+ title: "Resources",
6421
+ description: "The resources available on the MCP server"
6422
+ }
6423
+ },
6424
+ additionalProperties: false
6425
+ };
6426
+ var outputSchemaPrompts = {
6427
+ type: "object",
6428
+ properties: {
6429
+ prompts: {
6430
+ type: "array",
6431
+ items: {
6432
+ type: "object",
6433
+ properties: {
6434
+ name: { type: "string" },
6435
+ description: { type: "string" },
6436
+ arguments: {
6437
+ type: "array",
6438
+ items: {
6439
+ type: "object",
6440
+ properties: {
6441
+ name: { type: "string" },
6442
+ description: { type: "string" },
6443
+ required: { type: "boolean" }
6444
+ },
6445
+ required: ["name"],
6446
+ additionalProperties: false
6447
+ }
6448
+ },
6449
+ _meta: { type: "object", additionalProperties: true },
6450
+ icons: { type: "array", items: iconSchema },
6451
+ title: { type: "string" }
6452
+ },
6453
+ required: ["name"],
6454
+ additionalProperties: false
6455
+ },
6456
+ title: "Prompts",
6457
+ description: "The prompts available on the MCP server"
6458
+ }
6459
+ },
6460
+ additionalProperties: false
6461
+ };
6462
+ var outputSchemaAll = {
6463
+ type: "object",
6464
+ properties: {
6465
+ ...outputSchemaTools.properties,
6466
+ ...outputSchemaResources.properties,
6467
+ ...outputSchemaPrompts.properties
6468
+ },
6469
+ additionalProperties: false
6470
+ };
6471
+
6472
+ class McpListTask extends Task19 {
6473
+ static type = "McpListTask";
6474
+ static category = "MCP";
6475
+ static title = "MCP List";
6476
+ static description = "Lists tools, resources, or prompts available on an MCP server";
6477
+ static cacheable = false;
6478
+ static hasDynamicSchemas = true;
6479
+ static inputSchema() {
6480
+ return inputSchema19;
6481
+ }
6482
+ static outputSchema() {
6483
+ return outputSchemaAll;
6484
+ }
6485
+ outputSchema() {
6486
+ const listType = this.runInputData?.list_type ?? this.defaults?.list_type ?? null;
6487
+ if (listType === null || listType === undefined) {
6488
+ return outputSchemaAll;
6489
+ }
6490
+ switch (listType) {
6491
+ case "tools":
6492
+ return outputSchemaTools;
6493
+ case "resources":
6494
+ return outputSchemaResources;
6495
+ case "prompts":
6496
+ return outputSchemaPrompts;
6497
+ default:
6498
+ return outputSchemaAll;
6499
+ }
6500
+ }
6501
+ setInput(input2) {
6502
+ if (!("list_type" in input2)) {
6503
+ super.setInput(input2);
6504
+ return;
6505
+ }
6506
+ const previousListType = this.runInputData?.list_type ?? this.defaults?.list_type ?? null;
6507
+ super.setInput(input2);
6508
+ const newListType = this.runInputData?.list_type ?? this.defaults?.list_type ?? null;
6509
+ if (previousListType !== newListType) {
6510
+ this.emitSchemaChange();
6511
+ }
6512
+ }
6513
+ async execute(input2, context) {
6514
+ const { client } = await mcpClientFactory.create(input2, context.signal);
6515
+ try {
6516
+ switch (input2.list_type) {
6517
+ case "tools": {
6518
+ const result = await client.listTools();
6519
+ return { tools: result.tools };
6520
+ }
6521
+ case "resources": {
6522
+ const result = await client.listResources();
6523
+ return { resources: result.resources };
6524
+ }
6525
+ case "prompts": {
6526
+ const result = await client.listPrompts();
6527
+ return { prompts: result.prompts };
6528
+ }
6529
+ default:
6530
+ throw new Error(`Unsupported list type: ${input2.list_type}`);
6531
+ }
6532
+ } finally {
6533
+ await client.close();
6534
+ }
6535
+ }
6536
+ }
6537
+ var mcpList = async (input2, config = {}) => {
6538
+ return new McpListTask({}, config).run(input2);
6539
+ };
6540
+ Workflow22.prototype.mcpList = CreateWorkflow21(McpListTask);
6541
+ // src/task/mcp/McpPromptGetTask.ts
6542
+ import { CreateWorkflow as CreateWorkflow22, Task as Task20, Workflow as Workflow23 } from "@workglow/task-graph";
6543
+ import {
6544
+ mcpClientFactory as mcpClientFactory2,
6545
+ mcpServerConfigSchema as mcpServerConfigSchema2
6546
+ } from "@workglow/util";
6547
+ var inputSchema20 = {
6548
+ type: "object",
6549
+ properties: {
6550
+ ...mcpServerConfigSchema2,
6551
+ prompt_name: {
6552
+ type: "string",
6553
+ title: "Prompt Name",
6554
+ description: "The name of the prompt to get"
6555
+ },
6556
+ prompt_arguments: {
6557
+ type: "object",
6558
+ additionalProperties: { type: "string" },
6559
+ title: "Prompt Arguments",
6560
+ description: "Arguments to pass to the prompt"
6561
+ }
6562
+ },
6563
+ required: ["transport", "prompt_name"],
6564
+ additionalProperties: false
6565
+ };
6566
+ var annotationsSchema = {
6567
+ type: "object",
6568
+ properties: {
6569
+ audience: {
6570
+ type: "array",
6571
+ items: { type: "string", enum: ["user", "assistant"] }
6572
+ },
6573
+ priority: { type: "number" },
6574
+ lastModified: { type: "string" }
6575
+ },
6576
+ additionalProperties: false
6577
+ };
6578
+ var contentSchema = {
6579
+ anyOf: [
6580
+ {
6581
+ type: "object",
6582
+ properties: {
6583
+ type: { type: "string", const: "text" },
6584
+ text: { type: "string" },
6585
+ annotations: annotationsSchema,
6586
+ _meta: { type: "object", additionalProperties: true }
6587
+ },
6588
+ required: ["type", "text"],
6589
+ additionalProperties: false
6590
+ },
6591
+ {
6592
+ type: "object",
6593
+ properties: {
6594
+ type: { type: "string", const: "image" },
6595
+ data: { type: "string" },
6596
+ mimeType: { type: "string" },
6597
+ annotations: annotationsSchema,
6598
+ _meta: { type: "object", additionalProperties: true }
6599
+ },
6600
+ required: ["type", "data", "mimeType"],
6601
+ additionalProperties: false
6602
+ },
6603
+ {
6604
+ type: "object",
6605
+ properties: {
6606
+ type: { type: "string", const: "audio" },
6607
+ data: { type: "string" },
6608
+ mimeType: { type: "string" },
6609
+ annotations: annotationsSchema,
6610
+ _meta: { type: "object", additionalProperties: true }
6611
+ },
6612
+ required: ["type", "data", "mimeType"],
6613
+ additionalProperties: false
6614
+ },
6615
+ {
6616
+ type: "object",
6617
+ properties: {
6618
+ type: { type: "string", const: "resource" },
6619
+ resource: {
6620
+ type: "object",
6621
+ properties: {
6622
+ uri: { type: "string" },
6623
+ text: { type: "string" },
6624
+ blob: { type: "string" },
6625
+ mimeType: { type: "string" },
6626
+ _meta: { type: "object", additionalProperties: true }
6627
+ },
6628
+ required: ["uri"],
6629
+ additionalProperties: false
6630
+ },
6631
+ annotations: annotationsSchema,
6632
+ _meta: { type: "object", additionalProperties: true }
6633
+ },
6634
+ required: ["type", "resource"],
6635
+ additionalProperties: false
6636
+ },
6637
+ {
6638
+ type: "object",
6639
+ properties: {
6640
+ type: { type: "string", const: "resource_link" },
6641
+ uri: { type: "string" },
6642
+ name: { type: "string" },
6643
+ description: { type: "string" },
6644
+ mimeType: { type: "string" },
6645
+ annotations: annotationsSchema,
6646
+ icons: {
6647
+ type: "array",
6648
+ items: {
6649
+ type: "object",
6650
+ properties: {
6651
+ src: { type: "string" },
6652
+ mimeType: { type: "string" },
6653
+ sizes: { type: "array", items: { type: "string" } },
6654
+ theme: { type: "string", enum: ["light", "dark"] }
6655
+ },
6656
+ additionalProperties: false
6657
+ }
6658
+ },
6659
+ title: { type: "string" },
6660
+ _meta: { type: "object", additionalProperties: true }
6661
+ },
6662
+ required: ["type", "uri", "name"],
6663
+ additionalProperties: false
6664
+ }
6665
+ ]
6666
+ };
6667
+ var outputSchema19 = {
6668
+ type: "object",
6669
+ properties: {
6670
+ messages: {
6671
+ type: "array",
6672
+ items: {
6673
+ type: "object",
6674
+ properties: {
6675
+ role: { type: "string", enum: ["user", "assistant"] },
6676
+ content: contentSchema
6677
+ },
6678
+ required: ["role", "content"],
6679
+ additionalProperties: false
6680
+ },
6681
+ title: "Messages",
6682
+ description: "The messages returned by the prompt"
6683
+ },
6684
+ description: {
6685
+ type: "string",
6686
+ title: "Description",
6687
+ description: "The description of the prompt"
6688
+ }
6689
+ },
6690
+ required: ["messages"],
6691
+ additionalProperties: false
6692
+ };
6693
+
6694
+ class McpPromptGetTask extends Task20 {
6695
+ static type = "McpPromptGetTask";
6696
+ static category = "MCP";
6697
+ static title = "MCP Get Prompt";
6698
+ static description = "Gets a prompt from an MCP server";
6699
+ static cacheable = false;
6700
+ static inputSchema() {
6701
+ return inputSchema20;
6702
+ }
6703
+ static outputSchema() {
6704
+ return outputSchema19;
6705
+ }
6706
+ async execute(input2, context) {
6707
+ const { client } = await mcpClientFactory2.create(input2, context.signal);
6708
+ try {
6709
+ const result = await client.getPrompt({
6710
+ name: input2.prompt_name,
6711
+ arguments: input2.prompt_arguments
6712
+ });
6713
+ return {
6714
+ messages: result.messages,
6715
+ description: result.description
6716
+ };
6717
+ } finally {
6718
+ await client.close();
6719
+ }
6720
+ }
6721
+ }
6722
+ var mcpPromptGet = async (input2, config = {}) => {
6723
+ const result = await new McpPromptGetTask({}, config).run(input2);
6724
+ return result;
6725
+ };
6726
+ Workflow23.prototype.mcpPromptGet = CreateWorkflow22(McpPromptGetTask);
6727
+ // src/task/mcp/McpResourceReadTask.ts
6728
+ import { CreateWorkflow as CreateWorkflow23, Task as Task21, Workflow as Workflow24 } from "@workglow/task-graph";
6729
+ import {
6730
+ mcpClientFactory as mcpClientFactory3,
6731
+ mcpServerConfigSchema as mcpServerConfigSchema3
6732
+ } from "@workglow/util";
6733
+ var inputSchema21 = {
6734
+ type: "object",
6735
+ properties: {
6736
+ ...mcpServerConfigSchema3,
6737
+ resource_uri: {
6738
+ type: "string",
6739
+ title: "Resource URI",
6740
+ description: "The URI of the resource to read"
6741
+ }
6742
+ },
6743
+ required: ["transport", "resource_uri"],
6744
+ additionalProperties: false
6745
+ };
6746
+ var contentItemSchema = {
6747
+ anyOf: [
6748
+ {
6749
+ type: "object",
6750
+ properties: {
6751
+ uri: { type: "string" },
6752
+ text: { type: "string" },
6753
+ mimeType: { type: "string" },
6754
+ _meta: { type: "object", additionalProperties: true }
6755
+ },
6756
+ required: ["uri", "text"],
6757
+ additionalProperties: false
6758
+ },
6759
+ {
6760
+ type: "object",
6761
+ properties: {
6762
+ uri: { type: "string" },
6763
+ blob: { type: "string" },
6764
+ mimeType: { type: "string" },
6765
+ _meta: { type: "object", additionalProperties: true }
6766
+ },
6767
+ required: ["uri", "blob"],
6768
+ additionalProperties: false
6769
+ }
6770
+ ]
6771
+ };
6772
+ var outputSchema20 = {
6773
+ type: "object",
6774
+ properties: {
6775
+ contents: {
6776
+ type: "array",
6777
+ items: contentItemSchema,
6778
+ title: "Contents",
6779
+ description: "The contents of the resource"
6780
+ }
6781
+ },
6782
+ required: ["contents"],
6783
+ additionalProperties: false
6784
+ };
6785
+
6786
+ class McpResourceReadTask extends Task21 {
6787
+ static type = "McpResourceReadTask";
6788
+ static category = "MCP";
6789
+ static title = "MCP Read Resource";
6790
+ static description = "Reads a resource from an MCP server";
6791
+ static cacheable = false;
6792
+ static inputSchema() {
6793
+ return inputSchema21;
6794
+ }
6795
+ static outputSchema() {
6796
+ return outputSchema20;
6797
+ }
6798
+ async execute(input2, context) {
6799
+ const { client } = await mcpClientFactory3.create(input2, context.signal);
6800
+ try {
6801
+ const result = await client.readResource({ uri: input2.resource_uri });
6802
+ return { contents: result.contents };
6803
+ } finally {
6804
+ await client.close();
6805
+ }
6806
+ }
6807
+ }
6808
+ var mcpResourceRead = async (input2, config = {}) => {
6809
+ return new McpResourceReadTask({}, config).run(input2);
6810
+ };
6811
+ Workflow24.prototype.mcpResourceRead = CreateWorkflow23(McpResourceReadTask);
6812
+ // src/task/mcp/McpToolCallTask.ts
6813
+ import { CreateWorkflow as CreateWorkflow24, Task as Task22, Workflow as Workflow25 } from "@workglow/task-graph";
6814
+ import {
6815
+ mcpClientFactory as mcpClientFactory4,
6816
+ mcpServerConfigSchema as mcpServerConfigSchema4
6817
+ } from "@workglow/util";
6818
+ var inputSchema22 = {
6819
+ type: "object",
6820
+ properties: {
6821
+ ...mcpServerConfigSchema4,
6822
+ tool_name: {
6823
+ type: "string",
6824
+ title: "Tool Name",
6825
+ description: "The name of the tool to call"
6826
+ },
6827
+ tool_arguments: {
6828
+ type: "object",
6829
+ additionalProperties: true,
6830
+ title: "Tool Arguments",
6831
+ description: "Arguments to pass to the tool"
6832
+ }
6833
+ },
6834
+ required: ["transport", "tool_name"],
6835
+ additionalProperties: false
6836
+ };
6837
+ var annotationsSchema2 = {
6838
+ type: "object",
6839
+ properties: {
6840
+ audience: {
6841
+ type: "array",
6842
+ items: { type: "string", enum: ["user", "assistant"] }
6843
+ },
6844
+ priority: { type: "number" },
6845
+ lastModified: { type: "string" }
6846
+ },
6847
+ additionalProperties: false
6848
+ };
6849
+ var toolContentSchema = {
6850
+ anyOf: [
6851
+ {
6852
+ type: "object",
6853
+ properties: {
6854
+ type: { type: "string", const: "text" },
6855
+ text: { type: "string" },
6856
+ annotations: annotationsSchema2,
6857
+ _meta: { type: "object", additionalProperties: true }
6858
+ },
6859
+ required: ["type", "text"],
6860
+ additionalProperties: false
6861
+ },
6862
+ {
6863
+ type: "object",
6864
+ properties: {
6865
+ type: { type: "string", const: "image" },
6866
+ data: { type: "string" },
6867
+ mimeType: { type: "string" },
6868
+ annotations: annotationsSchema2,
6869
+ _meta: { type: "object", additionalProperties: true }
6870
+ },
6871
+ required: ["type", "data", "mimeType"],
6872
+ additionalProperties: false
6873
+ },
6874
+ {
6875
+ type: "object",
6876
+ properties: {
6877
+ type: { type: "string", const: "audio" },
6878
+ data: { type: "string" },
6879
+ mimeType: { type: "string" },
6880
+ annotations: annotationsSchema2,
6881
+ _meta: { type: "object", additionalProperties: true }
6882
+ },
6883
+ required: ["type", "data", "mimeType"],
6884
+ additionalProperties: false
6885
+ },
6886
+ {
6887
+ type: "object",
6888
+ properties: {
6889
+ type: { type: "string", const: "resource" },
6890
+ resource: {
6891
+ type: "object",
6892
+ properties: {
6893
+ uri: { type: "string" },
6894
+ text: { type: "string" },
6895
+ blob: { type: "string" },
6896
+ mimeType: { type: "string" },
6897
+ _meta: { type: "object", additionalProperties: true }
6898
+ },
6899
+ required: ["uri"],
6900
+ additionalProperties: false
6901
+ },
6902
+ annotations: annotationsSchema2,
6903
+ _meta: { type: "object", additionalProperties: true }
6904
+ },
6905
+ required: ["type", "resource"],
6906
+ additionalProperties: false
6907
+ },
6908
+ {
6909
+ type: "object",
6910
+ properties: {
6911
+ type: { type: "string", const: "resource_link" },
6912
+ uri: { type: "string" },
6913
+ name: { type: "string" },
6914
+ description: { type: "string" },
6915
+ mimeType: { type: "string" },
6916
+ annotations: annotationsSchema2,
6917
+ icons: {
6918
+ type: "array",
6919
+ items: {
6920
+ type: "object",
6921
+ properties: {
6922
+ src: { type: "string" },
6923
+ mimeType: { type: "string" },
6924
+ sizes: { type: "array", items: { type: "string" } },
6925
+ theme: { type: "string", enum: ["light", "dark"] }
6926
+ },
6927
+ additionalProperties: false
6928
+ }
6929
+ },
6930
+ title: { type: "string" },
6931
+ _meta: { type: "object", additionalProperties: true }
6932
+ },
6933
+ required: ["type", "uri", "name"],
6934
+ additionalProperties: false
6935
+ }
6936
+ ]
6937
+ };
6938
+ var outputSchema21 = {
6939
+ type: "object",
6940
+ properties: {
6941
+ content: {
6942
+ type: "array",
6943
+ items: toolContentSchema,
6944
+ title: "Content",
6945
+ description: "The content returned by the tool"
6946
+ },
6947
+ isError: {
6948
+ type: "boolean",
6949
+ title: "Is Error",
6950
+ description: "Whether the tool call resulted in an error"
6951
+ }
6952
+ },
6953
+ required: ["content", "isError"],
6954
+ additionalProperties: false
6955
+ };
6956
+
6957
+ class McpToolCallTask extends Task22 {
6958
+ static type = "McpToolCallTask";
6959
+ static category = "MCP";
6960
+ static title = "MCP Call Tool";
6961
+ static description = "Calls a tool on an MCP server and returns the result";
6962
+ static cacheable = false;
6963
+ static inputSchema() {
6964
+ return inputSchema22;
6965
+ }
6966
+ static outputSchema() {
6967
+ return outputSchema21;
6968
+ }
6969
+ async execute(input2, context) {
6970
+ const { client } = await mcpClientFactory4.create(input2, context.signal);
6971
+ try {
6972
+ const result = await client.callTool({
6973
+ name: input2.tool_name,
6974
+ arguments: input2.tool_arguments
6975
+ });
6976
+ if (!("content" in result) || !Array.isArray(result.content)) {
6977
+ throw new Error("Expected tool result with content array");
6978
+ }
6979
+ return {
6980
+ content: result.content,
6981
+ isError: result.isError === true
6982
+ };
6983
+ } finally {
6984
+ await client.close();
6985
+ }
6986
+ }
6987
+ }
6988
+ var mcpToolCall = async (input2, config = {}) => {
6989
+ return new McpToolCallTask({}, config).run(input2);
6990
+ };
6991
+ Workflow25.prototype.mcpToolCall = CreateWorkflow24(McpToolCallTask);
6992
+ // src/task/scalar/ScalarAbsTask.ts
6993
+ import { CreateWorkflow as CreateWorkflow25, Task as Task23, Workflow as Workflow26 } from "@workglow/task-graph";
6994
+ var inputSchema23 = {
6291
6995
  type: "object",
6292
6996
  properties: {
6293
6997
  value: {
@@ -6299,7 +7003,7 @@ var inputSchema19 = {
6299
7003
  required: ["value"],
6300
7004
  additionalProperties: false
6301
7005
  };
6302
- var outputSchema19 = {
7006
+ var outputSchema22 = {
6303
7007
  type: "object",
6304
7008
  properties: {
6305
7009
  result: {
@@ -6312,25 +7016,25 @@ var outputSchema19 = {
6312
7016
  additionalProperties: false
6313
7017
  };
6314
7018
 
6315
- class ScalarAbsTask extends Task19 {
7019
+ class ScalarAbsTask extends Task23 {
6316
7020
  static type = "ScalarAbsTask";
6317
7021
  static category = "Math";
6318
7022
  static title = "Abs";
6319
7023
  static description = "Returns the absolute value of a number";
6320
7024
  static inputSchema() {
6321
- return inputSchema19;
7025
+ return inputSchema23;
6322
7026
  }
6323
7027
  static outputSchema() {
6324
- return outputSchema19;
7028
+ return outputSchema22;
6325
7029
  }
6326
7030
  async execute(input2, _context) {
6327
7031
  return { result: Math.abs(input2.value) };
6328
7032
  }
6329
7033
  }
6330
- Workflow22.prototype.scalarAbs = CreateWorkflow21(ScalarAbsTask);
7034
+ Workflow26.prototype.scalarAbs = CreateWorkflow25(ScalarAbsTask);
6331
7035
  // src/task/scalar/ScalarCeilTask.ts
6332
- import { CreateWorkflow as CreateWorkflow22, Task as Task20, Workflow as Workflow23 } from "@workglow/task-graph";
6333
- var inputSchema20 = {
7036
+ import { CreateWorkflow as CreateWorkflow26, Task as Task24, Workflow as Workflow27 } from "@workglow/task-graph";
7037
+ var inputSchema24 = {
6334
7038
  type: "object",
6335
7039
  properties: {
6336
7040
  value: {
@@ -6342,7 +7046,7 @@ var inputSchema20 = {
6342
7046
  required: ["value"],
6343
7047
  additionalProperties: false
6344
7048
  };
6345
- var outputSchema20 = {
7049
+ var outputSchema23 = {
6346
7050
  type: "object",
6347
7051
  properties: {
6348
7052
  result: {
@@ -6355,25 +7059,25 @@ var outputSchema20 = {
6355
7059
  additionalProperties: false
6356
7060
  };
6357
7061
 
6358
- class ScalarCeilTask extends Task20 {
7062
+ class ScalarCeilTask extends Task24 {
6359
7063
  static type = "ScalarCeilTask";
6360
7064
  static category = "Math";
6361
7065
  static title = "Ceil";
6362
7066
  static description = "Returns the smallest integer greater than or equal to a number";
6363
7067
  static inputSchema() {
6364
- return inputSchema20;
7068
+ return inputSchema24;
6365
7069
  }
6366
7070
  static outputSchema() {
6367
- return outputSchema20;
7071
+ return outputSchema23;
6368
7072
  }
6369
7073
  async execute(input2, _context) {
6370
7074
  return { result: Math.ceil(input2.value) };
6371
7075
  }
6372
7076
  }
6373
- Workflow23.prototype.scalarCeil = CreateWorkflow22(ScalarCeilTask);
7077
+ Workflow27.prototype.scalarCeil = CreateWorkflow26(ScalarCeilTask);
6374
7078
  // src/task/scalar/ScalarFloorTask.ts
6375
- import { CreateWorkflow as CreateWorkflow23, Task as Task21, Workflow as Workflow24 } from "@workglow/task-graph";
6376
- var inputSchema21 = {
7079
+ import { CreateWorkflow as CreateWorkflow27, Task as Task25, Workflow as Workflow28 } from "@workglow/task-graph";
7080
+ var inputSchema25 = {
6377
7081
  type: "object",
6378
7082
  properties: {
6379
7083
  value: {
@@ -6385,7 +7089,7 @@ var inputSchema21 = {
6385
7089
  required: ["value"],
6386
7090
  additionalProperties: false
6387
7091
  };
6388
- var outputSchema21 = {
7092
+ var outputSchema24 = {
6389
7093
  type: "object",
6390
7094
  properties: {
6391
7095
  result: {
@@ -6398,25 +7102,25 @@ var outputSchema21 = {
6398
7102
  additionalProperties: false
6399
7103
  };
6400
7104
 
6401
- class ScalarFloorTask extends Task21 {
7105
+ class ScalarFloorTask extends Task25 {
6402
7106
  static type = "ScalarFloorTask";
6403
7107
  static category = "Math";
6404
7108
  static title = "Floor";
6405
7109
  static description = "Returns the largest integer less than or equal to a number";
6406
7110
  static inputSchema() {
6407
- return inputSchema21;
7111
+ return inputSchema25;
6408
7112
  }
6409
7113
  static outputSchema() {
6410
- return outputSchema21;
7114
+ return outputSchema24;
6411
7115
  }
6412
7116
  async execute(input2, _context) {
6413
7117
  return { result: Math.floor(input2.value) };
6414
7118
  }
6415
7119
  }
6416
- Workflow24.prototype.scalarFloor = CreateWorkflow23(ScalarFloorTask);
7120
+ Workflow28.prototype.scalarFloor = CreateWorkflow27(ScalarFloorTask);
6417
7121
  // src/task/scalar/ScalarMaxTask.ts
6418
- import { CreateWorkflow as CreateWorkflow24, Task as Task22, Workflow as Workflow25 } from "@workglow/task-graph";
6419
- var inputSchema22 = {
7122
+ import { CreateWorkflow as CreateWorkflow28, Task as Task26, Workflow as Workflow29 } from "@workglow/task-graph";
7123
+ var inputSchema26 = {
6420
7124
  type: "object",
6421
7125
  properties: {
6422
7126
  values: {
@@ -6429,7 +7133,7 @@ var inputSchema22 = {
6429
7133
  required: ["values"],
6430
7134
  additionalProperties: false
6431
7135
  };
6432
- var outputSchema22 = {
7136
+ var outputSchema25 = {
6433
7137
  type: "object",
6434
7138
  properties: {
6435
7139
  result: {
@@ -6442,25 +7146,25 @@ var outputSchema22 = {
6442
7146
  additionalProperties: false
6443
7147
  };
6444
7148
 
6445
- class ScalarMaxTask extends Task22 {
7149
+ class ScalarMaxTask extends Task26 {
6446
7150
  static type = "ScalarMaxTask";
6447
7151
  static category = "Math";
6448
7152
  static title = "Max";
6449
7153
  static description = "Returns the largest of the given numbers";
6450
7154
  static inputSchema() {
6451
- return inputSchema22;
7155
+ return inputSchema26;
6452
7156
  }
6453
7157
  static outputSchema() {
6454
- return outputSchema22;
7158
+ return outputSchema25;
6455
7159
  }
6456
7160
  async execute(input2, _context) {
6457
7161
  return { result: Math.max(...input2.values) };
6458
7162
  }
6459
7163
  }
6460
- Workflow25.prototype.scalarMax = CreateWorkflow24(ScalarMaxTask);
7164
+ Workflow29.prototype.scalarMax = CreateWorkflow28(ScalarMaxTask);
6461
7165
  // src/task/scalar/ScalarMinTask.ts
6462
- import { CreateWorkflow as CreateWorkflow25, Task as Task23, Workflow as Workflow26 } from "@workglow/task-graph";
6463
- var inputSchema23 = {
7166
+ import { CreateWorkflow as CreateWorkflow29, Task as Task27, Workflow as Workflow30 } from "@workglow/task-graph";
7167
+ var inputSchema27 = {
6464
7168
  type: "object",
6465
7169
  properties: {
6466
7170
  values: {
@@ -6473,7 +7177,7 @@ var inputSchema23 = {
6473
7177
  required: ["values"],
6474
7178
  additionalProperties: false
6475
7179
  };
6476
- var outputSchema23 = {
7180
+ var outputSchema26 = {
6477
7181
  type: "object",
6478
7182
  properties: {
6479
7183
  result: {
@@ -6486,25 +7190,25 @@ var outputSchema23 = {
6486
7190
  additionalProperties: false
6487
7191
  };
6488
7192
 
6489
- class ScalarMinTask extends Task23 {
7193
+ class ScalarMinTask extends Task27 {
6490
7194
  static type = "ScalarMinTask";
6491
7195
  static category = "Math";
6492
7196
  static title = "Min";
6493
7197
  static description = "Returns the smallest of the given numbers";
6494
7198
  static inputSchema() {
6495
- return inputSchema23;
7199
+ return inputSchema27;
6496
7200
  }
6497
7201
  static outputSchema() {
6498
- return outputSchema23;
7202
+ return outputSchema26;
6499
7203
  }
6500
7204
  async execute(input2, _context) {
6501
7205
  return { result: Math.min(...input2.values) };
6502
7206
  }
6503
7207
  }
6504
- Workflow26.prototype.scalarMin = CreateWorkflow25(ScalarMinTask);
7208
+ Workflow30.prototype.scalarMin = CreateWorkflow29(ScalarMinTask);
6505
7209
  // src/task/scalar/ScalarRoundTask.ts
6506
- import { CreateWorkflow as CreateWorkflow26, Task as Task24, Workflow as Workflow27 } from "@workglow/task-graph";
6507
- var inputSchema24 = {
7210
+ import { CreateWorkflow as CreateWorkflow30, Task as Task28, Workflow as Workflow31 } from "@workglow/task-graph";
7211
+ var inputSchema28 = {
6508
7212
  type: "object",
6509
7213
  properties: {
6510
7214
  value: {
@@ -6516,7 +7220,7 @@ var inputSchema24 = {
6516
7220
  required: ["value"],
6517
7221
  additionalProperties: false
6518
7222
  };
6519
- var outputSchema24 = {
7223
+ var outputSchema27 = {
6520
7224
  type: "object",
6521
7225
  properties: {
6522
7226
  result: {
@@ -6529,25 +7233,25 @@ var outputSchema24 = {
6529
7233
  additionalProperties: false
6530
7234
  };
6531
7235
 
6532
- class ScalarRoundTask extends Task24 {
7236
+ class ScalarRoundTask extends Task28 {
6533
7237
  static type = "ScalarRoundTask";
6534
7238
  static category = "Math";
6535
7239
  static title = "Round";
6536
7240
  static description = "Returns the value of a number rounded to the nearest integer";
6537
7241
  static inputSchema() {
6538
- return inputSchema24;
7242
+ return inputSchema28;
6539
7243
  }
6540
7244
  static outputSchema() {
6541
- return outputSchema24;
7245
+ return outputSchema27;
6542
7246
  }
6543
7247
  async execute(input2, _context) {
6544
7248
  return { result: Math.round(input2.value) };
6545
7249
  }
6546
7250
  }
6547
- Workflow27.prototype.scalarRound = CreateWorkflow26(ScalarRoundTask);
7251
+ Workflow31.prototype.scalarRound = CreateWorkflow30(ScalarRoundTask);
6548
7252
  // src/task/scalar/ScalarTruncTask.ts
6549
- import { CreateWorkflow as CreateWorkflow27, Task as Task25, Workflow as Workflow28 } from "@workglow/task-graph";
6550
- var inputSchema25 = {
7253
+ import { CreateWorkflow as CreateWorkflow31, Task as Task29, Workflow as Workflow32 } from "@workglow/task-graph";
7254
+ var inputSchema29 = {
6551
7255
  type: "object",
6552
7256
  properties: {
6553
7257
  value: {
@@ -6559,7 +7263,7 @@ var inputSchema25 = {
6559
7263
  required: ["value"],
6560
7264
  additionalProperties: false
6561
7265
  };
6562
- var outputSchema25 = {
7266
+ var outputSchema28 = {
6563
7267
  type: "object",
6564
7268
  properties: {
6565
7269
  result: {
@@ -6572,28 +7276,28 @@ var outputSchema25 = {
6572
7276
  additionalProperties: false
6573
7277
  };
6574
7278
 
6575
- class ScalarTruncTask extends Task25 {
7279
+ class ScalarTruncTask extends Task29 {
6576
7280
  static type = "ScalarTruncTask";
6577
7281
  static category = "Math";
6578
7282
  static title = "Truncate";
6579
7283
  static description = "Returns the integer part of a number by removing fractional digits";
6580
7284
  static inputSchema() {
6581
- return inputSchema25;
7285
+ return inputSchema29;
6582
7286
  }
6583
7287
  static outputSchema() {
6584
- return outputSchema25;
7288
+ return outputSchema28;
6585
7289
  }
6586
7290
  async execute(input2, _context) {
6587
7291
  return { result: Math.trunc(input2.value) };
6588
7292
  }
6589
7293
  }
6590
- Workflow28.prototype.scalarTrunc = CreateWorkflow27(ScalarTruncTask);
7294
+ Workflow32.prototype.scalarTrunc = CreateWorkflow31(ScalarTruncTask);
6591
7295
  // src/task/vector/VectorDistanceTask.ts
6592
- import { CreateWorkflow as CreateWorkflow28, Task as Task26, Workflow as Workflow29 } from "@workglow/task-graph";
7296
+ import { CreateWorkflow as CreateWorkflow32, Task as Task30, Workflow as Workflow33 } from "@workglow/task-graph";
6593
7297
  import {
6594
7298
  TypedArraySchema as TypedArraySchema5
6595
7299
  } from "@workglow/util";
6596
- var inputSchema26 = {
7300
+ var inputSchema30 = {
6597
7301
  type: "object",
6598
7302
  properties: {
6599
7303
  vectors: {
@@ -6609,7 +7313,7 @@ var inputSchema26 = {
6609
7313
  required: ["vectors"],
6610
7314
  additionalProperties: false
6611
7315
  };
6612
- var outputSchema26 = {
7316
+ var outputSchema29 = {
6613
7317
  type: "object",
6614
7318
  properties: {
6615
7319
  result: {
@@ -6622,16 +7326,16 @@ var outputSchema26 = {
6622
7326
  additionalProperties: false
6623
7327
  };
6624
7328
 
6625
- class VectorDistanceTask extends Task26 {
7329
+ class VectorDistanceTask extends Task30 {
6626
7330
  static type = "VectorDistanceTask";
6627
7331
  static category = "Vector";
6628
7332
  static title = "Distance";
6629
7333
  static description = "Returns the Euclidean distance between the first two vectors";
6630
7334
  static inputSchema() {
6631
- return inputSchema26;
7335
+ return inputSchema30;
6632
7336
  }
6633
7337
  static outputSchema() {
6634
- return outputSchema26;
7338
+ return outputSchema29;
6635
7339
  }
6636
7340
  async execute(input2, _context) {
6637
7341
  const { vectors } = input2;
@@ -6649,13 +7353,13 @@ class VectorDistanceTask extends Task26 {
6649
7353
  return { result: Math.sqrt(sumPrecise(diffs)) };
6650
7354
  }
6651
7355
  }
6652
- Workflow29.prototype.vectorDistance = CreateWorkflow28(VectorDistanceTask);
7356
+ Workflow33.prototype.vectorDistance = CreateWorkflow32(VectorDistanceTask);
6653
7357
  // src/task/vector/VectorDotProductTask.ts
6654
- import { CreateWorkflow as CreateWorkflow29, Task as Task27, Workflow as Workflow30 } from "@workglow/task-graph";
7358
+ import { CreateWorkflow as CreateWorkflow33, Task as Task31, Workflow as Workflow34 } from "@workglow/task-graph";
6655
7359
  import {
6656
7360
  TypedArraySchema as TypedArraySchema6
6657
7361
  } from "@workglow/util";
6658
- var inputSchema27 = {
7362
+ var inputSchema31 = {
6659
7363
  type: "object",
6660
7364
  properties: {
6661
7365
  vectors: {
@@ -6671,7 +7375,7 @@ var inputSchema27 = {
6671
7375
  required: ["vectors"],
6672
7376
  additionalProperties: false
6673
7377
  };
6674
- var outputSchema27 = {
7378
+ var outputSchema30 = {
6675
7379
  type: "object",
6676
7380
  properties: {
6677
7381
  result: {
@@ -6684,16 +7388,16 @@ var outputSchema27 = {
6684
7388
  additionalProperties: false
6685
7389
  };
6686
7390
 
6687
- class VectorDotProductTask extends Task27 {
7391
+ class VectorDotProductTask extends Task31 {
6688
7392
  static type = "VectorDotProductTask";
6689
7393
  static category = "Vector";
6690
7394
  static title = "Dot Product";
6691
7395
  static description = "Returns the dot (inner) product of the first two vectors";
6692
7396
  static inputSchema() {
6693
- return inputSchema27;
7397
+ return inputSchema31;
6694
7398
  }
6695
7399
  static outputSchema() {
6696
- return outputSchema27;
7400
+ return outputSchema30;
6697
7401
  }
6698
7402
  async execute(input2, _context) {
6699
7403
  const { vectors } = input2;
@@ -6708,14 +7412,14 @@ class VectorDotProductTask extends Task27 {
6708
7412
  return { result: sumPrecise(products) };
6709
7413
  }
6710
7414
  }
6711
- Workflow30.prototype.vectorDotProduct = CreateWorkflow29(VectorDotProductTask);
7415
+ Workflow34.prototype.vectorDotProduct = CreateWorkflow33(VectorDotProductTask);
6712
7416
  // src/task/vector/VectorNormalizeTask.ts
6713
- import { CreateWorkflow as CreateWorkflow30, Task as Task28, Workflow as Workflow31 } from "@workglow/task-graph";
7417
+ import { CreateWorkflow as CreateWorkflow34, Task as Task32, Workflow as Workflow35 } from "@workglow/task-graph";
6714
7418
  import {
6715
7419
  TypedArraySchema as TypedArraySchema7,
6716
7420
  normalize
6717
7421
  } from "@workglow/util";
6718
- var inputSchema28 = {
7422
+ var inputSchema32 = {
6719
7423
  type: "object",
6720
7424
  properties: {
6721
7425
  vector: TypedArraySchema7({
@@ -6726,7 +7430,7 @@ var inputSchema28 = {
6726
7430
  required: ["vector"],
6727
7431
  additionalProperties: false
6728
7432
  };
6729
- var outputSchema28 = {
7433
+ var outputSchema31 = {
6730
7434
  type: "object",
6731
7435
  properties: {
6732
7436
  result: TypedArraySchema7({
@@ -6738,29 +7442,29 @@ var outputSchema28 = {
6738
7442
  additionalProperties: false
6739
7443
  };
6740
7444
 
6741
- class VectorNormalizeTask extends Task28 {
7445
+ class VectorNormalizeTask extends Task32 {
6742
7446
  static type = "VectorNormalizeTask";
6743
7447
  static category = "Vector";
6744
7448
  static title = "Normalize";
6745
7449
  static description = "Returns the L2-normalized (unit length) vector";
6746
7450
  static inputSchema() {
6747
- return inputSchema28;
7451
+ return inputSchema32;
6748
7452
  }
6749
7453
  static outputSchema() {
6750
- return outputSchema28;
7454
+ return outputSchema31;
6751
7455
  }
6752
7456
  async execute(input2, _context) {
6753
7457
  return { result: normalize(input2.vector) };
6754
7458
  }
6755
7459
  }
6756
- Workflow31.prototype.vectorNormalize = CreateWorkflow30(VectorNormalizeTask);
7460
+ Workflow35.prototype.vectorNormalize = CreateWorkflow34(VectorNormalizeTask);
6757
7461
  // src/task/vector/VectorScaleTask.ts
6758
- import { CreateWorkflow as CreateWorkflow31, Task as Task29, Workflow as Workflow32 } from "@workglow/task-graph";
7462
+ import { CreateWorkflow as CreateWorkflow35, Task as Task33, Workflow as Workflow36 } from "@workglow/task-graph";
6759
7463
  import {
6760
7464
  createTypedArrayFrom as createTypedArrayFrom5,
6761
7465
  TypedArraySchema as TypedArraySchema8
6762
7466
  } from "@workglow/util";
6763
- var inputSchema29 = {
7467
+ var inputSchema33 = {
6764
7468
  type: "object",
6765
7469
  properties: {
6766
7470
  vector: TypedArraySchema8({
@@ -6776,7 +7480,7 @@ var inputSchema29 = {
6776
7480
  required: ["vector", "scalar"],
6777
7481
  additionalProperties: false
6778
7482
  };
6779
- var outputSchema29 = {
7483
+ var outputSchema32 = {
6780
7484
  type: "object",
6781
7485
  properties: {
6782
7486
  result: TypedArraySchema8({
@@ -6788,16 +7492,16 @@ var outputSchema29 = {
6788
7492
  additionalProperties: false
6789
7493
  };
6790
7494
 
6791
- class VectorScaleTask extends Task29 {
7495
+ class VectorScaleTask extends Task33 {
6792
7496
  static type = "VectorScaleTask";
6793
7497
  static category = "Vector";
6794
7498
  static title = "Scale";
6795
7499
  static description = "Multiplies each element of a vector by a scalar";
6796
7500
  static inputSchema() {
6797
- return inputSchema29;
7501
+ return inputSchema33;
6798
7502
  }
6799
7503
  static outputSchema() {
6800
- return outputSchema29;
7504
+ return outputSchema32;
6801
7505
  }
6802
7506
  async execute(input2, _context) {
6803
7507
  const { vector, scalar } = input2;
@@ -6805,7 +7509,7 @@ class VectorScaleTask extends Task29 {
6805
7509
  return { result: createTypedArrayFrom5([vector], values) };
6806
7510
  }
6807
7511
  }
6808
- Workflow32.prototype.vectorScale = CreateWorkflow31(VectorScaleTask);
7512
+ Workflow36.prototype.vectorScale = CreateWorkflow35(VectorScaleTask);
6809
7513
 
6810
7514
  // src/common.ts
6811
7515
  import { TaskRegistry } from "@workglow/task-graph";
@@ -6840,7 +7544,11 @@ var registerCommonTasks = () => {
6840
7544
  VectorMultiplyTask,
6841
7545
  VectorNormalizeTask,
6842
7546
  VectorScaleTask,
6843
- VectorSubtractTask
7547
+ VectorSubtractTask,
7548
+ McpToolCallTask,
7549
+ McpResourceReadTask,
7550
+ McpPromptGetTask,
7551
+ McpListTask
6844
7552
  ];
6845
7553
  tasks.map(TaskRegistry.registerTask);
6846
7554
  return tasks;
@@ -6853,6 +7561,13 @@ export {
6853
7561
  registerCommonTasks,
6854
7562
  process,
6855
7563
  merge,
7564
+ mcpTransportTypes,
7565
+ mcpToolCall,
7566
+ mcpServerConfigSchema5 as mcpServerConfigSchema,
7567
+ mcpResourceRead,
7568
+ mcpPromptGet,
7569
+ mcpList,
7570
+ mcpClientFactory5 as mcpClientFactory,
6856
7571
  lambda,
6857
7572
  json,
6858
7573
  javaScript,
@@ -6860,6 +7575,7 @@ export {
6860
7575
  fetchUrl,
6861
7576
  delay,
6862
7577
  debugLog,
7578
+ createMcpClient,
6863
7579
  VectorSumTask,
6864
7580
  VectorSubtractTask,
6865
7581
  VectorScaleTask,
@@ -6884,6 +7600,10 @@ export {
6884
7600
  ScalarAbsTask,
6885
7601
  OutputTask,
6886
7602
  MergeTask,
7603
+ McpToolCallTask,
7604
+ McpResourceReadTask,
7605
+ McpPromptGetTask,
7606
+ McpListTask,
6887
7607
  LambdaTask,
6888
7608
  JsonTask,
6889
7609
  JavaScriptTask,
@@ -6896,4 +7616,4 @@ export {
6896
7616
  ArrayTask
6897
7617
  };
6898
7618
 
6899
- //# debugId=36DF5FE9FCA51F3064756E2164756E21
7619
+ //# debugId=02B760AAB3F989C464756E2164756E21