Skip to content

MCP Tools for Orchestrator Workflow Creation #1

@eloycoto

Description

@eloycoto

This plan outlines the implementation of MCP (Model Context Protocol) tools to enhance chat-based workflow management for an orchestrator system. The orchestrator uses JSON Schema definitions to define workflows, and since the system prompt cannot be changed, MCP tools provide the necessary context and validation capabilities.

Architecture

┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
│   Chat Client   │◄──►│ Lightspeed      │◄──►│ MCP Server      │
│                 │    │ Stack           │    │ (Port 8000)     │
└─────────────────┘    └─────────────────┘    └─────────────────┘
                              │                       │
                              ▼                       ▼
                       ┌─────────────────┐    ┌─────────────────┐
                       │ LLaMA Stack     │    │ Orchestrator    │
                       │ (Port 8321)     │    │ Backend         │
                       └─────────────────┘    └─────────────────┘

MCP Tools Design

1. Workflow Discovery & Context Tools

orchestrator_get_jsonschema()

  • Purpose: Retrieves the complete JSON Schema definition for orchestrator workflows
  • Returns: Full JSON Schema with all available fields, types, and constraints
  • Usage: Provides AI with complete context about workflow structure

orchestrator_get_examples(number: int = 5)

  • Purpose: Fetches real-world examples of orchestrator workflows
  • Parameters:
    • number: Number of examples to return (default: 5)
  • Returns: Array of example workflows with different complexity levels
  • Usage: Shows AI how to structure workflows correctly

orchestrator_creation_workflow_rules()

  • Purpose: Returns best practices and rules for creating workflows
  • Returns: Structured guidelines including:
    • Naming conventions
    • Required fields
    • Validation rules
    • Performance considerations
    • Security constraints

2. Workflow Validation & Compilation Tools

orchestrator_json_validation(workflow_json: str)

  • Purpose: Validates a JSON workflow against the schema
  • Parameters:
    • workflow_json: Stringified JSON workflow definition
  • Returns: Validation result with detailed error messages if invalid
  • Usage: Real-time validation during workflow creation

orchestrator_compile(workflow_json: str)

  • Purpose: Compiles the workflow and checks for logical errors
  • Parameters:
    • workflow_json: Stringified JSON workflow definition
  • Returns: Compilation result with execution plan or error details
  • Usage: Ensures workflow will execute correctly

orchestrator_render(workflow_json: str, format: str = "mermaid")

  • Purpose: Renders workflow as a visual graph
  • Parameters:
    • workflow_json: Stringified JSON workflow definition
    • format: Output format ("mermaid", "dot", "ascii")
  • Returns: Graph representation of the workflow
  • Usage: Visual validation and documentation

Implementation Strategy

Phase 1: Basic MCP Server Setup ✅

  1. Integrate with existing Lightspeed Stack configuration

Phase 2: Schema & Examples Integration

  1. Connect to actual orchestrator backend
  2. Implement dynamic schema retrieval
  3. Create example workflow database
  4. Add caching for performance

Phase 3: Validation & Compilation

  1. Implement JSON Schema validation
  2. Add workflow compilation engine
  3. Create error reporting system
  4. Add performance metrics

Phase 4: Visualization & Enhancement

  1. Implement graph rendering
  2. Add multiple output formats
  3. Create interactive workflow builder assistance
  4. Add workflow optimization suggestions

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions