@exaudeus/workrail 0.0.4 → 0.0.5

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/README.md CHANGED
@@ -52,11 +52,12 @@ workrail start
52
52
 
53
53
  * **Clean Architecture** – clear separation of **Domain → Application → Infrastructure** layers.
54
54
  * **MCP Protocol Support** – Full MCP SDK integration with proper tool definitions and stdio transport.
55
- * **Workflow Orchestration Tools** – 4 core tools for workflow management:
55
+ * **Workflow Orchestration Tools** – 5 core tools for workflow management:
56
56
  - `workflow_list` - List all available workflows
57
57
  - `workflow_get` - Get detailed workflow information
58
58
  - `workflow_next` - Get the next step in a workflow
59
59
  - `workflow_validate` - Advanced validation of step outputs with schema, context-aware, and composition rules
60
+ - `workflow_validate_json` - Direct JSON workflow validation with comprehensive error reporting and actionable suggestions
60
61
  * **Dependency Injection** – pluggable components are wired by `src/container.ts` (Inversify-style, no runtime reflection).
61
62
  * **Async, Secure Storage** – interchangeable back-ends: in-memory (default for tests) and file-based storage with path-traversal safeguards.
62
63
  * **Advanced ValidationEngine** – Three-tier validation system with JSON Schema validation (AJV), Context-Aware Validation (conditional rules), and Logical Composition (and/or/not operators) for comprehensive step output quality assurance.
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Enhanced validation result interface that matches other use cases
3
+ */
4
+ export interface WorkflowJsonValidationResult {
5
+ valid: boolean;
6
+ issues: string[];
7
+ suggestions: string[];
8
+ }
9
+ /**
10
+ * Factory function that creates a pure use-case for validating workflow JSON.
11
+ * Dependencies are injected at creation time, returning a pure function.
12
+ */
13
+ export declare function createValidateWorkflowJson(): (workflowJson: string) => Promise<WorkflowJsonValidationResult>;
14
+ /**
15
+ * @deprecated Use createValidateWorkflowJson factory function instead
16
+ * Legacy export for backward compatibility
17
+ */
18
+ export declare function validateWorkflowJson(workflowJson: string): Promise<WorkflowJsonValidationResult>;
19
+ //# sourceMappingURL=validate-workflow-json.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-workflow-json.d.ts","sourceRoot":"","sources":["../../../src/application/use-cases/validate-workflow-json.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,KAEtC,cAAc,MAAM,KACnB,OAAO,CAAC,4BAA4B,CAAC,CA6DzC;AAgGD;;;GAGG;AACH,wBAAsB,oBAAoB,CACxC,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,4BAA4B,CAAC,CAEvC"}
@@ -0,0 +1,148 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createValidateWorkflowJson = createValidateWorkflowJson;
4
+ exports.validateWorkflowJson = validateWorkflowJson;
5
+ const validation_1 = require("../validation");
6
+ /**
7
+ * Factory function that creates a pure use-case for validating workflow JSON.
8
+ * Dependencies are injected at creation time, returning a pure function.
9
+ */
10
+ function createValidateWorkflowJson() {
11
+ return async (workflowJson) => {
12
+ // Handle null, undefined, or non-string input
13
+ if (workflowJson === null || workflowJson === undefined || typeof workflowJson !== 'string') {
14
+ return {
15
+ valid: false,
16
+ issues: ['Workflow JSON content is required and must be a string.'],
17
+ suggestions: ['Provide valid JSON content for the workflow.']
18
+ };
19
+ }
20
+ // Handle empty string after trimming
21
+ const trimmedJson = workflowJson.trim();
22
+ if (trimmedJson.length === 0) {
23
+ return {
24
+ valid: false,
25
+ issues: ['Workflow JSON content is empty.'],
26
+ suggestions: ['Provide valid JSON content for the workflow.']
27
+ };
28
+ }
29
+ // Parse JSON with detailed error handling
30
+ let parsedWorkflow;
31
+ try {
32
+ parsedWorkflow = JSON.parse(trimmedJson);
33
+ }
34
+ catch (error) {
35
+ const errorMessage = error instanceof Error ? error.message : 'Unknown JSON parsing error';
36
+ return {
37
+ valid: false,
38
+ issues: [`Invalid JSON syntax: ${errorMessage}`],
39
+ suggestions: [
40
+ 'Check for missing quotes, commas, or brackets in the JSON.',
41
+ 'Ensure all strings are properly quoted.',
42
+ 'Verify that brackets and braces are properly matched.',
43
+ 'Use a JSON formatter or validator to identify syntax errors.'
44
+ ]
45
+ };
46
+ }
47
+ // Validate the parsed workflow using existing validation
48
+ const validationResult = (0, validation_1.validateWorkflow)(parsedWorkflow);
49
+ // Transform validation result to match use case interface
50
+ const issues = [];
51
+ const suggestions = [];
52
+ if (!validationResult.valid) {
53
+ // Process validation errors and provide enhanced error messages
54
+ validationResult.errors.forEach(error => {
55
+ issues.push(enhanceErrorMessage(error));
56
+ });
57
+ // Add general suggestions based on common validation errors
58
+ suggestions.push(...generateSuggestions(validationResult.errors));
59
+ }
60
+ return {
61
+ valid: validationResult.valid,
62
+ issues,
63
+ suggestions
64
+ };
65
+ };
66
+ }
67
+ /**
68
+ * Enhance error messages to be more user-friendly for LLM consumption
69
+ */
70
+ function enhanceErrorMessage(error) {
71
+ // Handle common AJV error patterns and make them more descriptive
72
+ if (error.includes('must have required property')) {
73
+ const match = error.match(/must have required property '(.+)'/);
74
+ if (match) {
75
+ const property = match[1];
76
+ return `Missing required field '${property}'. This field is mandatory for all workflows.`;
77
+ }
78
+ }
79
+ if (error.includes('must be string')) {
80
+ return `${error} - Expected a text value enclosed in quotes.`;
81
+ }
82
+ if (error.includes('must be array')) {
83
+ return `${error} - Expected a list of items enclosed in square brackets [].`;
84
+ }
85
+ if (error.includes('must be object')) {
86
+ return `${error} - Expected a JSON object enclosed in curly braces {}.`;
87
+ }
88
+ if (error.includes('must match pattern')) {
89
+ return `${error} - The value does not match the required format or pattern.`;
90
+ }
91
+ if (error.includes('must NOT have additional properties')) {
92
+ return `Unexpected property found. Remove this property or check for typos.`;
93
+ }
94
+ if (error.includes('additionalProperties')) {
95
+ return `${error} - Remove any unexpected properties or check for typos.`;
96
+ }
97
+ if (error.includes('must be >= 1')) {
98
+ return `${error} - Value must be at least 1.`;
99
+ }
100
+ if (error.includes('must be <= ')) {
101
+ return `${error} - Value exceeds the maximum allowed length.`;
102
+ }
103
+ // Return original error if no specific enhancement is available
104
+ return error;
105
+ }
106
+ /**
107
+ * Generate actionable suggestions based on validation errors
108
+ */
109
+ function generateSuggestions(errors) {
110
+ const suggestions = [];
111
+ const errorText = errors.join(' ').toLowerCase();
112
+ // Add suggestions based on common error patterns
113
+ if (errorText.includes('id')) {
114
+ suggestions.push('Ensure the workflow ID follows the pattern: lowercase letters, numbers, and hyphens only.');
115
+ }
116
+ if (errorText.includes('name')) {
117
+ suggestions.push('Provide a clear, descriptive name for the workflow.');
118
+ }
119
+ if (errorText.includes('description')) {
120
+ suggestions.push('Add a meaningful description explaining what the workflow accomplishes.');
121
+ }
122
+ if (errorText.includes('version')) {
123
+ suggestions.push('Use semantic versioning format (e.g., "0.0.1", "1.0.0").');
124
+ }
125
+ if (errorText.includes('steps')) {
126
+ suggestions.push('Ensure the workflow has at least one step with id, title, and prompt fields.');
127
+ }
128
+ if (errorText.includes('step')) {
129
+ suggestions.push('Check that all steps have required fields: id, title, and prompt.');
130
+ }
131
+ if (errorText.includes('pattern')) {
132
+ suggestions.push('Review the workflow schema documentation for correct field formats.');
133
+ }
134
+ // Add general suggestions if no specific ones were added
135
+ if (suggestions.length === 0) {
136
+ suggestions.push('Review the workflow schema documentation for correct structure and formatting.');
137
+ suggestions.push('Check that all required fields are present and properly formatted.');
138
+ }
139
+ return suggestions;
140
+ }
141
+ /**
142
+ * @deprecated Use createValidateWorkflowJson factory function instead
143
+ * Legacy export for backward compatibility
144
+ */
145
+ async function validateWorkflowJson(workflowJson) {
146
+ return createValidateWorkflowJson()(workflowJson);
147
+ }
148
+ //# sourceMappingURL=validate-workflow-json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-workflow-json.js","sourceRoot":"","sources":["../../../src/application/use-cases/validate-workflow-json.ts"],"names":[],"mappings":";;AAeA,gEAgEC;AAoGD,oDAIC;AA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QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QAChC,WAAW,CAAC,IAAI,CAAC,8EAA8E,CAAC,CAAC;IACnG,CAAC;IAED,IAAI,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAC/B,WAAW,CAAC,IAAI,CAAC,mEAAmE,CAAC,CAAC;IACxF,CAAC;IAED,IAAI,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;QAClC,WAAW,CAAC,IAAI,CAAC,qEAAqE,CAAC,CAAC;IAC1F,CAAC;IAED,yDAAyD;IACzD,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC7B,WAAW,CAAC,IAAI,CAAC,gFAAgF,CAAC,CAAC;QACnG,WAAW,CAAC,IAAI,CAAC,oEAAoE,CAAC,CAAC;IACzF,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC;AAED;;;GAGG;AACI,KAAK,UAAU,oBAAoB,CACxC,YAAoB;IAEpB,OAAO,0BAA0B,EAAE,CAAC,YAAY,CAAC,CAAC;AACpD,CAAC"}
@@ -1,5 +1,38 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
3
36
  Object.defineProperty(exports, "__esModule", { value: true });
