@salesforce/magen-mcp-workflow 0.0.1

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 (134) hide show
  1. package/README.md +168 -0
  2. package/dist/checkpointing/index.d.ts +3 -0
  3. package/dist/checkpointing/index.js +10 -0
  4. package/dist/checkpointing/index.js.map +1 -0
  5. package/dist/checkpointing/jsonCheckpointer.d.ts +19 -0
  6. package/dist/checkpointing/jsonCheckpointer.js +164 -0
  7. package/dist/checkpointing/jsonCheckpointer.js.map +1 -0
  8. package/dist/checkpointing/statePersistence.d.ts +26 -0
  9. package/dist/checkpointing/statePersistence.js +117 -0
  10. package/dist/checkpointing/statePersistence.js.map +1 -0
  11. package/dist/checkpointing/workflowStateManager.d.ts +99 -0
  12. package/dist/checkpointing/workflowStateManager.js +206 -0
  13. package/dist/checkpointing/workflowStateManager.js.map +1 -0
  14. package/dist/common/fileSystem.d.ts +113 -0
  15. package/dist/common/fileSystem.js +62 -0
  16. package/dist/common/fileSystem.js.map +1 -0
  17. package/dist/common/metadata.d.ts +93 -0
  18. package/dist/common/metadata.js +40 -0
  19. package/dist/common/metadata.js.map +1 -0
  20. package/dist/common/propertyMetadata.d.ts +58 -0
  21. package/dist/common/propertyMetadata.js +8 -0
  22. package/dist/common/propertyMetadata.js.map +1 -0
  23. package/dist/common/types.d.ts +16 -0
  24. package/dist/common/types.js +8 -0
  25. package/dist/common/types.js.map +1 -0
  26. package/dist/index.d.ts +15 -0
  27. package/dist/index.js +37 -0
  28. package/dist/index.js.map +1 -0
  29. package/dist/logging/logger.d.ts +56 -0
  30. package/dist/logging/logger.js +113 -0
  31. package/dist/logging/logger.js.map +1 -0
  32. package/dist/nodes/abstractBaseNode.d.ts +27 -0
  33. package/dist/nodes/abstractBaseNode.js +34 -0
  34. package/dist/nodes/abstractBaseNode.js.map +1 -0
  35. package/dist/nodes/abstractToolNode.d.ts +32 -0
  36. package/dist/nodes/abstractToolNode.js +44 -0
  37. package/dist/nodes/abstractToolNode.js.map +1 -0
  38. package/dist/nodes/getUserInput/factory.d.ts +42 -0
  39. package/dist/nodes/getUserInput/factory.js +64 -0
  40. package/dist/nodes/getUserInput/factory.js.map +1 -0
  41. package/dist/nodes/getUserInput/index.d.ts +2 -0
  42. package/dist/nodes/getUserInput/index.js +3 -0
  43. package/dist/nodes/getUserInput/index.js.map +1 -0
  44. package/dist/nodes/getUserInput/node.d.ts +68 -0
  45. package/dist/nodes/getUserInput/node.js +41 -0
  46. package/dist/nodes/getUserInput/node.js.map +1 -0
  47. package/dist/nodes/index.d.ts +5 -0
  48. package/dist/nodes/index.js +12 -0
  49. package/dist/nodes/index.js.map +1 -0
  50. package/dist/nodes/toolExecutor.d.ts +22 -0
  51. package/dist/nodes/toolExecutor.js +19 -0
  52. package/dist/nodes/toolExecutor.js.map +1 -0
  53. package/dist/nodes/userInputExtraction/factory.d.ts +42 -0
  54. package/dist/nodes/userInputExtraction/factory.js +55 -0
  55. package/dist/nodes/userInputExtraction/factory.js.map +1 -0
  56. package/dist/nodes/userInputExtraction/index.d.ts +2 -0
  57. package/dist/nodes/userInputExtraction/index.js +3 -0
  58. package/dist/nodes/userInputExtraction/index.js.map +1 -0
  59. package/dist/nodes/userInputExtraction/node.d.ts +60 -0
  60. package/dist/nodes/userInputExtraction/node.js +24 -0
  61. package/dist/nodes/userInputExtraction/node.js.map +1 -0
  62. package/dist/routers/checkPropertiesFulfilledRouter.d.ts +74 -0
  63. package/dist/routers/checkPropertiesFulfilledRouter.js +106 -0
  64. package/dist/routers/checkPropertiesFulfilledRouter.js.map +1 -0
  65. package/dist/routers/index.d.ts +1 -0
  66. package/dist/routers/index.js +8 -0
  67. package/dist/routers/index.js.map +1 -0
  68. package/dist/services/abstractService.d.ts +71 -0
  69. package/dist/services/abstractService.js +83 -0
  70. package/dist/services/abstractService.js.map +1 -0
  71. package/dist/services/getInputService.d.ts +43 -0
  72. package/dist/services/getInputService.js +48 -0
  73. package/dist/services/getInputService.js.map +1 -0
  74. package/dist/services/index.d.ts +3 -0
  75. package/dist/services/index.js +10 -0
  76. package/dist/services/index.js.map +1 -0
  77. package/dist/services/inputExtractionService.d.ts +46 -0
  78. package/dist/services/inputExtractionService.js +133 -0
  79. package/dist/services/inputExtractionService.js.map +1 -0
  80. package/dist/storage/wellKnownDirectory.d.ts +79 -0
  81. package/dist/storage/wellKnownDirectory.js +121 -0
  82. package/dist/storage/wellKnownDirectory.js.map +1 -0
  83. package/dist/tools/base/abstractTool.d.ts +61 -0
  84. package/dist/tools/base/abstractTool.js +87 -0
  85. package/dist/tools/base/abstractTool.js.map +1 -0
  86. package/dist/tools/base/abstractWorkflowTool.d.ts +34 -0
  87. package/dist/tools/base/abstractWorkflowTool.js +94 -0
  88. package/dist/tools/base/abstractWorkflowTool.js.map +1 -0
  89. package/dist/tools/base/index.d.ts +2 -0
  90. package/dist/tools/base/index.js +9 -0
  91. package/dist/tools/base/index.js.map +1 -0
  92. package/dist/tools/orchestrator/config.d.ts +55 -0
  93. package/dist/tools/orchestrator/config.js +8 -0
  94. package/dist/tools/orchestrator/config.js.map +1 -0
  95. package/dist/tools/orchestrator/index.d.ts +3 -0
  96. package/dist/tools/orchestrator/index.js +9 -0
  97. package/dist/tools/orchestrator/index.js.map +1 -0
  98. package/dist/tools/orchestrator/metadata.d.ts +55 -0
  99. package/dist/tools/orchestrator/metadata.js +49 -0
  100. package/dist/tools/orchestrator/metadata.js.map +1 -0
  101. package/dist/tools/orchestrator/orchestratorTool.d.ts +39 -0
  102. package/dist/tools/orchestrator/orchestratorTool.js +186 -0
  103. package/dist/tools/orchestrator/orchestratorTool.js.map +1 -0
  104. package/dist/tools/utilities/getInput/factory.d.ts +43 -0
  105. package/dist/tools/utilities/getInput/factory.js +32 -0
  106. package/dist/tools/utilities/getInput/factory.js.map +1 -0
  107. package/dist/tools/utilities/getInput/index.d.ts +3 -0
  108. package/dist/tools/utilities/getInput/index.js +10 -0
  109. package/dist/tools/utilities/getInput/index.js.map +1 -0
  110. package/dist/tools/utilities/getInput/metadata.d.ts +78 -0
  111. package/dist/tools/utilities/getInput/metadata.js +43 -0
  112. package/dist/tools/utilities/getInput/metadata.js.map +1 -0
  113. package/dist/tools/utilities/getInput/tool.d.ts +89 -0
  114. package/dist/tools/utilities/getInput/tool.js +69 -0
  115. package/dist/tools/utilities/getInput/tool.js.map +1 -0
  116. package/dist/tools/utilities/index.d.ts +2 -0
  117. package/dist/tools/utilities/index.js +9 -0
  118. package/dist/tools/utilities/index.js.map +1 -0
  119. package/dist/tools/utilities/inputExtraction/factory.d.ts +43 -0
  120. package/dist/tools/utilities/inputExtraction/factory.js +32 -0
  121. package/dist/tools/utilities/inputExtraction/factory.js.map +1 -0
  122. package/dist/tools/utilities/inputExtraction/index.d.ts +3 -0
  123. package/dist/tools/utilities/inputExtraction/index.js +10 -0
  124. package/dist/tools/utilities/inputExtraction/index.js.map +1 -0
  125. package/dist/tools/utilities/inputExtraction/metadata.d.ts +66 -0
  126. package/dist/tools/utilities/inputExtraction/metadata.js +52 -0
  127. package/dist/tools/utilities/inputExtraction/metadata.js.map +1 -0
  128. package/dist/tools/utilities/inputExtraction/tool.d.ts +82 -0
  129. package/dist/tools/utilities/inputExtraction/tool.js +71 -0
  130. package/dist/tools/utilities/inputExtraction/tool.js.map +1 -0
  131. package/dist/utils/toolExecutionUtils.d.ts +55 -0
  132. package/dist/utils/toolExecutionUtils.js +70 -0
  133. package/dist/utils/toolExecutionUtils.js.map +1 -0
  134. package/package.json +42 -0
