toolhive
toolhive copied to clipboard
Add elicitation response handlers (OnDecline/OnCancel) to WorkflowStep CRD
Summary
The VirtualMCPServer CRD is missing OnDecline and OnCancel fields for workflow steps, which are supported by the implementation for handling elicitation responses.
Current State
Implementation (pkg/vmcp/config/config.go:395-396):
type WorkflowStepConfig struct {
// ... other fields
// Elicitation response handlers
OnDecline *ElicitationResponseConfig `json:"on_decline,omitempty"`
OnCancel *ElicitationResponseConfig `json:"on_cancel,omitempty"`
}
type ElicitationResponseConfig struct {
// Action: "skip_remaining", "abort", "continue"
Action string `json:"action"`
}
CRD (cmd/thv-operator/api/v1alpha1/virtualmcpserver_types.go:223-271):
type WorkflowStep struct {
// Has Message and Schema for elicitation
// But NO OnDecline or OnCancel handlers
}
Impact
Users cannot configure workflow behavior when:
- A user explicitly declines an elicitation request
- A user cancels/dismisses an elicitation without responding
This is documented in the proposal (docs/proposals/THV-2106-virtual-mcp-server.md:470-473):
on_decline:
action: "skip_remaining"
on_cancel:
action: "abort"
Proposed Solution
Add to WorkflowStep in both CRD files:
OnDecline *ElicitationResponseHandlerfieldOnCancel *ElicitationResponseHandlerfield
Create new type:
type ElicitationResponseHandler struct {
// Action defines the action to take
// +kubebuilder:validation:Enum=skip_remaining;abort;continue
// +kubebuilder:default=abort
Action string `json:"action,omitempty"`
}
Update the converter to handle these new fields.
Related Files
pkg/vmcp/config/config.go(implementation)cmd/thv-operator/api/v1alpha1/virtualmcpserver_types.go(CRD)cmd/thv-operator/api/v1alpha1/virtualmcpcompositetooldefinition_types.go(CRD)cmd/thv-operator/pkg/vmcpconfig/converter.go(converter)docs/proposals/THV-2106-virtual-mcp-server.md(proposal)