Skip to main content

Module prompt_handler

Module prompt_handler 

Source
Available on non-WebAssembly only.
Expand description

PromptHandler implementation for SequentialWorkflow with server-side execution

Enables workflows to be registered as prompts in the server with full tool execution.

§MCP-Compliant Workflow Execution

This module implements server-side workflow execution during prompts/get. When a user invokes a workflow prompt, the server:

  1. Creates a user intent message from the workflow description and arguments
  2. Creates an assistant plan message listing all workflow steps
  3. Executes each step sequentially:
    • Announces the tool call (assistant message)
    • Executes the tool server-side
    • Returns the tool result (user message)
    • Stores the result in execution context (bindings)
  4. Returns the complete conversation trace to the client

This approach provides:

  • Complete execution context for the LLM
  • Efficient single-round-trip execution
  • Clear error handling and debugging
  • Data flow via bindings between steps

Structs§

WorkflowPromptHandler
PromptHandler implementation for SequentialWorkflow