@workglow/tasks 0.0.96 → 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/bun.js CHANGED
@@ -1316,6 +1316,14 @@ Workflow13.prototype.multiply = CreateAdaptiveWorkflow(ScalarMultiplyTask, Vecto
1316
1316
  Workflow13.prototype.divide = CreateAdaptiveWorkflow(ScalarDivideTask, VectorDivideTask);
1317
1317
  Workflow13.prototype.sum = CreateAdaptiveWorkflow(ScalarSumTask, VectorSumTask);
1318
1318
 
1319
+ // src/common.ts
1320
+ import {
1321
+ createMcpClient,
1322
+ mcpClientFactory as mcpClientFactory5,
1323
+ mcpServerConfigSchema as mcpServerConfigSchema5,
1324
+ mcpTransportTypes
1325
+ } from "@workglow/util";
1326
+
1319
1327
  // src/task/ArrayTask.ts
1320
1328
  import {
1321
1329
  uuid4
@@ -6451,9 +6459,705 @@ var split = (input2, config = {}) => {
6451
6459
  return task.run(input2);
6452
6460
  };
6453
6461
  Workflow22.prototype.split = CreateWorkflow21(SplitTask);
6454
- // src/task/scalar/ScalarAbsTask.ts
6462
+ // src/task/mcp/McpListTask.ts
6455
6463
  import { CreateWorkflow as CreateWorkflow22, Task as Task19, Workflow as Workflow23 } from "@workglow/task-graph";
6464
+ import {
6465
+ mcpClientFactory,
6466
+ mcpServerConfigSchema
6467
+ } from "@workglow/util";
6468
+ var mcpListTypes = ["tools", "resources", "prompts"];
6456
6469
  var inputSchema19 = {
6470
+ type: "object",
6471
+ properties: {
6472
+ ...mcpServerConfigSchema,
6473
+ list_type: {
6474
+ type: "string",
6475
+ enum: mcpListTypes,
6476
+ title: "List Type",
6477
+ description: "The type of items to list from the MCP server"
6478
+ }
6479
+ },
6480
+ required: ["transport", "list_type"],
6481
+ additionalProperties: false
6482
+ };
6483
+ var iconSchema = {
6484
+ type: "object",
6485
+ properties: {
6486
+ src: { type: "string" },
6487
+ mimeType: { type: "string" },
6488
+ sizes: { type: "array", items: { type: "string" } },
6489
+ theme: { type: "string", enum: ["light", "dark"] }
6490
+ },
6491
+ additionalProperties: false
6492
+ };
6493
+ var outputSchemaTools = {
6494
+ type: "object",
6495
+ properties: {
6496
+ tools: {
6497
+ type: "array",
6498
+ items: {
6499
+ type: "object",
6500
+ properties: {
6501
+ name: { type: "string" },
6502
+ description: { type: "string" },
6503
+ inputSchema: {
6504
+ type: "object",
6505
+ properties: {
6506
+ type: { type: "string" },
6507
+ properties: { type: "object", additionalProperties: true },
6508
+ required: { type: "array", items: { type: "string" } }
6509
+ },
6510
+ additionalProperties: true
6511
+ },
6512
+ outputSchema: {
6513
+ type: "object",
6514
+ properties: {
6515
+ type: { type: "string" },
6516
+ properties: { type: "object", additionalProperties: true },
6517
+ required: { type: "array", items: { type: "string" } }
6518
+ },
6519
+ additionalProperties: true
6520
+ },
6521
+ annotations: {
6522
+ type: "object",
6523
+ properties: {
6524
+ title: { type: "string" },
6525
+ readOnlyHint: { type: "boolean" },
6526
+ destructiveHint: { type: "boolean" },
6527
+ idempotentHint: { type: "boolean" },
6528
+ openWorldHint: { type: "boolean" }
6529
+ },
6530
+ additionalProperties: false
6531
+ },
6532
+ execution: {
6533
+ type: "object",
6534
+ properties: {
6535
+ taskSupport: {
6536
+ type: "string",
6537
+ enum: ["optional", "required", "forbidden"]
6538
+ }
6539
+ },
6540
+ additionalProperties: false
6541
+ },
6542
+ _meta: { type: "object", additionalProperties: true },
6543
+ icons: { type: "array", items: iconSchema },
6544
+ title: { type: "string" }
6545
+ },
6546
+ required: ["name", "inputSchema"],
6547
+ additionalProperties: false
6548
+ },
6549
+ title: "Tools",
6550
+ description: "The tools available on the MCP server"
6551
+ }
6552
+ },
6553
+ additionalProperties: false
6554
+ };
6555
+ var outputSchemaResources = {
6556
+ type: "object",
6557
+ properties: {
6558
+ resources: {
6559
+ type: "array",
6560
+ items: {
6561
+ type: "object",
6562
+ properties: {
6563
+ uri: { type: "string" },
6564
+ name: { type: "string" },
6565
+ description: { type: "string" },
6566
+ mimeType: { type: "string" },
6567
+ annotations: {
6568
+ type: "object",
6569
+ properties: {
6570
+ audience: {
6571
+ type: "array",
6572
+ items: { type: "string", enum: ["user", "assistant"] }
6573
+ },
6574
+ priority: { type: "number" },
6575
+ lastModified: { type: "string" }
6576
+ },
6577
+ additionalProperties: false
6578
+ },
6579
+ _meta: { type: "object", additionalProperties: true },
6580
+ icons: { type: "array", items: iconSchema },
6581
+ title: { type: "string" }
6582
+ },
6583
+ required: ["uri", "name"],
6584
+ additionalProperties: false
6585
+ },
6586
+ title: "Resources",
6587
+ description: "The resources available on the MCP server"
6588
+ }
6589
+ },
6590
+ additionalProperties: false
6591
+ };
6592
+ var outputSchemaPrompts = {
6593
+ type: "object",
6594
+ properties: {
6595
+ prompts: {
6596
+ type: "array",
6597
+ items: {
6598
+ type: "object",
6599
+ properties: {
6600
+ name: { type: "string" },
6601
+ description: { type: "string" },
6602
+ arguments: {
6603
+ type: "array",
6604
+ items: {
6605
+ type: "object",
6606
+ properties: {
6607
+ name: { type: "string" },
6608
+ description: { type: "string" },
6609
+ required: { type: "boolean" }
6610
+ },
6611
+ required: ["name"],
6612
+ additionalProperties: false
6613
+ }
6614
+ },
6615
+ _meta: { type: "object", additionalProperties: true },
6616
+ icons: { type: "array", items: iconSchema },
6617
+ title: { type: "string" }
6618
+ },
6619
+ required: ["name"],
6620
+ additionalProperties: false
6621
+ },
6622
+ title: "Prompts",
6623
+ description: "The prompts available on the MCP server"
6624
+ }
6625
+ },
6626
+ additionalProperties: false
6627
+ };
6628
+ var outputSchemaAll = {
6629
+ type: "object",
6630
+ properties: {
6631
+ ...outputSchemaTools.properties,
6632
+ ...outputSchemaResources.properties,
6633
+ ...outputSchemaPrompts.properties
6634
+ },
6635
+ additionalProperties: false
6636
+ };
6637
+
6638
+ class McpListTask extends Task19 {
6639
+ static type = "McpListTask";
6640
+ static category = "MCP";
6641
+ static title = "MCP List";
6642
+ static description = "Lists tools, resources, or prompts available on an MCP server";
6643
+ static cacheable = false;
6644
+ static hasDynamicSchemas = true;
6645
+ static inputSchema() {
6646
+ return inputSchema19;
6647
+ }
6648
+ static outputSchema() {
6649
+ return outputSchemaAll;
6650
+ }
6651
+ outputSchema() {
6652
+ const listType = this.runInputData?.list_type ?? this.defaults?.list_type ?? null;
6653
+ if (listType === null || listType === undefined) {
6654
+ return outputSchemaAll;
6655
+ }
6656
+ switch (listType) {
6657
+ case "tools":
6658
+ return outputSchemaTools;
6659
+ case "resources":
6660
+ return outputSchemaResources;
6661
+ case "prompts":
6662
+ return outputSchemaPrompts;
6663
+ default:
6664
+ return outputSchemaAll;
6665
+ }
6666
+ }
6667
+ setInput(input2) {
6668
+ if (!("list_type" in input2)) {
6669
+ super.setInput(input2);
6670
+ return;
6671
+ }
6672
+ const previousListType = this.runInputData?.list_type ?? this.defaults?.list_type ?? null;
6673
+ super.setInput(input2);
6674
+ const newListType = this.runInputData?.list_type ?? this.defaults?.list_type ?? null;
6675
+ if (previousListType !== newListType) {
6676
+ this.emitSchemaChange();
6677
+ }
6678
+ }
6679
+ async execute(input2, context) {
6680
+ const { client } = await mcpClientFactory.create(input2, context.signal);
6681
+ try {
6682
+ switch (input2.list_type) {
6683
+ case "tools": {
6684
+ const result = await client.listTools();
6685
+ return { tools: result.tools };
6686
+ }
6687
+ case "resources": {
6688
+ const result = await client.listResources();
6689
+ return { resources: result.resources };
6690
+ }
6691
+ case "prompts": {
6692
+ const result = await client.listPrompts();
6693
+ return { prompts: result.prompts };
6694
+ }
6695
+ default:
6696
+ throw new Error(`Unsupported list type: ${input2.list_type}`);
6697
+ }
6698
+ } finally {
6699
+ await client.close();
6700
+ }
6701
+ }
6702
+ }
6703
+ var mcpList = async (input2, config = {}) => {
6704
+ return new McpListTask({}, config).run(input2);
6705
+ };
6706
+ Workflow23.prototype.mcpList = CreateWorkflow22(McpListTask);
6707
+ // src/task/mcp/McpPromptGetTask.ts
6708
+ import { CreateWorkflow as CreateWorkflow23, Task as Task20, Workflow as Workflow24 } from "@workglow/task-graph";
6709
+ import {
6710
+ mcpClientFactory as mcpClientFactory2,
6711
+ mcpServerConfigSchema as mcpServerConfigSchema2
6712
+ } from "@workglow/util";
6713
+ var inputSchema20 = {
6714
+ type: "object",
6715
+ properties: {
6716
+ ...mcpServerConfigSchema2,
6717
+ prompt_name: {
6718
+ type: "string",
6719
+ title: "Prompt Name",
6720
+ description: "The name of the prompt to get"
6721
+ },
6722
+ prompt_arguments: {
6723
+ type: "object",
6724
+ additionalProperties: { type: "string" },
6725
+ title: "Prompt Arguments",
6726
+ description: "Arguments to pass to the prompt"
6727
+ }
6728
+ },
6729
+ required: ["transport", "prompt_name"],
6730
+ additionalProperties: false
6731
+ };
6732
+ var annotationsSchema = {
6733
+ type: "object",
6734
+ properties: {
6735
+ audience: {
6736
+ type: "array",
6737
+ items: { type: "string", enum: ["user", "assistant"] }
6738
+ },
6739
+ priority: { type: "number" },
6740
+ lastModified: { type: "string" }
6741
+ },
6742
+ additionalProperties: false
6743
+ };
6744
+ var contentSchema = {
6745
+ anyOf: [
6746
+ {
6747
+ type: "object",
6748
+ properties: {
6749
+ type: { type: "string", const: "text" },
6750
+ text: { type: "string" },
6751
+ annotations: annotationsSchema,
6752
+ _meta: { type: "object", additionalProperties: true }
6753
+ },
6754
+ required: ["type", "text"],
6755
+ additionalProperties: false
6756
+ },
6757
+ {
6758
+ type: "object",
6759
+ properties: {
6760
+ type: { type: "string", const: "image" },
6761
+ data: { type: "string" },
6762
+ mimeType: { type: "string" },
6763
+ annotations: annotationsSchema,
6764
+ _meta: { type: "object", additionalProperties: true }
6765
+ },
6766
+ required: ["type", "data", "mimeType"],
6767
+ additionalProperties: false
6768
+ },
6769
+ {
6770
+ type: "object",
6771
+ properties: {
6772
+ type: { type: "string", const: "audio" },
6773
+ data: { type: "string" },
6774
+ mimeType: { type: "string" },
6775
+ annotations: annotationsSchema,
6776
+ _meta: { type: "object", additionalProperties: true }
6777
+ },
6778
+ required: ["type", "data", "mimeType"],
6779
+ additionalProperties: false
6780
+ },
6781
+ {
6782
+ type: "object",
6783
+ properties: {
6784
+ type: { type: "string", const: "resource" },
6785
+ resource: {
6786
+ type: "object",
6787
+ properties: {
6788
+ uri: { type: "string" },
6789
+ text: { type: "string" },
6790
+ blob: { type: "string" },
6791
+ mimeType: { type: "string" },
6792
+ _meta: { type: "object", additionalProperties: true }
6793
+ },
6794
+ required: ["uri"],
6795
+ additionalProperties: false
6796
+ },
6797
+ annotations: annotationsSchema,
6798
+ _meta: { type: "object", additionalProperties: true }
6799
+ },
6800
+ required: ["type", "resource"],
6801
+ additionalProperties: false
6802
+ },
6803
+ {
6804
+ type: "object",
6805
+ properties: {
6806
+ type: { type: "string", const: "resource_link" },
6807
+ uri: { type: "string" },
6808
+ name: { type: "string" },
6809
+ description: { type: "string" },
6810
+ mimeType: { type: "string" },
6811
+ annotations: annotationsSchema,
6812
+ icons: {
6813
+ type: "array",
6814
+ items: {
6815
+ type: "object",
6816
+ properties: {
6817
+ src: { type: "string" },
6818
+ mimeType: { type: "string" },
6819
+ sizes: { type: "array", items: { type: "string" } },
6820
+ theme: { type: "string", enum: ["light", "dark"] }
6821
+ },
6822
+ additionalProperties: false
6823
+ }
6824
+ },
6825
+ title: { type: "string" },
6826
+ _meta: { type: "object", additionalProperties: true }
6827
+ },
6828
+ required: ["type", "uri", "name"],
6829
+ additionalProperties: false
6830
+ }
6831
+ ]
6832
+ };
6833
+ var outputSchema19 = {
6834
+ type: "object",
6835
+ properties: {
6836
+ messages: {
6837
+ type: "array",
6838
+ items: {
6839
+ type: "object",
6840
+ properties: {
6841
+ role: { type: "string", enum: ["user", "assistant"] },
6842
+ content: contentSchema
6843
+ },
6844
+ required: ["role", "content"],
6845
+ additionalProperties: false
6846
+ },
6847
+ title: "Messages",
6848
+ description: "The messages returned by the prompt"
6849
+ },
6850
+ description: {
6851
+ type: "string",
6852
+ title: "Description",
6853
+ description: "The description of the prompt"
6854
+ }
6855
+ },
6856
+ required: ["messages"],
6857
+ additionalProperties: false
6858
+ };
6859
+
6860
+ class McpPromptGetTask extends Task20 {
6861
+ static type = "McpPromptGetTask";
6862
+ static category = "MCP";
6863
+ static title = "MCP Get Prompt";
6864
+ static description = "Gets a prompt from an MCP server";
6865
+ static cacheable = false;
6866
+ static inputSchema() {
6867
+ return inputSchema20;
6868
+ }
6869
+ static outputSchema() {
6870
+ return outputSchema19;
6871
+ }
6872
+ async execute(input2, context) {
6873
+ const { client } = await mcpClientFactory2.create(input2, context.signal);
6874
+ try {
6875
+ const result = await client.getPrompt({
6876
+ name: input2.prompt_name,
6877
+ arguments: input2.prompt_arguments
6878
+ });
6879
+ return {
6880
+ messages: result.messages,
6881
+ description: result.description
6882
+ };
6883
+ } finally {
6884
+ await client.close();
6885
+ }
6886
+ }
6887
+ }
6888
+ var mcpPromptGet = async (input2, config = {}) => {
6889
+ const result = await new McpPromptGetTask({}, config).run(input2);
6890
+ return result;
6891
+ };
6892
+ Workflow24.prototype.mcpPromptGet = CreateWorkflow23(McpPromptGetTask);
6893
+ // src/task/mcp/McpResourceReadTask.ts
6894
+ import { CreateWorkflow as CreateWorkflow24, Task as Task21, Workflow as Workflow25 } from "@workglow/task-graph";
6895
+ import {
6896
+ mcpClientFactory as mcpClientFactory3,
6897
+ mcpServerConfigSchema as mcpServerConfigSchema3
6898
+ } from "@workglow/util";
6899
+ var inputSchema21 = {
6900
+ type: "object",
6901
+ properties: {
6902
+ ...mcpServerConfigSchema3,
6903
+ resource_uri: {
6904
+ type: "string",
6905
+ title: "Resource URI",
6906
+ description: "The URI of the resource to read"
6907
+ }
6908
+ },
6909
+ required: ["transport", "resource_uri"],
6910
+ additionalProperties: false
6911
+ };
6912
+ var contentItemSchema = {
6913
+ anyOf: [
6914
+ {
6915
+ type: "object",
6916
+ properties: {
6917
+ uri: { type: "string" },
6918
+ text: { type: "string" },
6919
+ mimeType: { type: "string" },
6920
+ _meta: { type: "object", additionalProperties: true }
6921
+ },
6922
+ required: ["uri", "text"],
6923
+ additionalProperties: false
6924
+ },
6925
+ {
6926
+ type: "object",
6927
+ properties: {
6928
+ uri: { type: "string" },
6929
+ blob: { type: "string" },
6930
+ mimeType: { type: "string" },
6931
+ _meta: { type: "object", additionalProperties: true }
6932
+ },
6933
+ required: ["uri", "blob"],
6934
+ additionalProperties: false
6935
+ }
6936
+ ]
6937
+ };
6938
+ var outputSchema20 = {
6939
+ type: "object",
6940
+ properties: {
6941
+ contents: {
6942
+ type: "array",
6943
+ items: contentItemSchema,
6944
+ title: "Contents",
6945
+ description: "The contents of the resource"
6946
+ }
6947
+ },
6948
+ required: ["contents"],
6949
+ additionalProperties: false
6950
+ };
6951
+
6952
+ class McpResourceReadTask extends Task21 {
6953
+ static type = "McpResourceReadTask";
6954
+ static category = "MCP";
6955
+ static title = "MCP Read Resource";
6956
+ static description = "Reads a resource from an MCP server";
6957
+ static cacheable = false;
6958
+ static inputSchema() {
6959
+ return inputSchema21;
6960
+ }
6961
+ static outputSchema() {
6962
+ return outputSchema20;
6963
+ }
6964
+ async execute(input2, context) {
6965
+ const { client } = await mcpClientFactory3.create(input2, context.signal);
6966
+ try {
6967
+ const result = await client.readResource({ uri: input2.resource_uri });
6968
+ return { contents: result.contents };
6969
+ } finally {
6970
+ await client.close();
6971
+ }
6972
+ }
6973
+ }
6974
+ var mcpResourceRead = async (input2, config = {}) => {
6975
+ return new McpResourceReadTask({}, config).run(input2);
6976
+ };
6977
+ Workflow25.prototype.mcpResourceRead = CreateWorkflow24(McpResourceReadTask);
6978
+ // src/task/mcp/McpToolCallTask.ts
6979
+ import { CreateWorkflow as CreateWorkflow25, Task as Task22, Workflow as Workflow26 } from "@workglow/task-graph";
6980
+ import {
6981
+ mcpClientFactory as mcpClientFactory4,
6982
+ mcpServerConfigSchema as mcpServerConfigSchema4
6983
+ } from "@workglow/util";
6984
+ var inputSchema22 = {
6985
+ type: "object",
6986
+ properties: {
6987
+ ...mcpServerConfigSchema4,
6988
+ tool_name: {
6989
+ type: "string",
6990
+ title: "Tool Name",
6991
+ description: "The name of the tool to call"
6992
+ },
6993
+ tool_arguments: {
6994
+ type: "object",
6995
+ additionalProperties: true,
6996
+ title: "Tool Arguments",
6997
+ description: "Arguments to pass to the tool"
6998
+ }
6999
+ },
7000
+ required: ["transport", "tool_name"],
7001
+ additionalProperties: false
7002
+ };
7003
+ var annotationsSchema2 = {
7004
+ type: "object",
7005
+ properties: {
7006
+ audience: {
7007
+ type: "array",
7008
+ items: { type: "string", enum: ["user", "assistant"] }
7009
+ },
7010
+ priority: { type: "number" },
7011
+ lastModified: { type: "string" }
7012
+ },
7013
+ additionalProperties: false
7014
+ };
7015
+ var toolContentSchema = {
7016
+ anyOf: [
7017
+ {
7018
+ type: "object",
7019
+ properties: {
7020
+ type: { type: "string", const: "text" },
7021
+ text: { type: "string" },
7022
+ annotations: annotationsSchema2,
7023
+ _meta: { type: "object", additionalProperties: true }
7024
+ },
7025
+ required: ["type", "text"],
7026
+ additionalProperties: false
7027
+ },
7028
+ {
7029
+ type: "object",
7030
+ properties: {
7031
+ type: { type: "string", const: "image" },
7032
+ data: { type: "string" },
7033
+ mimeType: { type: "string" },
7034
+ annotations: annotationsSchema2,
7035
+ _meta: { type: "object", additionalProperties: true }
7036
+ },
7037
+ required: ["type", "data", "mimeType"],
7038
+ additionalProperties: false
7039
+ },
7040
+ {
7041
+ type: "object",
7042
+ properties: {
7043
+ type: { type: "string", const: "audio" },
7044
+ data: { type: "string" },
7045
+ mimeType: { type: "string" },
7046
+ annotations: annotationsSchema2,
7047
+ _meta: { type: "object", additionalProperties: true }
7048
+ },
7049
+ required: ["type", "data", "mimeType"],
7050
+ additionalProperties: false
7051
+ },
7052
+ {
7053
+ type: "object",
7054
+ properties: {
7055
+ type: { type: "string", const: "resource" },
7056
+ resource: {
7057
+ type: "object",
7058
+ properties: {
7059
+ uri: { type: "string" },
7060
+ text: { type: "string" },
7061
+ blob: { type: "string" },
7062
+ mimeType: { type: "string" },
7063
+ _meta: { type: "object", additionalProperties: true }
7064
+ },
7065
+ required: ["uri"],
7066
+ additionalProperties: false
7067
+ },
7068
+ annotations: annotationsSchema2,
7069
+ _meta: { type: "object", additionalProperties: true }
7070
+ },
7071
+ required: ["type", "resource"],
7072
+ additionalProperties: false
7073
+ },
7074
+ {
7075
+ type: "object",
7076
+ properties: {
7077
+ type: { type: "string", const: "resource_link" },
7078
+ uri: { type: "string" },
7079
+ name: { type: "string" },
7080
+ description: { type: "string" },
7081
+ mimeType: { type: "string" },
7082
+ annotations: annotationsSchema2,
7083
+ icons: {
7084
+ type: "array",
7085
+ items: {
7086
+ type: "object",
7087
+ properties: {
7088
+ src: { type: "string" },
7089
+ mimeType: { type: "string" },
7090
+ sizes: { type: "array", items: { type: "string" } },
7091
+ theme: { type: "string", enum: ["light", "dark"] }
7092
+ },
7093
+ additionalProperties: false
7094
+ }
7095
+ },
7096
+ title: { type: "string" },
7097
+ _meta: { type: "object", additionalProperties: true }
7098
+ },
7099
+ required: ["type", "uri", "name"],
7100
+ additionalProperties: false
7101
+ }
7102
+ ]
7103
+ };
7104
+ var outputSchema21 = {
7105
+ type: "object",
7106
+ properties: {
7107
+ content: {
7108
+ type: "array",
7109
+ items: toolContentSchema,
7110
+ title: "Content",
7111
+ description: "The content returned by the tool"
7112
+ },
7113
+ isError: {
7114
+ type: "boolean",
7115
+ title: "Is Error",
7116
+ description: "Whether the tool call resulted in an error"
7117
+ }
7118
+ },
7119
+ required: ["content", "isError"],
7120
+ additionalProperties: false
7121
+ };
7122
+
7123
+ class McpToolCallTask extends Task22 {
7124
+ static type = "McpToolCallTask";
7125
+ static category = "MCP";
7126
+ static title = "MCP Call Tool";
7127
+ static description = "Calls a tool on an MCP server and returns the result";
7128
+ static cacheable = false;
7129
+ static inputSchema() {
7130
+ return inputSchema22;
7131
+ }
7132
+ static outputSchema() {
7133
+ return outputSchema21;
7134
+ }
7135
+ async execute(input2, context) {
7136
+ const { client } = await mcpClientFactory4.create(input2, context.signal);
7137
+ try {
7138
+ const result = await client.callTool({
7139
+ name: input2.tool_name,
7140
+ arguments: input2.tool_arguments
7141
+ });
7142
+ if (!("content" in result) || !Array.isArray(result.content)) {
7143
+ throw new Error("Expected tool result with content array");
7144
+ }
7145
+ return {
7146
+ content: result.content,
7147
+ isError: result.isError === true
7148
+ };
7149
+ } finally {
7150
+ await client.close();
7151
+ }
7152
+ }
7153
+ }
7154
+ var mcpToolCall = async (input2, config = {}) => {
7155
+ return new McpToolCallTask({}, config).run(input2);
7156
+ };
7157
+ Workflow26.prototype.mcpToolCall = CreateWorkflow25(McpToolCallTask);
7158
+ // src/task/scalar/ScalarAbsTask.ts
7159
+ import { CreateWorkflow as CreateWorkflow26, Task as Task23, Workflow as Workflow27 } from "@workglow/task-graph";
7160
+ var inputSchema23 = {
6457
7161
  type: "object",
6458
7162
  properties: {
6459
7163
  value: {
@@ -6465,7 +7169,7 @@ var inputSchema19 = {
6465
7169
  required: ["value"],
6466
7170
  additionalProperties: false
6467
7171
  };
6468
- var outputSchema19 = {
7172
+ var outputSchema22 = {
6469
7173
  type: "object",
6470
7174
  properties: {
6471
7175
  result: {
@@ -6478,25 +7182,25 @@ var outputSchema19 = {
6478
7182
  additionalProperties: false
6479
7183
  };
6480
7184
 
6481
- class ScalarAbsTask extends Task19 {
7185
+ class ScalarAbsTask extends Task23 {
6482
7186
  static type = "ScalarAbsTask";
6483
7187
  static category = "Math";
6484
7188
  static title = "Abs";
6485
7189
  static description = "Returns the absolute value of a number";
6486
7190
  static inputSchema() {
6487
- return inputSchema19;
7191
+ return inputSchema23;
6488
7192
  }
6489
7193
  static outputSchema() {
6490
- return outputSchema19;
7194
+ return outputSchema22;
6491
7195
  }
6492
7196
  async execute(input2, _context) {
6493
7197
  return { result: Math.abs(input2.value) };
6494
7198
  }
6495
7199
  }
6496
- Workflow23.prototype.scalarAbs = CreateWorkflow22(ScalarAbsTask);
7200
+ Workflow27.prototype.scalarAbs = CreateWorkflow26(ScalarAbsTask);
6497
7201
  // src/task/scalar/ScalarCeilTask.ts
6498
- import { CreateWorkflow as CreateWorkflow23, Task as Task20, Workflow as Workflow24 } from "@workglow/task-graph";
6499
- var inputSchema20 = {
7202
+ import { CreateWorkflow as CreateWorkflow27, Task as Task24, Workflow as Workflow28 } from "@workglow/task-graph";
7203
+ var inputSchema24 = {
6500
7204
  type: "object",
6501
7205
  properties: {
6502
7206
  value: {
@@ -6508,7 +7212,7 @@ var inputSchema20 = {
6508
7212
  required: ["value"],
6509
7213
  additionalProperties: false
6510
7214
  };
6511
- var outputSchema20 = {
7215
+ var outputSchema23 = {
6512
7216
  type: "object",
6513
7217
  properties: {
6514
7218
  result: {
@@ -6521,25 +7225,25 @@ var outputSchema20 = {
6521
7225
  additionalProperties: false
6522
7226
  };
6523
7227
 
6524
- class ScalarCeilTask extends Task20 {
7228
+ class ScalarCeilTask extends Task24 {
6525
7229
  static type = "ScalarCeilTask";
6526
7230
  static category = "Math";
6527
7231
  static title = "Ceil";
6528
7232
  static description = "Returns the smallest integer greater than or equal to a number";
6529
7233
  static inputSchema() {
6530
- return inputSchema20;
7234
+ return inputSchema24;
6531
7235
  }
6532
7236
  static outputSchema() {
6533
- return outputSchema20;
7237
+ return outputSchema23;
6534
7238
  }
6535
7239
  async execute(input2, _context) {
6536
7240
  return { result: Math.ceil(input2.value) };
6537
7241
  }
6538
7242
  }
6539
- Workflow24.prototype.scalarCeil = CreateWorkflow23(ScalarCeilTask);
7243
+ Workflow28.prototype.scalarCeil = CreateWorkflow27(ScalarCeilTask);
6540
7244
  // src/task/scalar/ScalarFloorTask.ts
6541
- import { CreateWorkflow as CreateWorkflow24, Task as Task21, Workflow as Workflow25 } from "@workglow/task-graph";
6542
- var inputSchema21 = {
7245
+ import { CreateWorkflow as CreateWorkflow28, Task as Task25, Workflow as Workflow29 } from "@workglow/task-graph";
7246
+ var inputSchema25 = {
6543
7247
  type: "object",
6544
7248
  properties: {
6545
7249
  value: {
@@ -6551,7 +7255,7 @@ var inputSchema21 = {
6551
7255
  required: ["value"],
6552
7256
  additionalProperties: false
6553
7257
  };
6554
- var outputSchema21 = {
7258
+ var outputSchema24 = {
6555
7259
  type: "object",
6556
7260
  properties: {
6557
7261
  result: {
@@ -6564,25 +7268,25 @@ var outputSchema21 = {
6564
7268
  additionalProperties: false
6565
7269
  };
6566
7270
 
6567
- class ScalarFloorTask extends Task21 {
7271
+ class ScalarFloorTask extends Task25 {
6568
7272
  static type = "ScalarFloorTask";
6569
7273
  static category = "Math";
6570
7274
  static title = "Floor";
6571
7275
  static description = "Returns the largest integer less than or equal to a number";
6572
7276
  static inputSchema() {
6573
- return inputSchema21;
7277
+ return inputSchema25;
6574
7278
  }
6575
7279
  static outputSchema() {
6576
- return outputSchema21;
7280
+ return outputSchema24;
6577
7281
  }
6578
7282
  async execute(input2, _context) {
6579
7283
  return { result: Math.floor(input2.value) };
6580
7284
  }
6581
7285
  }
6582
- Workflow25.prototype.scalarFloor = CreateWorkflow24(ScalarFloorTask);
7286
+ Workflow29.prototype.scalarFloor = CreateWorkflow28(ScalarFloorTask);
6583
7287
  // src/task/scalar/ScalarMaxTask.ts
6584
- import { CreateWorkflow as CreateWorkflow25, Task as Task22, Workflow as Workflow26 } from "@workglow/task-graph";
6585
- var inputSchema22 = {
7288
+ import { CreateWorkflow as CreateWorkflow29, Task as Task26, Workflow as Workflow30 } from "@workglow/task-graph";
7289
+ var inputSchema26 = {
6586
7290
  type: "object",
6587
7291
  properties: {
6588
7292
  values: {
@@ -6595,7 +7299,7 @@ var inputSchema22 = {
6595
7299
  required: ["values"],
6596
7300
  additionalProperties: false
6597
7301
  };
6598
- var outputSchema22 = {
7302
+ var outputSchema25 = {
6599
7303
  type: "object",
6600
7304
  properties: {
6601
7305
  result: {
@@ -6608,25 +7312,25 @@ var outputSchema22 = {
6608
7312
  additionalProperties: false
6609
7313
  };
6610
7314
 
6611
- class ScalarMaxTask extends Task22 {
7315
+ class ScalarMaxTask extends Task26 {
6612
7316
  static type = "ScalarMaxTask";
6613
7317
  static category = "Math";
6614
7318
  static title = "Max";
6615
7319
  static description = "Returns the largest of the given numbers";
6616
7320
  static inputSchema() {
6617
- return inputSchema22;
7321
+ return inputSchema26;
6618
7322
  }
6619
7323
  static outputSchema() {
6620
- return outputSchema22;
7324
+ return outputSchema25;
6621
7325
  }
6622
7326
  async execute(input2, _context) {
6623
7327
  return { result: Math.max(...input2.values) };
6624
7328
  }
6625
7329
  }
6626
- Workflow26.prototype.scalarMax = CreateWorkflow25(ScalarMaxTask);
7330
+ Workflow30.prototype.scalarMax = CreateWorkflow29(ScalarMaxTask);
6627
7331
  // src/task/scalar/ScalarMinTask.ts
6628
- import { CreateWorkflow as CreateWorkflow26, Task as Task23, Workflow as Workflow27 } from "@workglow/task-graph";
6629
- var inputSchema23 = {
7332
+ import { CreateWorkflow as CreateWorkflow30, Task as Task27, Workflow as Workflow31 } from "@workglow/task-graph";
7333
+ var inputSchema27 = {
6630
7334
  type: "object",
6631
7335
  properties: {
6632
7336
  values: {
@@ -6639,7 +7343,7 @@ var inputSchema23 = {
6639
7343
  required: ["values"],
6640
7344
  additionalProperties: false
6641
7345
  };
6642
- var outputSchema23 = {
7346
+ var outputSchema26 = {
6643
7347
  type: "object",
6644
7348
  properties: {
6645
7349
  result: {
@@ -6652,25 +7356,25 @@ var outputSchema23 = {
6652
7356
  additionalProperties: false
6653
7357
  };
6654
7358
 
6655
- class ScalarMinTask extends Task23 {
7359
+ class ScalarMinTask extends Task27 {
6656
7360
  static type = "ScalarMinTask";
6657
7361
  static category = "Math";
6658
7362
  static title = "Min";
6659
7363
  static description = "Returns the smallest of the given numbers";
6660
7364
  static inputSchema() {
6661
- return inputSchema23;
7365
+ return inputSchema27;
6662
7366
  }
6663
7367
  static outputSchema() {
6664
- return outputSchema23;
7368
+ return outputSchema26;
6665
7369
  }
6666
7370
  async execute(input2, _context) {
6667
7371
  return { result: Math.min(...input2.values) };
6668
7372
  }
6669
7373
  }
6670
- Workflow27.prototype.scalarMin = CreateWorkflow26(ScalarMinTask);
7374
+ Workflow31.prototype.scalarMin = CreateWorkflow30(ScalarMinTask);
6671
7375
  // src/task/scalar/ScalarRoundTask.ts
6672
- import { CreateWorkflow as CreateWorkflow27, Task as Task24, Workflow as Workflow28 } from "@workglow/task-graph";
6673
- var inputSchema24 = {
7376
+ import { CreateWorkflow as CreateWorkflow31, Task as Task28, Workflow as Workflow32 } from "@workglow/task-graph";
7377
+ var inputSchema28 = {
6674
7378
  type: "object",
6675
7379
  properties: {
6676
7380
  value: {
@@ -6682,7 +7386,7 @@ var inputSchema24 = {
6682
7386
  required: ["value"],
6683
7387
  additionalProperties: false
6684
7388
  };
6685
- var outputSchema24 = {
7389
+ var outputSchema27 = {
6686
7390
  type: "object",
6687
7391
  properties: {
6688
7392
  result: {
@@ -6695,25 +7399,25 @@ var outputSchema24 = {
6695
7399
  additionalProperties: false
6696
7400
  };
6697
7401
 
6698
- class ScalarRoundTask extends Task24 {
7402
+ class ScalarRoundTask extends Task28 {
6699
7403
  static type = "ScalarRoundTask";
6700
7404
  static category = "Math";
6701
7405
  static title = "Round";
6702
7406
  static description = "Returns the value of a number rounded to the nearest integer";
6703
7407
  static inputSchema() {
6704
- return inputSchema24;
7408
+ return inputSchema28;
6705
7409
  }
6706
7410
  static outputSchema() {
6707
- return outputSchema24;
7411
+ return outputSchema27;
6708
7412
  }
6709
7413
  async execute(input2, _context) {
6710
7414
  return { result: Math.round(input2.value) };
6711
7415
  }
6712
7416
  }
6713
- Workflow28.prototype.scalarRound = CreateWorkflow27(ScalarRoundTask);
7417
+ Workflow32.prototype.scalarRound = CreateWorkflow31(ScalarRoundTask);
6714
7418
  // src/task/scalar/ScalarTruncTask.ts
6715
- import { CreateWorkflow as CreateWorkflow28, Task as Task25, Workflow as Workflow29 } from "@workglow/task-graph";
6716
- var inputSchema25 = {
7419
+ import { CreateWorkflow as CreateWorkflow32, Task as Task29, Workflow as Workflow33 } from "@workglow/task-graph";
7420
+ var inputSchema29 = {
6717
7421
  type: "object",
6718
7422
  properties: {
6719
7423
  value: {
@@ -6725,7 +7429,7 @@ var inputSchema25 = {
6725
7429
  required: ["value"],
6726
7430
  additionalProperties: false
6727
7431
  };
6728
- var outputSchema25 = {
7432
+ var outputSchema28 = {
6729
7433
  type: "object",
6730
7434
  properties: {
6731
7435
  result: {
@@ -6738,28 +7442,28 @@ var outputSchema25 = {
6738
7442
  additionalProperties: false
6739
7443
  };
6740
7444
 
6741
- class ScalarTruncTask extends Task25 {
7445
+ class ScalarTruncTask extends Task29 {
6742
7446
  static type = "ScalarTruncTask";
6743
7447
  static category = "Math";
6744
7448
  static title = "Truncate";
6745
7449
  static description = "Returns the integer part of a number by removing fractional digits";
6746
7450
  static inputSchema() {
6747
- return inputSchema25;
7451
+ return inputSchema29;
6748
7452
  }
6749
7453
  static outputSchema() {
6750
- return outputSchema25;
7454
+ return outputSchema28;
6751
7455
  }
6752
7456
  async execute(input2, _context) {
6753
7457
  return { result: Math.trunc(input2.value) };
6754
7458
  }
6755
7459
  }
6756
- Workflow29.prototype.scalarTrunc = CreateWorkflow28(ScalarTruncTask);
7460
+ Workflow33.prototype.scalarTrunc = CreateWorkflow32(ScalarTruncTask);
6757
7461
  // src/task/vector/VectorDistanceTask.ts
6758
- import { CreateWorkflow as CreateWorkflow29, Task as Task26, Workflow as Workflow30 } from "@workglow/task-graph";
7462
+ import { CreateWorkflow as CreateWorkflow33, Task as Task30, Workflow as Workflow34 } from "@workglow/task-graph";
6759
7463
  import {
6760
7464
  TypedArraySchema as TypedArraySchema5
6761
7465
  } from "@workglow/util";
6762
- var inputSchema26 = {
7466
+ var inputSchema30 = {
6763
7467
  type: "object",
6764
7468
  properties: {
6765
7469
  vectors: {
@@ -6775,7 +7479,7 @@ var inputSchema26 = {
6775
7479
  required: ["vectors"],
6776
7480
  additionalProperties: false
6777
7481
  };
6778
- var outputSchema26 = {
7482
+ var outputSchema29 = {
6779
7483
  type: "object",
6780
7484
  properties: {
6781
7485
  result: {
@@ -6788,16 +7492,16 @@ var outputSchema26 = {
6788
7492
  additionalProperties: false
6789
7493
  };
6790
7494
 
6791
- class VectorDistanceTask extends Task26 {
7495
+ class VectorDistanceTask extends Task30 {
6792
7496
  static type = "VectorDistanceTask";
6793
7497
  static category = "Vector";
6794
7498
  static title = "Distance";
6795
7499
  static description = "Returns the Euclidean distance between the first two vectors";
6796
7500
  static inputSchema() {
6797
- return inputSchema26;
7501
+ return inputSchema30;
6798
7502
  }
6799
7503
  static outputSchema() {
6800
- return outputSchema26;
7504
+ return outputSchema29;
6801
7505
  }
6802
7506
  async execute(input2, _context) {
6803
7507
  const { vectors } = input2;
@@ -6815,13 +7519,13 @@ class VectorDistanceTask extends Task26 {
6815
7519
  return { result: Math.sqrt(sumPrecise(diffs)) };
6816
7520
  }
6817
7521
  }
6818
- Workflow30.prototype.vectorDistance = CreateWorkflow29(VectorDistanceTask);
7522
+ Workflow34.prototype.vectorDistance = CreateWorkflow33(VectorDistanceTask);
6819
7523
  // src/task/vector/VectorDotProductTask.ts
6820
- import { CreateWorkflow as CreateWorkflow30, Task as Task27, Workflow as Workflow31 } from "@workglow/task-graph";
7524
+ import { CreateWorkflow as CreateWorkflow34, Task as Task31, Workflow as Workflow35 } from "@workglow/task-graph";
6821
7525
  import {
6822
7526
  TypedArraySchema as TypedArraySchema6
6823
7527
  } from "@workglow/util";
6824
- var inputSchema27 = {
7528
+ var inputSchema31 = {
6825
7529
  type: "object",
6826
7530
  properties: {
6827
7531
  vectors: {
@@ -6837,7 +7541,7 @@ var inputSchema27 = {
6837
7541
  required: ["vectors"],
6838
7542
  additionalProperties: false
6839
7543
  };
6840
- var outputSchema27 = {
7544
+ var outputSchema30 = {
6841
7545
  type: "object",
6842
7546
  properties: {
6843
7547
  result: {
@@ -6850,16 +7554,16 @@ var outputSchema27 = {
6850
7554
  additionalProperties: false
6851
7555
  };
6852
7556
 
6853
- class VectorDotProductTask extends Task27 {
7557
+ class VectorDotProductTask extends Task31 {
6854
7558
  static type = "VectorDotProductTask";
6855
7559
  static category = "Vector";
6856
7560
  static title = "Dot Product";
6857
7561
  static description = "Returns the dot (inner) product of the first two vectors";
6858
7562
  static inputSchema() {
6859
- return inputSchema27;
7563
+ return inputSchema31;
6860
7564
  }
6861
7565
  static outputSchema() {
6862
- return outputSchema27;
7566
+ return outputSchema30;
6863
7567
  }
6864
7568
  async execute(input2, _context) {
6865
7569
  const { vectors } = input2;
@@ -6874,14 +7578,14 @@ class VectorDotProductTask extends Task27 {
6874
7578
  return { result: sumPrecise(products) };
6875
7579
  }
6876
7580
  }
6877
- Workflow31.prototype.vectorDotProduct = CreateWorkflow30(VectorDotProductTask);
7581
+ Workflow35.prototype.vectorDotProduct = CreateWorkflow34(VectorDotProductTask);
6878
7582
  // src/task/vector/VectorNormalizeTask.ts
6879
- import { CreateWorkflow as CreateWorkflow31, Task as Task28, Workflow as Workflow32 } from "@workglow/task-graph";
7583
+ import { CreateWorkflow as CreateWorkflow35, Task as Task32, Workflow as Workflow36 } from "@workglow/task-graph";
6880
7584
  import {
6881
7585
  TypedArraySchema as TypedArraySchema7,
6882
7586
  normalize
6883
7587
  } from "@workglow/util";
6884
- var inputSchema28 = {
7588
+ var inputSchema32 = {
6885
7589
  type: "object",
6886
7590
  properties: {
6887
7591
  vector: TypedArraySchema7({
@@ -6892,7 +7596,7 @@ var inputSchema28 = {
6892
7596
  required: ["vector"],
6893
7597
  additionalProperties: false
6894
7598
  };
6895
- var outputSchema28 = {
7599
+ var outputSchema31 = {
6896
7600
  type: "object",
6897
7601
  properties: {
6898
7602
  result: TypedArraySchema7({
@@ -6904,29 +7608,29 @@ var outputSchema28 = {
6904
7608
  additionalProperties: false
6905
7609
  };
6906
7610
 
6907
- class VectorNormalizeTask extends Task28 {
7611
+ class VectorNormalizeTask extends Task32 {
6908
7612
  static type = "VectorNormalizeTask";
6909
7613
  static category = "Vector";
6910
7614
  static title = "Normalize";
6911
7615
  static description = "Returns the L2-normalized (unit length) vector";
6912
7616
  static inputSchema() {
6913
- return inputSchema28;
7617
+ return inputSchema32;
6914
7618
  }
6915
7619
  static outputSchema() {
6916
- return outputSchema28;
7620
+ return outputSchema31;
6917
7621
  }
6918
7622
  async execute(input2, _context) {
6919
7623
  return { result: normalize(input2.vector) };
6920
7624
  }
6921
7625
  }
6922
- Workflow32.prototype.vectorNormalize = CreateWorkflow31(VectorNormalizeTask);
7626
+ Workflow36.prototype.vectorNormalize = CreateWorkflow35(VectorNormalizeTask);
6923
7627
  // src/task/vector/VectorScaleTask.ts
6924
- import { CreateWorkflow as CreateWorkflow32, Task as Task29, Workflow as Workflow33 } from "@workglow/task-graph";
7628
+ import { CreateWorkflow as CreateWorkflow36, Task as Task33, Workflow as Workflow37 } from "@workglow/task-graph";
6925
7629
  import {
6926
7630
  createTypedArrayFrom as createTypedArrayFrom5,
6927
7631
  TypedArraySchema as TypedArraySchema8
6928
7632
  } from "@workglow/util";
6929
- var inputSchema29 = {
7633
+ var inputSchema33 = {
6930
7634
  type: "object",
6931
7635
  properties: {
6932
7636
  vector: TypedArraySchema8({
@@ -6942,7 +7646,7 @@ var inputSchema29 = {
6942
7646
  required: ["vector", "scalar"],
6943
7647
  additionalProperties: false
6944
7648
  };
6945
- var outputSchema29 = {
7649
+ var outputSchema32 = {
6946
7650
  type: "object",
6947
7651
  properties: {
6948
7652
  result: TypedArraySchema8({
@@ -6954,16 +7658,16 @@ var outputSchema29 = {
6954
7658
  additionalProperties: false
6955
7659
  };
6956
7660
 
6957
- class VectorScaleTask extends Task29 {
7661
+ class VectorScaleTask extends Task33 {
6958
7662
  static type = "VectorScaleTask";
6959
7663
  static category = "Vector";
6960
7664
  static title = "Scale";
6961
7665
  static description = "Multiplies each element of a vector by a scalar";
6962
7666
  static inputSchema() {
6963
- return inputSchema29;
7667
+ return inputSchema33;
6964
7668
  }
6965
7669
  static outputSchema() {
6966
- return outputSchema29;
7670
+ return outputSchema32;
6967
7671
  }
6968
7672
  async execute(input2, _context) {
6969
7673
  const { vector, scalar } = input2;
@@ -6971,7 +7675,7 @@ class VectorScaleTask extends Task29 {
6971
7675
  return { result: createTypedArrayFrom5([vector], values) };
6972
7676
  }
6973
7677
  }
6974
- Workflow33.prototype.vectorScale = CreateWorkflow32(VectorScaleTask);
7678
+ Workflow37.prototype.vectorScale = CreateWorkflow36(VectorScaleTask);
6975
7679
 
6976
7680
  // src/common.ts
6977
7681
  import { TaskRegistry } from "@workglow/task-graph";
@@ -7006,7 +7710,11 @@ var registerCommonTasks = () => {
7006
7710
  VectorMultiplyTask,
7007
7711
  VectorNormalizeTask,
7008
7712
  VectorScaleTask,
7009
- VectorSubtractTask
7713
+ VectorSubtractTask,
7714
+ McpToolCallTask,
7715
+ McpResourceReadTask,
7716
+ McpPromptGetTask,
7717
+ McpListTask
7010
7718
  ];
7011
7719
  tasks.map(TaskRegistry.registerTask);
7012
7720
  return tasks;
@@ -7019,6 +7727,13 @@ export {
7019
7727
  registerCommonTasks,
7020
7728
  process,
7021
7729
  merge,
7730
+ mcpTransportTypes,
7731
+ mcpToolCall,
7732
+ mcpServerConfigSchema5 as mcpServerConfigSchema,
7733
+ mcpResourceRead,
7734
+ mcpPromptGet,
7735
+ mcpList,
7736
+ mcpClientFactory5 as mcpClientFactory,
7022
7737
  lambda,
7023
7738
  json,
7024
7739
  javaScript,
@@ -7026,6 +7741,7 @@ export {
7026
7741
  fetchUrl,
7027
7742
  delay,
7028
7743
  debugLog,
7744
+ createMcpClient,
7029
7745
  VectorSumTask,
7030
7746
  VectorSubtractTask,
7031
7747
  VectorScaleTask,
@@ -7050,6 +7766,10 @@ export {
7050
7766
  ScalarAbsTask,
7051
7767
  OutputTask,
7052
7768
  MergeTask,
7769
+ McpToolCallTask,
7770
+ McpResourceReadTask,
7771
+ McpPromptGetTask,
7772
+ McpListTask,
7053
7773
  LambdaTask,
7054
7774
  JsonTask,
7055
7775
  JavaScriptTask,
@@ -7062,4 +7782,4 @@ export {
7062
7782
  ArrayTask
7063
7783
  };
7064
7784
 
7065
- //# debugId=A21D807CC9BF707864756E2164756E21
7785
+ //# debugId=D4A2128BDA8D6B2F64756E2164756E21