4
37
  const index_js_1 = require("@modelcontextprotocol/sdk/server/index.js");
5
38
  const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
@@ -66,6 +99,34 @@ class WorkflowOrchestrationServer {
66
99
  async validateStep(workflowId, stepId, output) {
67
100
  return this.callWorkflowMethod('workflow_validate', { workflowId, stepId, output });
68
101
  }
102
+ async validateWorkflowJson(workflowJson) {
103
+ try {
104
+ // Import and use the validation use case
105
+ const { createValidateWorkflowJson } = await Promise.resolve().then(() => __importStar(require('./application/use-cases/validate-workflow-json.js')));
106
+ const validateWorkflowJsonUseCase = createValidateWorkflowJson();
107
+ const result = await validateWorkflowJsonUseCase(workflowJson);
108
+ return {
109
+ content: [{
110
+ type: "text",
111
+ text: JSON.stringify(result, null, 2)
112
+ }]
113
+ };
114
+ }
115
+ catch (error) {
116
+ console.error(`Workflow JSON validation failed:`, error);
117
+ return {
118
+ content: [{
119
+ type: "text",
120
+ text: JSON.stringify({
121
+ error: error instanceof Error ? error.message : String(error),
122
+ method: 'workflow_validate_json',
123
+ workflowJson: workflowJson.substring(0, 100) + (workflowJson.length > 100 ? '...' : '')
124
+ }, null, 2)
125
+ }],
126
+ isError: true
127
+ };
128
+ }
129
+ }
69
130
  }
