Skip to main content

VirtualMCPCompositeToolDefinition

VirtualMCPCompositeToolDefinition defines a reusable composite tool workflow - a sequence of backend tool calls exposed to clients as a single high-level tool. Referenced by a VirtualMCPServer via spec.config.compositeToolRefs.

API: toolhive.stacklok.dev/v1alpha1 · Scope: Namespaced · Short names: vmcpctd, compositetool

Example

virtualmcpcompositetooldefinition.yaml
apiVersion: toolhive.stacklok.dev/v1alpha1
kind: VirtualMCPCompositeToolDefinition
metadata:
name: my-virtualmcpcompositetooldefinition
namespace: default
spec:
name: <string>
steps: []

Schema

spec

VirtualMCPCompositeToolDefinitionSpec defines the desired state of VirtualMCPCompositeToolDefinition. This embeds the CompositeToolConfig from pkg/vmcp/config to share the configuration model between CLI and operator usage.

FieldTypeDescription
descriptionstring

Description describes what the workflow does.

namerequiredstring

Name is the workflow name (unique identifier).

outputobject

Output defines the structured output schema for this workflow. If not specified, the workflow returns the last step's output (backward compatible).

parametersobject

Parameters defines input parameter schema in JSON Schema format. Should be a JSON Schema object with "type": "object" and "properties". Example: { "type": "object", "properties": { "param1": {"type": "string", "default": "value"}, "param2": {"type": "integer"} }, "required": ["param2"] } We use json.Map rather than a typed struct because JSON Schema is highly flexible with many optional fields (default, enum, minimum, maximum, pattern, items, additionalProperties, oneOf, anyOf, allOf, etc.). Using json.Map allows full JSON Schema compatibility without needing to define every possible field, and matches how the MCP SDK handles inputSchema.

stepsrequiredobject[]

Steps are the workflow steps to execute.

timeoutstring

Timeout is the maximum workflow execution time.


