Skip to content

Commit 107ea07

Browse files
authored
Fix tool step type in vMCP CRD (#2608)
* Fix tool step type in vMCP CRD The actual type is `type: "tool"` not `tool_call`. ``` pkg/vmcp/composer/composer.go: // StepTypeTool executes a backend tool. pkg/vmcp/composer/composer.go: StepTypeTool StepType = "tool" ``` So this fixes this erroneous reference. Signed-off-by: Juan Antonio Osorio <[email protected]> * bump chart Signed-off-by: Juan Antonio Osorio <[email protected]> * Fix chainsaw tests Signed-off-by: Juan Antonio Osorio <[email protected]> --------- Signed-off-by: Juan Antonio Osorio <[email protected]>
1 parent d06cdcb commit 107ea07

File tree

11 files changed

+34
-35
lines changed

11 files changed

+34
-35
lines changed

cmd/thv-operator/api/v1alpha1/virtualmcpcompositetooldefinition_webhook.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,12 +233,12 @@ func (*VirtualMCPCompositeToolDefinition) validateStepType(index int, step Workf
233233
WorkflowStepTypeElicitation: true,
234234
}
235235
if !validTypes[stepType] {
236-
return fmt.Errorf("spec.steps[%d].type must be one of: tool_call, elicitation", index)
236+
return fmt.Errorf("spec.steps[%d].type must be one of: tool, elicitation", index)
237237
}
238238

239239
if stepType == WorkflowStepTypeToolCall {
240240
if step.Tool == "" {
241-
return fmt.Errorf("spec.steps[%d].tool is required when type is tool_call", index)
241+
return fmt.Errorf("spec.steps[%d].tool is required when type is tool", index)
242242
}
243243
if !isValidToolReference(step.Tool) {
244244
return fmt.Errorf("spec.steps[%d].tool must be in format 'workload.tool_name'", index)

cmd/thv-operator/api/v1alpha1/virtualmcpcompositetooldefinition_webhook_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ func TestVirtualMCPCompositeToolDefinitionValidate(t *testing.T) {
171171
errMsg: "spec.steps[0].id is required",
172172
},
173173
{
174-
name: "missing tool for tool_call step",
174+
name: "missing tool for tool step",
175175
ctd: &VirtualMCPCompositeToolDefinition{
176176
Spec: VirtualMCPCompositeToolDefinitionSpec{
177177
Name: "deploy_app",
@@ -186,7 +186,7 @@ func TestVirtualMCPCompositeToolDefinitionValidate(t *testing.T) {
186186
},
187187
},
188188
wantErr: true,
189-
errMsg: "spec.steps[0].tool is required when type is tool_call",
189+
errMsg: "spec.steps[0].tool is required when type is tool",
190190
},
191191
{
192192
name: "invalid tool reference format",

cmd/thv-operator/api/v1alpha1/virtualmcpserver_types.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -226,14 +226,14 @@ type WorkflowStep struct {
226226
// +kubebuilder:validation:Required
227227
ID string `json:"id"`
228228

229-
// Type is the step type (tool_call, elicitation, etc.)
230-
// +kubebuilder:validation:Enum=tool_call;elicitation
231-
// +kubebuilder:default=tool_call
229+
// Type is the step type (tool, elicitation, etc.)
230+
// +kubebuilder:validation:Enum=tool;elicitation
231+
// +kubebuilder:default=tool
232232
// +optional
233233
Type string `json:"type,omitempty"`
234234

235235
// Tool is the tool to call (format: "workload.tool_name")
236-
// Only used when Type is "tool_call"
236+
// Only used when Type is "tool"
237237
// +optional
238238
Tool string `json:"tool,omitempty"`
239239

@@ -505,7 +505,7 @@ const (
505505
// Workflow step types
506506
const (
507507
// WorkflowStepTypeToolCall calls a backend tool
508-
WorkflowStepTypeToolCall = "tool_call"
508+
WorkflowStepTypeToolCall = "tool"
509509

510510
// WorkflowStepTypeElicitation requests user input
511511
WorkflowStepTypeElicitation = "elicitation"

cmd/thv-operator/api/v1alpha1/virtualmcpserver_webhook.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ func validateCompositeToolStep(
283283
// validateStepType validates the step type and type-specific requirements
284284
func validateStepType(toolIndex, stepIndex int, step WorkflowStep) error {
285285
if step.Type != "" && step.Type != WorkflowStepTypeToolCall && step.Type != WorkflowStepTypeElicitation {
286-
return fmt.Errorf("spec.compositeTools[%d].steps[%d].type must be tool_call or elicitation", toolIndex, stepIndex)
286+
return fmt.Errorf("spec.compositeTools[%d].steps[%d].type must be tool or elicitation", toolIndex, stepIndex)
287287
}
288288

289289
stepType := step.Type
@@ -292,7 +292,7 @@ func validateStepType(toolIndex, stepIndex int, step WorkflowStep) error {
292292
}
293293

294294
if stepType == WorkflowStepTypeToolCall && step.Tool == "" {
295-
return fmt.Errorf("spec.compositeTools[%d].steps[%d].tool is required when type is tool_call", toolIndex, stepIndex)
295+
return fmt.Errorf("spec.compositeTools[%d].steps[%d].tool is required when type is tool", toolIndex, stepIndex)
296296
}
297297

298298
if stepType == WorkflowStepTypeElicitation && step.Message == "" {

cmd/thv-operator/api/v1alpha1/virtualmcpserver_webhook_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ func TestVirtualMCPServerValidate(t *testing.T) {
306306
errMsg: "spec.compositeTools[0].steps[0].id is required",
307307
},
308308
{
309-
name: "invalid composite tool - tool_call step without tool",
309+
name: "invalid composite tool - tool step without tool",
310310
vmcp: &VirtualMCPServer{
311311
Spec: VirtualMCPServerSpec{
312312
GroupRef: GroupRef{Name: "test-group"},
@@ -325,7 +325,7 @@ func TestVirtualMCPServerValidate(t *testing.T) {
325325
},
326326
},
327327
wantErr: true,
328-
errMsg: "spec.compositeTools[0].steps[0].tool is required when type is tool_call",
328+
errMsg: "spec.compositeTools[0].steps[0].tool is required when type is tool",
329329
},
330330
{
331331
name: "invalid composite tool - elicitation step without message",

deploy/charts/operator-crds/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ apiVersion: v2
22
name: toolhive-operator-crds
33
description: A Helm chart for installing the ToolHive Operator CRDs into Kubernetes.
44
type: application
5-
version: 0.0.56
5+
version: 0.0.57
66
appVersion: "0.0.1"

deploy/charts/operator-crds/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
# ToolHive Operator CRDs Helm Chart
33

4-
![Version: 0.0.56](https://img.shields.io/badge/Version-0.0.56-informational?style=flat-square)
4+
![Version: 0.0.57](https://img.shields.io/badge/Version-0.0.57-informational?style=flat-square)
55
![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)
66

77
A Helm chart for installing the ToolHive Operator CRDs into Kubernetes.

deploy/charts/operator-crds/crds/toolhive.stacklok.dev_virtualmcpcompositetooldefinitions.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,13 @@ spec:
179179
tool:
180180
description: |-
181181
Tool is the tool to call (format: "workload.tool_name")
182-
Only used when Type is "tool_call"
182+
Only used when Type is "tool"
183183
type: string
184184
type:
185-
default: tool_call
186-
description: Type is the step type (tool_call, elicitation,
187-
etc.)
185+
default: tool
186+
description: Type is the step type (tool, elicitation, etc.)
188187
enum:
189-
- tool_call
188+
- tool
190189
- elicitation
191190
type: string
192191
required:

deploy/charts/operator-crds/crds/toolhive.stacklok.dev_virtualmcpservers.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,14 +265,14 @@ spec:
265265
tool:
266266
description: |-
267267
Tool is the tool to call (format: "workload.tool_name")
268-
Only used when Type is "tool_call"
268+
Only used when Type is "tool"
269269
type: string
270270
type:
271-
default: tool_call
272-
description: Type is the step type (tool_call, elicitation,
271+
default: tool
272+
description: Type is the step type (tool, elicitation,
273273
etc.)
274274
enum:
275-
- tool_call
275+
- tool
276276
- elicitation
277277
type: string
278278
required:

docs/operator/crd-api.md

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)