70
131
  // Define the workflow orchestration tools
71
132
  const WORKFLOW_LIST_TOOL = {
@@ -155,6 +216,34 @@ const WORKFLOW_VALIDATE_TOOL = {
155
216
  additionalProperties: false
156
217
  }
157
218
  };
219
+ const WORKFLOW_VALIDATE_JSON_TOOL = {
220
+ name: "workflow_validate_json",
221
+ description: `Validates workflow JSON content directly without external tools. Use this tool when you need to verify that a workflow JSON file is syntactically correct and follows the proper schema.
222
+
223
+ This tool provides comprehensive validation including:
224
+ - JSON syntax validation with detailed error messages
225
+ - Workflow schema compliance checking
226
+ - User-friendly error reporting with actionable suggestions
227
+ - Support for all workflow features (steps, conditions, validation criteria, etc.)
228
+
229
+ Example usage:
230
+ - Validate a newly created workflow before saving
231
+ - Check workflow syntax when editing workflow files
232
+ - Verify workflow structure when troubleshooting issues
233
+ - Ensure workflow compliance before deployment`,
234
+ inputSchema: {
235
+ type: "object",
236
+ properties: {
237
+ workflowJson: {
238
+ type: "string",
239
+ description: "The complete workflow JSON content as a string to validate",
240
+ minLength: 1
241
+ }
242
+ },
243
+ required: ["workflowJson"],
244
+ additionalProperties: false
245
+ }
246
+ };
158
247
  // Create and configure the MCP server