pattern ^([0-9]+(\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$

spec.output

Output defines the structured output schema for this workflow. If not specified, the workflow returns the last step's output (backward compatible).

FieldTypeDescription
propertiesrequiredmap<string, object>

Properties defines the output properties. Map key is the property name, value is the property definition.

requiredstring[]

Required lists property names that must be present in the output.

spec.output.properties

Properties defines the output properties. Map key is the property name, value is the property definition.

FieldTypeDescription
default

Default is the fallback value if template expansion fails. Type coercion is applied to match the declared Type.

descriptionstring

Description is a human-readable description exposed to clients and models

propertiesobject

Properties defines nested properties for object types. Each nested property has full metadata (type, description, value/properties).

typestring

Type is the JSON Schema type: "string", "integer", "number", "boolean", "object", "array"


enum: string | integer | number | boolean | object | array
valuestring

Value is a template string for constructing the runtime value. For object types, this can be a JSON string that will be deserialized. Supports template syntax: {{.steps.step_id.output.field}}, {{.params.param_name}}

spec.steps[]

Steps are the workflow steps to execute.

FieldTypeDescription
argumentsobject

Arguments is a map of argument values with template expansion support. Supports Go template syntax with .params and .steps for string values. Non-string values (integers, booleans, arrays, objects) are passed as-is. Note: the templating is only supported on the first level of the key-value pairs.

collectionstring

Collection is a Go template expression that resolves to a JSON array or a slice. Only used when Type is "forEach".

conditionstring

Condition is a template expression that determines if the step should execute

defaultResults

DefaultResults provides fallback output values when this step is skipped (due to condition evaluating to false) or fails (when onError.action is "continue"). Each key corresponds to an output field name referenced by downstream steps. Required if the step may be skipped AND downstream steps reference this step's output.

dependsOnstring[]

DependsOn lists step IDs that must complete before this step

idrequiredstring

ID is the unique identifier for this step.

itemVarstring

ItemVar is the variable name used to reference the current item in forEach templates. Defaults to "item" if not specified. Only used when Type is "forEach".

maxIterationsinteger

MaxIterations limits the number of items that can be iterated over. Defaults to 100, hard cap at 1000. Only used when Type is "forEach".

maxParallelinteger

MaxParallel limits the number of concurrent iterations in a forEach step. Defaults to the DAG executor's maxParallel (10). Only used when Type is "forEach".

messagestring

Message is the elicitation message Only used when Type is "elicitation"

onCancelobject

OnCancel defines the action to take when the user cancels/dismisses the elicitation Only used when Type is "elicitation"

onDeclineobject

OnDecline defines the action to take when the user explicitly declines the elicitation Only used when Type is "elicitation"

onErrorobject

OnError defines error handling behavior

schemaobject

Schema defines the expected response schema for elicitation

stepobject

InnerStep defines the step to execute for each item in the collection. Only used when Type is "forEach". Only tool-type inner steps are supported.

timeoutstring

Timeout is the maximum execution time for this step


pattern ^([0-9]+(\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$
toolstring

Tool is the tool to call (format: "workload.tool_name") Only used when Type is "tool"

typestring

Type is the step type (tool, elicitation, etc.)


default "tool" · enum: tool | elicitation | forEach
spec.steps.onCancel

OnCancel defines the action to take when the user cancels/dismisses the elicitation Only used when Type is "elicitation"

FieldTypeDescription
actionstring

Action defines the action to take when the user declines or cancels - skip_remaining: Skip remaining steps in the workflow - abort: Abort the entire workflow execution - continue: Continue to the next step


default "abort" · enum: skip_remaining | abort | continue
spec.steps.onDecline

OnDecline defines the action to take when the user explicitly declines the elicitation Only used when Type is "elicitation"

FieldTypeDescription
actionstring

Action defines the action to take when the user declines or cancels - skip_remaining: Skip remaining steps in the workflow - abort: Abort the entire workflow execution - continue: Continue to the next step


default "abort" · enum: skip_remaining | abort | continue
spec.steps.onError

OnError defines error handling behavior

FieldTypeDescription
actionstring

Action defines the action to take on error


default "abort" · enum: abort | continue | retry
retryCountinteger

RetryCount is the maximum number of retries Only used when Action is "retry"

retryDelaystring

RetryDelay is the delay between retry attempts Only used when Action is "retry"


pattern ^([0-9]+(\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$

status

VirtualMCPCompositeToolDefinitionStatus defines the observed state of VirtualMCPCompositeToolDefinition

FieldTypeDescription
conditionsobject[]

Conditions represent the latest available observations of the workflow's state

observedGenerationinteger

ObservedGeneration is the most recent generation observed for this VirtualMCPCompositeToolDefinition It corresponds to the resource's generation, which is updated on mutation by the API Server


format int64
referencingVirtualServersstring[]

ReferencingVirtualServers lists VirtualMCPServer resources that reference this workflow This helps track which servers need to be reconciled when this workflow changes

validationErrorsstring[]

ValidationErrors contains validation error messages if ValidationStatus is Invalid

validationStatusstring

ValidationStatus indicates the validation state of the workflow - Valid: Workflow structure is valid - Invalid: Workflow has validation errors


enum: Valid | Invalid | Unknown

status.conditions[]

Conditions represent the latest available observations of the workflow's state

FieldTypeDescription
lastTransitionTimerequiredstring

lastTransitionTime is the last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.


format date-time
messagerequiredstring

message is a human readable message indicating details about the transition. This may be an empty string.


maxLength 32768
observedGenerationinteger

observedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance.


format int64 · min 0
reasonrequiredstring

reason contains a programmatic identifier indicating the reason for the condition's last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API. The value should be a CamelCase string. This field may not be empty.


pattern ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ · minLength 1 · maxLength 1024
statusrequiredstring

status of the condition, one of True, False, Unknown.


enum: True | False | Unknown
typerequiredstring

type of condition in CamelCase or in foo.example.com/CamelCase.


pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ · maxLength 316

Referenced by: