@exaudeus/workrail 0.0.3 → 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.
@@ -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