@@ -0,0 +1,94 @@
1
+ /*
2
+ * Copyright (c) 2025, salesforce.com, inc.
3
+ * All rights reserved.
4
+ * SPDX-License-Identifier: MIT
5
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6
+ */
7
+ import { zodToJsonSchema } from 'zod-to-json-schema';
8
+ import { AbstractTool } from './abstractTool.js';
9
+ import { WORKFLOW_PROPERTY_NAMES, } from '../../common/metadata.js';
10
+ /**
11
+ * Abstract base class for all workflow-participating tools.
12
+ *
13
+ * Workflow tools return guidance prompts that instruct the LLM to invoke the
14
+ * orchestrator tool next, along with the necessary workflow state data.
15
+ *
16
+ * The orchestrator tool itself extends AbstractTool directly, as it controls
17
+ * the workflow rather than participating in it.
18
+ */
19
+ export class AbstractWorkflowTool extends AbstractTool {
20
+ orchestratorToolId;
21
+ constructor(server, toolMetadata, orchestratorToolId, // ID of the orchestrator managing this workflow
22
+ loggerComponentName, logger) {
23
+ super(server, toolMetadata, loggerComponentName, logger);
24
+ this.orchestratorToolId = orchestratorToolId;
25
+ }
26
+ /**
27
+ * Utility method for tools to add post-invocation instructions
28
+ * that guide the LLM back to the orchestrator for workflow continuation.
29
+ *
30
+ * This does NOT invoke the orchestrator - it creates guidance prompts that
31
+ * instruct the LLM to invoke the orchestrator tool next.
32
+ *
33
+ * @param prompt The main tool response prompt
34
+ * @param workflowStateData Workflow state data to round-trip back to orchestrator
35
+ * @param resultSchema The optional result schema to format the LLM's output.
36
+ * If not provided, uses the tool's default result schema.
37
+ * @returns Complete prompt with post-invocation instructions
38
+ */
39
+ finalizeWorkflowToolOutput(prompt, workflowStateData, resultSchema) {
40
+ let resultSchemaToUse = resultSchema ?? this.toolMetadata.resultSchema;
41
+ if (!(typeof resultSchemaToUse === 'string')) {
42
+ resultSchemaToUse = JSON.stringify(zodToJsonSchema(resultSchemaToUse));
43
+ }
44
+ // Create guidance instructions that tell the LLM to invoke the orchestrator next
45
+ const postInstructions = `
46
+
47
+ # Post-Tool-Invocation Instructions
48
+
49
+ ## 1. Format the results from the execution of your task
50
+
51
+ The output of your task should conform to the following JSON schema:
52
+
53
+ \`\`\`json
54
+ ${resultSchemaToUse}
55
+ \`\`\`
56
+
57
+ A string representation of this JSON schema can also be found in the \`resultSchema\`
58
+ field of this tool's output schema.
59
+
60
+ ## 2. Invoke the next tool to continue the workflow
61
+
62
+ You MUST initiate the following actions to proceed with the in-progress workflow you are
63
+ participating in.
64
+
65
+ ### 2.1. Invoke the \`${this.orchestratorToolId}\` tool
66
+
67
+ Invoke the \`${this.orchestratorToolId}\` tool to continue the workflow.
68
+
69
+ ### 2.2 Provide input values to the tool
70
+
71
+ Provide the following input values to the \`${this.orchestratorToolId}\` tool:
72
+
73
+ - \`${WORKFLOW_PROPERTY_NAMES.userInput}\`: The structured results from the execution of your task, as specified in the first Post-Tool-Invocation step.
74
+ - \`${WORKFLOW_PROPERTY_NAMES.workflowStateData}\`: ${JSON.stringify(workflowStateData)}
75
+
76
+ This will continue the workflow orchestration process.
77
+ `;
78
+ const promptForLLM = prompt + postInstructions;
79
+ const result = {
80
+ promptForLLM,
81
+ resultSchema: resultSchemaToUse,
82
+ };
83
+ return {
84
+ content: [
85
+ {
86
+ type: 'text',
87
+ text: JSON.stringify(result),
88
+ },
89
+ ],
90
+ structuredContent: result,
91
+ };
92
+ }
93
+ }
94
+ //# sourceMappingURL=abstractWorkflowTool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abstractWorkflowTool.js","sourceRoot":"","sources":["../../../src/tools/base/abstractWorkflowTool.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGrD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAGL,uBAAuB,GAIxB,MAAM,0BAA0B,CAAC;AAGlC;;;;;;;;GAQG;AACH,MAAM,OAAgB,oBAMpB,SAAQ,YAAuB;IACZ,kBAAkB,CAAS;IAE9C,YACE,MAAiB,EACjB,YAAuB,EACvB,kBAA0B,EAAE,gDAAgD;IAC5E,mBAA4B,EAC5B,MAAe;QAEf,KAAK,CAAC,MAAM,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,CAAC,CAAC;QACzD,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;IAC/C,CAAC;IAED;;;;;;;;;;;;OAYG;IACO,0BAA0B,CAClC,MAAc,EACd,iBAAoC,EACpC,YAAiD;QAEjD,IAAI,iBAAiB,GAAG,YAAY,IAAI,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC;QACvE,IAAI,CAAC,CAAC,OAAO,iBAAiB,KAAK,QAAQ,CAAC,EAAE,CAAC;YAC7C,iBAAiB,GAAG,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,iBAAiB,CAAC,CAAC,CAAC;QACzE,CAAC;QAED,iFAAiF;QACjF,MAAM,gBAAgB,GAAG;;;;;;;;;EAS3B,iBAAiB;;;;;;;;;;;wBAWK,IAAI,CAAC,kBAAkB;;eAEhC,IAAI,CAAC,kBAAkB;;;;8CAIQ,IAAI,CAAC,kBAAkB;;MAE/D,uBAAuB,CAAC,SAAS;MACjC,uBAAuB,CAAC,iBAAiB,OAAO,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC;;;CAGtF,CAAC;QAEE,MAAM,YAAY,GAAG,MAAM,GAAG,gBAAgB,CAAC;QAC/C,MAAM,MAAM,GAA0B;YACpC,YAAY;YACZ,YAAY,EAAE,iBAAiB;SAChC,CAAC;QACF,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;iBAC7B;aACF;YACD,iBAAiB,EAAE,MAAM;SAC1B,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,2 @@
1
+ export { AbstractTool } from './abstractTool.js';
2
+ export { AbstractWorkflowTool } from './abstractWorkflowTool.js';
@@ -0,0 +1,9 @@
1
+ /*
2
+ * Copyright (c) 2025, salesforce.com, inc.
3
+ * All rights reserved.
4
+ * SPDX-License-Identifier: MIT
5
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6
+ */
7
+ export { AbstractTool } from './abstractTool.js';
8
+ export { AbstractWorkflowTool } from './abstractWorkflowTool.js';
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/base/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,55 @@
1
+ import { StateGraph } from '@langchain/langgraph';
2
+ import { Logger } from '../../logging/logger.js';
3
+ import { WorkflowStateManager } from '../../checkpointing/workflowStateManager.js';
4
+ /**
5
+ * Orchestrator configuration interface
6
+ *
7
+ * Example usage:
8
+ * ```
9
+ * const MyWorkflowState = Annotation.Root({ messages: Annotation<string[]> });
10
+ * const workflow = new StateGraph(MyWorkflowState)
11
+ * .addNode('start', (state) => ({ messages: ['Started'] }))
12
+ * .addEdge(START, 'start')
13
+ * .addEdge('start', END);
14
+ *
15
+ * const config: OrchestratorConfig = {
16
+ * toolId: 'my-orchestrator',
17
+ * title: 'My Orchestrator',
18
+ * description: 'Orchestrates my workflow',
19
+ * workflow,
20
+ * };
21
+ * ```
22
+ */
23
+ export interface OrchestratorConfig {
24
+ /** Unique tool identifier for MCP registration */
25
+ toolId: string;
26
+ /** Extended tool title for display */
27
+ title: string;
28
+ /** Tool description for documentation */
29
+ description: string;
30
+ /**
31
+ * The LangGraph StateGraph workflow definition (uncompiled)
32
+ *
33
+ * Note: StateGraph generic types are inferred from construction and don't need
34
+ * to be specified here. The orchestrator will compile the workflow at runtime
35
+ * with the appropriate checkpointer.
36
+ */
37
+ workflow: StateGraph<any, any, any, any, any, any, any, any>;
38
+ /**
39
+ * Workflow state manager for checkpointing and persistence
40
+ *
41
+ * Optional - if not provided, a default WorkflowStateManager will be created
42
+ * with production environment settings.
43
+ *
44
+ * Provide a custom instance to:
45
+ * - Use test environment (in-memory state, no file I/O)
46
+ * - Customize well-known directory paths
47
+ * - Inject a mock for testing
48
+ */
49
+ stateManager?: WorkflowStateManager;
50
+ /**
51
+ * Logger instance for workflow operations
52
+ * Optional - defaults to logger using wellKnownDirectory for log files
53
+ */
54
+ logger?: Logger;
55
+ }
@@ -0,0 +1,8 @@
1
+ /*
2
+ * Copyright (c) 2025, salesforce.com, inc.
3
+ * All rights reserved.
4
+ * SPDX-License-Identifier: MIT
5
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/tools/orchestrator/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
@@ -0,0 +1,3 @@
1
+ export { type OrchestratorConfig } from './config.js';
2
+ export { type OrchestratorInput, type OrchestratorOutput, type OrchestratorToolMetadata, ORCHESTRATOR_INPUT_SCHEMA, ORCHESTRATOR_OUTPUT_SCHEMA, createOrchestratorToolMetadata, } from './metadata.js';
3
+ export { OrchestratorTool } from './orchestratorTool.js';
@@ -0,0 +1,9 @@
1
+ /*
2
+ * Copyright (c) 2025, salesforce.com, inc.
3
+ * All rights reserved.
4
+ * SPDX-License-Identifier: MIT
5
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6
+ */
7
+ export { ORCHESTRATOR_INPUT_SCHEMA, ORCHESTRATOR_OUTPUT_SCHEMA, createOrchestratorToolMetadata, } from './metadata.js';
8
+ export { OrchestratorTool } from './orchestratorTool.js';
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/orchestrator/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAIL,yBAAyB,EACzB,0BAA0B,EAC1B,8BAA8B,GAC/B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,55 @@
1
+ import z from 'zod';
2
+ import { ToolMetadata } from '../../common/metadata.js';
3
+ import type { OrchestratorConfig } from './config.js';
4
+ /**
5
+ * Orchestrator input schema
6
+ *
7
+ * Note: The workflow state data is optional/defaulted because the orchestrator
8
+ * can start new workflows (where it doesn't exist yet) or continue existing ones.
9
+ */
10
+ export declare const ORCHESTRATOR_INPUT_SCHEMA: z.ZodObject<{
11
+ userInput: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
12
+ workflowStateData: z.ZodDefault<z.ZodObject<{
13
+ thread_id: z.ZodString;
14
+ }, "strip", z.ZodTypeAny, {
15
+ thread_id: string;
16
+ }, {
17
+ thread_id: string;
18
+ }>>;
19
+ }, "strip", z.ZodTypeAny, {
20
+ workflowStateData: {
21
+ thread_id: string;
22
+ };
23
+ userInput?: Record<string, unknown> | undefined;
24
+ }, {
25
+ workflowStateData?: {
26
+ thread_id: string;
27
+ } | undefined;
28
+ userInput?: Record<string, unknown> | undefined;
29
+ }>;
30
+ export type OrchestratorInput = z.infer<typeof ORCHESTRATOR_INPUT_SCHEMA>;
31
+ /**
32
+ * Orchestrator output schema - natural language orchestration prompt
33
+ */
34
+ export declare const ORCHESTRATOR_OUTPUT_SCHEMA: z.ZodObject<{
35
+ orchestrationInstructionsPrompt: z.ZodString;
36
+ }, "strip", z.ZodTypeAny, {
37
+ orchestrationInstructionsPrompt: string;
38
+ }, {
39
+ orchestrationInstructionsPrompt: string;
40
+ }>;
41
+ export type OrchestratorOutput = z.infer<typeof ORCHESTRATOR_OUTPUT_SCHEMA>;
42
+ /**
43
+ * Orchestrator tool metadata type
44
+ * The metadata for the orchestrator tool (inputs/outputs)
45
+ */
46
+ export type OrchestratorToolMetadata = ToolMetadata<typeof ORCHESTRATOR_INPUT_SCHEMA, typeof ORCHESTRATOR_OUTPUT_SCHEMA>;
47
+ /**
48
+ * Factory function to create orchestrator tool metadata from configuration
49
+ * Takes the consumer-provided config and creates the tool metadata with
50
+ * standardized input/output schemas.
51
+ *
52
+ * @param config - The orchestrator configuration
53
+ * @returns Tool metadata with the specified toolId, title, description
54
+ */
55
+ export declare function createOrchestratorToolMetadata(config: OrchestratorConfig): OrchestratorToolMetadata;
@@ -0,0 +1,49 @@
1
+ /*
2
+ * Copyright (c) 2025, salesforce.com, inc.
3
+ * All rights reserved.
4
+ * SPDX-License-Identifier: MIT
5
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6
+ */
7
+ import z from 'zod';
8
+ import { WORKFLOW_PROPERTY_NAMES, WORKFLOW_STATE_DATA_SCHEMA, } from '../../common/metadata.js';
9
+ /**
10
+ * Orchestrator input schema
11
+ *
12
+ * Note: The workflow state data is optional/defaulted because the orchestrator
13
+ * can start new workflows (where it doesn't exist yet) or continue existing ones.
14
+ */
15
+ export const ORCHESTRATOR_INPUT_SCHEMA = z.object({
16
+ [WORKFLOW_PROPERTY_NAMES.userInput]: z
17
+ .record(z.string(), z.unknown())
18
+ .optional()
19
+ .describe('User input - can be any data structure from initial request or previously executed MCP tool'),
20
+ [WORKFLOW_PROPERTY_NAMES.workflowStateData]: WORKFLOW_STATE_DATA_SCHEMA.default({
21
+ thread_id: '',
22
+ }).describe('Opaque workflow state data. Do not populate unless explicitly instructed to do so.'),
23
+ });
24
+ /**
25
+ * Orchestrator output schema - natural language orchestration prompt
26
+ */
27
+ export const ORCHESTRATOR_OUTPUT_SCHEMA = z.object({
28
+ orchestrationInstructionsPrompt: z
29
+ .string()
30
+ .describe('The prompt describing the next workflow action for the LLM to execute.'),
31
+ });
32
+ /**
33
+ * Factory function to create orchestrator tool metadata from configuration
34
+ * Takes the consumer-provided config and creates the tool metadata with
35
+ * standardized input/output schemas.
36
+ *
37
+ * @param config - The orchestrator configuration
38
+ * @returns Tool metadata with the specified toolId, title, description
39
+ */
40
+ export function createOrchestratorToolMetadata(config) {
41
+ return {
42
+ toolId: config.toolId,
43
+ title: config.title,
44
+ description: config.description,
45
+ inputSchema: ORCHESTRATOR_INPUT_SCHEMA,
46
+ outputSchema: ORCHESTRATOR_OUTPUT_SCHEMA,
47
+ };
48
+ }
49
+ //# sourceMappingURL=metadata.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../../src/tools/orchestrator/metadata.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB,OAAO,EAEL,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,0BAA0B,CAAC;AAGlC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,CAAC,uBAAuB,CAAC,SAAS,CAAC,EAAE,CAAC;SACnC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;SAC/B,QAAQ,EAAE;SACV,QAAQ,CACP,6FAA6F,CAC9F;IACH,CAAC,uBAAuB,CAAC,iBAAiB,CAAC,EAAE,0BAA0B,CAAC,OAAO,CAAC;QAC9E,SAAS,EAAE,EAAE;KACd,CAAC,CAAC,QAAQ,CAAC,oFAAoF,CAAC;CAClG,CAAC,CAAC;AAIH;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,+BAA+B,EAAE,CAAC;SAC/B,MAAM,EAAE;SACR,QAAQ,CAAC,wEAAwE,CAAC;CACtF,CAAC,CAAC;AAaH;;;;;;;GAOG;AACH,MAAM,UAAU,8BAA8B,CAC5C,MAA0B;IAE1B,OAAO;QACL,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,WAAW,EAAE,yBAAyB;QACtC,YAAY,EAAE,0BAA0B;KACzC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import { AbstractTool } from '../base/abstractTool.js';
3
+ import { OrchestratorConfig } from './config.js';
4
+ import { OrchestratorInput, OrchestratorToolMetadata } from './metadata.js';
5
+ /**
6
+ * Orchestrator Tool
7
+ *
8
+ * Orchestrates workflow execution using LangGraph.js for deterministic state management
9
+ * and human-in-the-loop patterns for agentic task execution.
10
+ *
11
+ * The orchestrator accepts a configured StateGraph and manages:
12
+ * - Thread-based session management
13
+ * - Workflow interrupts and resumptions
14
+ * - LLM orchestration prompts for tool invocation
15
+ *
16
+ * All state management and checkpointing responsibilities are delegated to WorkflowStateManager.
17
+ */
18
+ export declare class OrchestratorTool extends AbstractTool<OrchestratorToolMetadata> {
19
+ private readonly config;
20
+ private readonly stateManager;
21
+ constructor(server: McpServer, config: OrchestratorConfig);
22
+ /**
23
+ * Handle orchestrator requests - manages workflow state and execution
24
+ */
25
+ handleRequest: (input: OrchestratorInput) => Promise<{
26
+ content: {
27
+ type: "text";
28
+ text: string;
29
+ }[];
30
+ structuredContent: {
31
+ orchestrationInstructionsPrompt: string;
32
+ };
33
+ }>;
34
+ private processRequest;
35
+ /**
36
+ * Create orchestration prompt for LLM with embedded tool invocation data and workflow state
37
+ */
38
+ private createOrchestrationPrompt;
39
+ }
@@ -0,0 +1,186 @@
1
+ /*
2
+ * Copyright (c) 2025, salesforce.com, inc.
3
+ * All rights reserved.
4
+ * SPDX-License-Identifier: MIT
5
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6
+ */
7
+ import { zodToJsonSchema } from 'zod-to-json-schema';
8
+ import { Command } from '@langchain/langgraph';
9
+ import { createWorkflowLogger } from '../../logging/logger.js';
10
+ import { AbstractTool } from '../base/abstractTool.js';
11
+ import { WORKFLOW_PROPERTY_NAMES, } from '../../common/metadata.js';
12
+ import { WorkflowStateManager } from '../../checkpointing/workflowStateManager.js';
13
+ import { createOrchestratorToolMetadata, } from './metadata.js';
14
+ /**
15
+ * Generate unique thread ID for workflow sessions
16
+ */
17
+ function generateUniqueThreadId() {
18
+ return `mmw-${Date.now()}-${Math.random().toString(36).substring(2, 8)}`;
19
+ }
20
+ /**
21
+ * Orchestrator Tool
22
+ *
23
+ * Orchestrates workflow execution using LangGraph.js for deterministic state management
24
+ * and human-in-the-loop patterns for agentic task execution.
25
+ *
26
+ * The orchestrator accepts a configured StateGraph and manages:
27
+ * - Thread-based session management
28
+ * - Workflow interrupts and resumptions
29
+ * - LLM orchestration prompts for tool invocation
30
+ *
31
+ * All state management and checkpointing responsibilities are delegated to WorkflowStateManager.
32
+ */
33
+ export class OrchestratorTool extends AbstractTool {
34
+ config;
35
+ stateManager;
36
+ constructor(server, config) {
37
+ // Use provided logger or create workflow logger with component name
38
+ const effectiveLogger = config.logger || createWorkflowLogger('OrchestratorTool');
39
+ super(server, createOrchestratorToolMetadata(config), 'OrchestratorTool', effectiveLogger);
40
+ this.config = config;
41
+ // Initialize state manager (use provided or create default for production)
42
+ this.stateManager =
43
+ config.stateManager || new WorkflowStateManager({ environment: 'production' });
44
+ }
45
+ /**
46
+ * Handle orchestrator requests - manages workflow state and execution
47
+ */
48
+ handleRequest = async (input) => {
49
+ this.logger.debug('Orchestrator tool called with input', input);
50
+ try {
51
+ const result = await this.processRequest(input);
52
+ this.logger.debug('Orchestrator returning result', result);
53
+ return {
54
+ content: [
55
+ {
56
+ type: 'text',
57
+ text: JSON.stringify(result),
58
+ },
59
+ ],
60
+ structuredContent: result,
61
+ };
62
+ }
63
+ catch (error) {
64
+ this.logger.error('Error in orchestrator tool execution', error);
65
+ throw error;
66
+ }
67
+ };
68
+ async processRequest(input) {
69
+ // Generate or use existing thread ID for workflow session
70
+ let threadId = '';
71
+ try {
72
+ const parsedInput = this.toolMetadata.inputSchema.parse(input);
73
+ threadId = parsedInput.workflowStateData.thread_id;
74
+ }
75
+ catch (error) {
76
+ this.logger.error('Error parsing orchestrator input. Starting a new workflow.', error);
77
+ }
78
+ if (threadId === '') {
79
+ threadId = generateUniqueThreadId();
80
+ }
81
+ const workflowStateData = { thread_id: threadId };
82
+ this.logger.info('Processing orchestrator request', {
83
+ threadId,
84
+ hasUserInput: !!input.userInput,
85
+ isResumption: !!input.workflowStateData?.thread_id,
86
+ });
87
+ // Thread configuration for LangGraph
88
+ const threadConfig = { configurable: { thread_id: threadId } };
89
+ // Get checkpointer from state manager
90
+ const checkpointer = await this.stateManager.createCheckpointer();
91
+ // Compile workflow with checkpointer
92
+ const compiledWorkflow = this.config.workflow.compile({ checkpointer });
93
+ // Check for interrupted workflow state
94
+ this.logger.debug('Checking for interrupted workflow state');
95
+ let graphState = await compiledWorkflow.getState(threadConfig);
96
+ const interruptedTask = graphState.tasks.find(task => task.interrupts.length > 0);
97
+ let result;
98
+ if (interruptedTask) {
99
+ this.logger.info('Resuming interrupted workflow', {
100
+ taskId: interruptedTask.id,
101
+ interrupts: interruptedTask.interrupts.length,
102
+ });
103
+ // Resume workflow with user input from previous tool execution
104
+ result = await compiledWorkflow.invoke(new Command({ resume: input.userInput }), threadConfig);
105
+ }
106
+ else {
107
+ // Start new workflow session
108
+ this.logger.info('Starting new workflow execution');
109
+ result = await compiledWorkflow.invoke({
110
+ userInput: input.userInput,
111
+ }, threadConfig);
112
+ }
113
+ this.logger.debug('Processing workflow result');
114
+ graphState = await compiledWorkflow.getState(threadConfig);
115
+ if (graphState.next.length > 0) {
116
+ // There are more nodes to execute.
117
+ const mcpToolInvocationData = '__interrupt__' in result
118
+ ? result.__interrupt__[0].value
119
+ : undefined;
120
+ if (!mcpToolInvocationData) {
121
+ this.logger.error('Workflow completed without expected MCP tool invocation.');
122
+ throw new Error('FATAL: Unexpected workflow state without an interrupt');
123
+ }
124
+ this.logger.info('Invoking next MCP tool', {
125
+ toolName: mcpToolInvocationData.llmMetadata?.name,
126
+ });
127
+ // Create orchestration prompt
128
+ const orchestrationPrompt = this.createOrchestrationPrompt(mcpToolInvocationData, workflowStateData);
129
+ // Save the workflow state.
130
+ await this.stateManager.saveCheckpointerState(checkpointer);
131
+ return {
132
+ orchestrationInstructionsPrompt: orchestrationPrompt,
133
+ };
134
+ }
135
+ // Workflow completed.
136
+ return {
137
+ orchestrationInstructionsPrompt: 'The workflow has concluded. No further workflow actions are forthcoming.',
138
+ };
139
+ }
140
+ /**
141
+ * Create orchestration prompt for LLM with embedded tool invocation data and workflow state
142
+ */
143
+ createOrchestrationPrompt(mcpToolInvocationData, workflowStateData) {
144
+ return `
145
+ # Your Role
146
+
147
+ You are participating in a workflow orchestration process. The current
148
+ (\`${this.toolMetadata.toolId}\`) MCP server tool is the orchestrator, and is sending
149
+ you instructions on what to do next. These instructions describe the next participating
150
+ MCP server tool to invoke, along with its input schema and input values.
151
+
152
+ # Your Task
153
+
154
+ Invoke the following MCP server tool:
155
+
156
+ **MCP Server Tool Name**: ${mcpToolInvocationData.llmMetadata?.name}
157
+ **MCP Server Tool Input Schema**:
158
+ \`\`\`json
159
+ ${JSON.stringify(zodToJsonSchema(mcpToolInvocationData.llmMetadata?.inputSchema))}
160
+ \`\`\`
161
+ **MCP Server Tool Input Values**:
162
+ \`\`\`json
163
+ ${JSON.stringify(mcpToolInvocationData.input)}
164
+ \`\`\`
165
+
166
+ ## Additional Input: \`${WORKFLOW_PROPERTY_NAMES.workflowStateData}\`
167
+
168
+ \`${WORKFLOW_PROPERTY_NAMES.workflowStateData}\` is an additional input parameter that is
169
+ specified in the input schema above, and should be passed to the next MCP server tool
170
+ invocation, with the following object value:
171
+
172
+ \`\`\`json
173
+ ${JSON.stringify(workflowStateData)}
174
+ \`\`\`
175
+
176
+ This represents opaque workflow state data that should be round-tripped back to the
177
+ \`${this.toolMetadata.toolId}\` MCP server tool orchestrator at the completion of the
178
+ next MCP server tool invocation, without modification. These instructions will be further
179
+ specified by the next MCP server tool invocation.
180
+
181
+ The MCP server tool you invoke will respond with its output, along with further
182
+ instructions for continuing the workflow.
183
+ `;
184
+ }
185
+ }
186
+ //# sourceMappingURL=orchestratorTool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orchestratorTool.js","sourceRoot":"","sources":["../../../src/tools/orchestrator/orchestratorTool.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,E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AAC,iBAAiB;;;;;EAK3C,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC;;;;IAI/B,IAAI,CAAC,YAAY,CAAC,MAAM;;;;;;CAM3B,CAAC;IACA,CAAC;CACF"}
@@ -0,0 +1,43 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import { Logger } from '../../../logging/logger.js';
3
+ import { GetInputTool } from './tool.js';
4
+ /**
5
+ * Configuration options for creating a Get Input Tool
6
+ */
7
+ export interface GetInputToolOptions {
8
+ /**
9
+ * The tool ID to use for the get input tool
10
+ */
11
+ toolId: string;
12
+ /**
13
+ * Orchestrator tool ID that this tool reports back to
14
+ * @required
15
+ */
16
+ orchestratorToolId: string;
17
+ /**
18
+ * Optional logger instance for tool operations
19
+ */
20
+ logger?: Logger;
21
+ }
22
+ /**
23
+ * Factory function to create a Get Input Tool with configurable tool ID
24
+ *
25
+ * @param server - The MCP server instance
26
+ * @param options - Configuration options for the tool
27
+ * @returns A configured Get Input Tool instance ready for registration
28
+ *
29
+ * @example
30
+ * // Simple case - single MCP server
31
+ * const getInputTool = createGetInputTool(server, {
32
+ * toolId: 'magen-get-input',
33
+ * orchestratorToolId: 'my-orchestrator',
34
+ * });
35
+ *
36
+ * @example
37
+ * // Multi-server environment - avoid collisions
38
+ * const getInputTool = createGetInputTool(server, {
39
+ * toolId: 'mobile-magen-get-input',
40
+ * orchestratorToolId: 'mobile-orchestrator',
41
+ * });
42
+ */
43
+ export declare function createGetInputTool(server: McpServer, options: GetInputToolOptions): GetInputTool;
@@ -0,0 +1,32 @@
1
+ /*
2
+ * Copyright (c) 2025, salesforce.com, inc.
3
+ * All rights reserved.
4
+ * SPDX-License-Identifier: MIT
5
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6
+ */
7
+ import { GetInputTool } from './tool.js';
8
+ /**
9
+ * Factory function to create a Get Input Tool with configurable tool ID
10
+ *
11
+ * @param server - The MCP server instance
12
+ * @param options - Configuration options for the tool
13
+ * @returns A configured Get Input Tool instance ready for registration
14
+ *
15
+ * @example
16
+ * // Simple case - single MCP server
17
+ * const getInputTool = createGetInputTool(server, {
18
+ * toolId: 'magen-get-input',
19
+ * orchestratorToolId: 'my-orchestrator',
20
+ * });
21
+ *
22
+ * @example
23
+ * // Multi-server environment - avoid collisions
24
+ * const getInputTool = createGetInputTool(server, {
25
+ * toolId: 'mobile-magen-get-input',
26
+ * orchestratorToolId: 'mobile-orchestrator',
27
+ * });
28
+ */
29
+ export function createGetInputTool(server, options) {
30
+ return new GetInputTool(server, options.toolId, options.orchestratorToolId, options.logger);
31
+ }
32
+ //# sourceMappingURL=factory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"factory.js","sourceRoot":"","sources":["../../../../src/tools/utilities/getInput/factory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAuBzC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAiB,EAAE,OAA4B;IAChF,OAAO,IAAI,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,kBAAkB,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;AAC9F,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './tool.js';
2
+ export * from './metadata.js';
3
+ export * from './factory.js';
@@ -0,0 +1,10 @@
1
+ /*
2
+ * Copyright (c) 2025, salesforce.com, inc.
3
+ * All rights reserved.
4
+ * SPDX-License-Identifier: MIT
5
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6
+ */
7
+ export * from './tool.js';
8
+ export * from './metadata.js';
9
+ export * from './factory.js';
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/tools/utilities/getInput/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC"}