159
248
  const server = new index_js_1.Server({
160
249
  name: "workflow-orchestration-server",
@@ -171,7 +260,8 @@ server.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => ({
171
260
  WORKFLOW_LIST_TOOL,
172
261
  WORKFLOW_GET_TOOL,
173
262
  WORKFLOW_NEXT_TOOL,
174
- WORKFLOW_VALIDATE_TOOL
263
+ WORKFLOW_VALIDATE_TOOL,
264
+ WORKFLOW_VALIDATE_JSON_TOOL
175
265
  ],
176
266
  }));
177
267
  server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
@@ -203,6 +293,14 @@ server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
203
293
  };
204
294
  }
205
295
  return await workflowServer.validateStep(args['workflowId'], args['stepId'], args['output']);
296
+ case "workflow_validate_json":
297
+ if (!args?.['workflowJson']) {
298
+ return {
299
+ content: [{ type: "text", text: "Error: workflowJson parameter is required" }],
300
+ isError: true
301
+ };
302
+ }
303
+ return await workflowServer.validateWorkflowJson(args['workflowJson']);
206
304
  default:
207
305
  return {
208
306
  content: [{ type: "text", text: `Unknown tool: ${name}` }],
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-server.js","sourceRoot":"","sources":["../src/mcp-server.ts"],"names":[],"mappings":";;;AAEA,wEAAmE;AACnE,wEAAiF;AACjF,iEAM4C;AAC5C,iDAAoD;AAEpD,MAAM,2BAA2B;IACvB,SAAS,CAAM;IAEvB;QACE,IAAI,CAAC,SAAS,GAAG,IAAA,iCAAkB,GAAE,CAAC;IACxC,CAAC;IAEO,KAAK,CAAC,kBAAkB,CAAC,MAAc,EAAE,MAAW;QAC1D,IAAI,CAAC;YACH,oCAAoC;YACpC,MAAM,EAAE,eAAe,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC;YAE3C,IAAI,MAAM,CAAC;YACX,QAAQ,MAAM,EAAE,CAAC;gBACf,KAAK,eAAe;oBAClB,MAAM,SAAS,GAAG,MAAM,eAAe,CAAC,qBAAqB,EAAE,CAAC;oBAChE,MAAM,GAAG,EAAE,SAAS,EAAE,CAAC;oBACvB,MAAM;gBACR,KAAK,cAAc;oBACjB,MAAM,GAAG,MAAM,eAAe,CAAC,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;oBAC1D,MAAM;gBACR,KAAK,eAAe;oBAClB,MAAM,GAAG,MAAM,eAAe,CAAC,WAAW,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,IAAI,EAAE,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;oBAC3G,MAAM;gBACR,KAAK,mBAAmB;oBACtB,MAAM,GAAG,MAAM,eAAe,CAAC,kBAAkB,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;oBACnG,MAAM;gBACR;oBACE,MAAM,IAAI,KAAK,CAAC,mBAAmB,MAAM,EAAE,CAAC,CAAC;YACjD,CAAC;YAED,OAAO;gBACL,OAAO,EAAE,CAAC;wBACR,IA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C;AAClB,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exaudeus/workrail",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "MCP server for structured workflow orchestration and step-by-step task guidance",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -507,6 +507,163 @@ Combines multiple validation rules with boolean operators:
507
507
  - Returns error code `-32004` if validation criteria format is invalid
508
508
  - Returns error code `-32002` if JSON Schema validation fails due to malformed schema
509
509
 
510
+ ### workflow_validate_json
511
+
512
+ Validates workflow JSON content directly without external tools or storage dependencies. This tool provides comprehensive validation including JSON syntax checking, schema compliance validation, and actionable error messages optimized for LLM consumption.
513
+
514
+ #### Request
515
+
516
+ ```json
517
+ {
518
+ "jsonrpc": "2.0",
519
+ "id": 5,
520
+ "method": "workflow_validate_json",
521
+ "params": {
522
+ "workflowJson": "string"
523
+ }
524
+ }
525
+ ```
526
+
527
+ #### Parameters
528
+
529
+ - `workflowJson` (required): The complete workflow JSON content as a string to validate
530
+
531
+ #### Response
532
+
533
+ ```json
534
+ {
535
+ "jsonrpc": "2.0",
536
+ "id": 5,
537
+ "result": {
538
+ "valid": boolean,
539
+ "issues": ["string"],
540
+ "suggestions": ["string"]
541
+ }
542
+ }
543
+ ```
544
+
545
+ #### Field Descriptions
546
+
547
+ - `valid`: Whether the workflow JSON is syntactically correct and schema-compliant
548
+ - `issues`: List of specific validation problems found (empty if valid)
549
+ - `suggestions`: List of actionable suggestions for fixing validation issues
550
+
551
+ #### Validation Process
552
+
553
+ The tool performs comprehensive validation in the following order:
554
+
555
+ 1. **JSON Syntax Validation**: Parses JSON and reports syntax errors with line/column information
556
+ 2. **Schema Compliance**: Validates against the workflow schema using the same ValidationEngine used by the storage layer
557
+ 3. **Error Enhancement**: Provides LLM-friendly error messages with specific suggestions for resolution
558
+
559
+ #### Example Requests and Responses
560
+
561
+ ##### Valid Workflow JSON
562
+
563
+ ```json
564
+ {
565
+ "jsonrpc": "2.0",
566
+ "id": "validate-json-1",
567
+ "method": "workflow_validate_json",
568
+ "params": {
569
+ "workflowJson": "{\"id\":\"test-workflow\",\"name\":\"Test Workflow\",\"description\":\"A simple test workflow\",\"version\":\"1.0.0\",\"steps\":[{\"id\":\"step1\",\"title\":\"First Step\",\"prompt\":\"Do something useful\"}]}"
570
+ }
571
+ }
572
+ ```
573
+
574
+ ##### Valid Workflow Response
575
+
576
+ ```json
577
+ {
578
+ "jsonrpc": "2.0",
579
+ "id": "validate-json-1",
580
+ "result": {
581
+ "valid": true,
582
+ "issues": [],
583
+ "suggestions": []
584
+ }
585
+ }
586
+ ```
587
+
588
+ ##### Invalid JSON Syntax
589
+
590
+ ```json
591
+ {
592
+ "jsonrpc": "2.0",
593
+ "id": "validate-json-2",
594
+ "method": "workflow_validate_json",
595
+ "params": {
596
+ "workflowJson": "{\"id\":\"test-workflow\",\"name\":\"Test Workflow\",\"description\":\"Missing closing brace\""
597
+ }
598
+ }
599
+ ```
600
+
601
+ ##### JSON Syntax Error Response
602
+
603
+ ```json
604
+ {
605
+ "jsonrpc": "2.0",
606
+ "id": "validate-json-2",
607
+ "result": {
608
+ "valid": false,
609
+ "issues": [
610
+ "JSON syntax error: Unexpected end of JSON input at position 75"
611
+ ],
612
+ "suggestions": [
613
+ "Check for missing closing braces, brackets, or quotes",
614
+ "Validate JSON syntax using a JSON validator or formatter"
615
+ ]
616
+ }
617
+ }
618
+ ```
619
+
620
+ ##### Schema Validation Error
621
+
622
+ ```json
623
+ {
624
+ "jsonrpc": "2.0",
625
+ "id": "validate-json-3",
626
+ "method": "workflow_validate_json",
627
+ "params": {
628
+ "workflowJson": "{\"id\":\"test-workflow\",\"name\":\"Test Workflow\"}"
629
+ }
630
+ }
631
+ ```
632
+
633
+ ##### Schema Error Response
634
+
635
+ ```json
636
+ {
637
+ "jsonrpc": "2.0",
638
+ "id": "validate-json-3",
639
+ "result": {
640
+ "valid": false,
641
+ "issues": [
642
+ "Missing required property 'description'",
643
+ "Missing required property 'steps'"
644
+ ],
645
+ "suggestions": [
646
+ "Add required 'description' field with a meaningful description",
647
+ "Add required 'steps' array with at least one step object"
648
+ ]
649
+ }
650
+ }
651
+ ```
652
+
653
+ #### Use Cases
654
+
655
+ - **Workflow Development**: Validate workflow JSON during creation and editing
656
+ - **CI/CD Integration**: Automated validation in deployment pipelines
657
+ - **Real-time Validation**: Live validation in workflow editors and management tools
658
+ - **Troubleshooting**: Diagnose workflow loading issues and syntax problems
659
+ - **LLM Integration**: Programmatic validation with enhanced error messages for AI agents
660
+
661
+ #### Error Cases
662
+
663
+ - Returns error code `-32602` if `workflowJson` parameter is missing or empty
664
+ - Returns error code `-32603` if internal validation engine encounters unexpected errors
665
+ - JSON syntax and schema validation errors are returned as successful responses with `valid: false`
666
+
510
667
  ## Example Session
511
668
 
512
669
  Here's a complete example session showing tool usage:
@@ -686,7 +843,63 @@ Here's a complete example session showing tool usage:
686
843
  }
687
844
  ```
688
845
 
689
- ### 6. Error Example
846
+ ### 6. Validate Workflow JSON
847
+
848
+ ```json
849
+ // Request - Validate workflow JSON directly
850
+ {
851
+ "jsonrpc": "2.0",
852
+ "id": "validate-json-1",
853
+ "method": "workflow_validate_json",
854
+ "params": {
855
+ "workflowJson": "{\"id\":\"sample-workflow\",\"name\":\"Sample Workflow\",\"description\":\"A workflow for demonstration\",\"version\":\"1.0.0\",\"steps\":[{\"id\":\"demo-step\",\"title\":\"Demo Step\",\"prompt\":\"Perform the demo action\"}]}"
856
+ }
857
+ }
858
+
859
+ // Response - Successful validation
860
+ {
861
+ "jsonrpc": "2.0",
862
+ "id": "validate-json-1",
863
+ "result": {
864
+ "valid": true,
865
+ "issues": [],
866
+ "suggestions": []
867
+ }
868
+ }
869
+ ```
870
+
871
+ ### 7. JSON Validation Error Example
872
+
873
+ ```json
874
+ // Request - Invalid workflow JSON
875
+ {
876
+ "jsonrpc": "2.0",
877
+ "id": "validate-json-2",
878
+ "method": "workflow_validate_json",
879
+ "params": {
880
+ "workflowJson": "{\"id\":\"invalid-workflow\",\"name\":\"Invalid Workflow\"}"
881
+ }
882
+ }
883
+
884
+ // Response - Validation failed with actionable suggestions
885
+ {
886
+ "jsonrpc": "2.0",
887
+ "id": "validate-json-2",
888
+ "result": {
889
+ "valid": false,
890
+ "issues": [
891
+ "Missing required property 'description'",
892
+ "Missing required property 'steps'"
893
+ ],
894
+ "suggestions": [
895
+ "Add required 'description' field with a meaningful description",
896
+ "Add required 'steps' array with at least one step object"
897
+ ]
898
+ }
899
+ }
900
+ ```
901
+
902
+ ### 8. Error Example
690
903
 
691
904
  ```json
692
905
  // Request
@@ -63,7 +63,7 @@ This document summarizes how the Workflow Orchestration System achieves full MCP
63
63
  "additionalProperties": false
64
64
  }
65
65
  }
66
- // ... all four tools with complete schemas
66
+ // ... all five tools with complete schemas
67
67
  ]
68
68
  }
69
69
  }
@@ -106,7 +106,7 @@ This document summarizes how the Workflow Orchestration System achieves full MCP
106
106
  - Complete error handling
107
107
 
108
108
  2. **[MCP Tool API](mcp-api-v1.0.md)** ✅ **ENHANCED**
109
- - Four core workflow tools
109
+ - Five core workflow tools
110
110
  - JSON-RPC 2.0 implementation
111
111
  - Workflow-specific error codes
112
112
  - Request/response examples
@@ -156,7 +156,7 @@ This document summarizes how the Workflow Orchestration System achieves full MCP
156
156
  - Protocol version management
157
157
 
158
158
  ✅ **Comprehensive Tool Specifications**
159
- - Four core workflow tools with complete schemas
159
+ - Five core workflow tools with complete schemas
160
160
  - Input validation and error handling
161
161
  - Request/response examples
162
162