Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ const (
propRetryPolicy = "retryPolicy"
propTaskQueue = "taskQueue"
propType = "type"
propScheduleWorkflowName = "scheduleWorkflowName"
propScheduleWorkflowType = "scheduleWorkflowType"
propScheduleID = "scheduleId"
propScheduleInput = "scheduleInput"
Expand All @@ -124,4 +123,5 @@ const (
propThen = "then"
propWorkflowType = "workflowType"
propVersion = "version"
propHttp = "http"
)
153 changes: 145 additions & 8 deletions definitions.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ var callTaskDefinition = &jsonschema.Schema{
Properties: map[string]*jsonschema.Schema{
propCall: {
Type: typeString,
Const: utils.Ptr[any]("http"),
Const: utils.Ptr[any](propHttp),
},
propWith: {
Type: typeObject,
Expand Down Expand Up @@ -254,6 +254,150 @@ var callTaskDefinition = &jsonschema.Schema{
},
},
},
{
Type: typeObject,
Title: "CallMCP",
Description: "Defines the MCP call to perform.",
UnevaluatedProperties: falseSchema(),
Required: []string{propCall, propWith},
AllOf: []*jsonschema.Schema{
{Ref: SchemaRef("taskBase")},
{
Properties: map[string]*jsonschema.Schema{
propCall: {
Type: typeString,
Const: utils.Ptr[any]("mcp"),
},
propWith: {
Type: typeObject,
Title: "MCPArguments",
Description: "The MCP call arguments.",
UnevaluatedProperties: falseSchema(),
Required: []string{propMethod, "transport"},
Properties: map[string]*jsonschema.Schema{
"protocolVersion": {
Type: typeString,
Default: json.RawMessage(`"2025-06-18"`),
Title: "McpProtocolVersion",
Description: "The version of the MCP protocol to use.",
},
propMethod: {
Type: typeString,
Enum: []any{
"tools/list",
"tools/call",
"prompts/list",
"prompts/get",
"resources/list",
"resources/read",
"resources/templates/list",
},
Title: "McpMethod",
Description: "The MCP method to call.",
},
"parameters": {
Title: "McpMethodParameters",
Description: "The MCP method parameters.",
Type: typeObject,
AdditionalProperties: trueSchema(),
},
"timeout": {
Title: "McpCallTimeout",
Description: "The duration after which the MCP call times out.",
Ref: SchemaRef("duration"),
Default: json.RawMessage(`{"seconds": 30}`),
},
"transport": {
Type: typeObject,
Title: "McpCallTransport",
Description: "The transport to use to perform the MCP call.",
Properties: map[string]*jsonschema.Schema{
propHttp: {
Type: typeObject,
Title: "McpHttpTransport",
Description: "The definition of the HTTP transport to use.",
Required: []string{"endpoint"},
Properties: map[string]*jsonschema.Schema{
"endpoint": {
Ref: SchemaRef("endpoint"),
Title: "McpHttpTransportEndpoint",
Description: "The MCP server endpoint to connect to.",
},
"headers": {
Type: typeObject,
AdditionalProperties: &jsonschema.Schema{
Type: typeString,
},
Title: "McpHttpTransportHeaders",
Description: "A key/value mapping of the HTTP headers to send with requests, if any.",
},
},
},
"stdio": {
Type: typeObject,
Title: "McpStdioTransport",
Description: "The definition of the STDIO transport to use.",
Required: []string{"command"},
Properties: map[string]*jsonschema.Schema{
"command": {
Type: typeString,
Title: "McpStdioTransportCommand",
Description: "The command used to run the MCP server.",
},
"arguments": {
Type: typeArray,
Items: &jsonschema.Schema{
Type: typeString,
},
Title: "McpStdioTransportArguments",
Description: "An optional list of arguments to pass to the command.",
},
"environment": {
Type: typeObject,
AdditionalProperties: &jsonschema.Schema{
Type: typeString,
},
Title: "McpStdioTransportEnvironment",
Description: "A key/value mapping, if any, of environment variables used to configure the MCP server.",
},
},
},
"options": {
Type: typeObject,
AdditionalProperties: &jsonschema.Schema{
Type: typeObject,
},
},
},
OneOf: []*jsonschema.Schema{
{Required: []string{propHttp}},
{Required: []string{"stdio"}},
},
},
"client": {
Type: typeObject,
Title: "McpClient",
Description: "Describes the client used to perform the MCP call.",
Required: []string{propName, propVersion},
Properties: map[string]*jsonschema.Schema{
propName: {
Type: typeString,
Title: "McpClientName",
Description: "The name of the client used to connect to the MCP server.",
},
propVersion: {
Type: typeString,
Title: "McpClientVersion",
Description: "The version of the client used to connect to the MCP server.",
},
},
},
},
},
},
},
},
},
},
}

Expand Down Expand Up @@ -420,13 +564,6 @@ var documentMetadataDefinition = &jsonschema.Schema{
"Defaults to document.workflowType; required when every top-level task is a Do task.",
MinLength: utils.Ptr(1),
},
propScheduleWorkflowName: {
Type: typeString,
Title: "ScheduleWorkflowName",
Description: "Deprecated: use scheduleWorkflowType.",
MinLength: utils.Ptr(1),
Deprecated: true,
},
propScheduleID: {
Type: typeString,
Title: "ScheduleID",
Expand Down
4 changes: 2 additions & 2 deletions definitions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,11 @@ func TestCallTaskDefinitionVariants(t *testing.T) {
consts = append(consts, callConst(s))
}

for _, want := range []string{"activity", "grpc", "http"} {
for _, want := range []string{"activity", "grpc", "http", "mcp"} {
assert.True(t, slices.Contains(consts, want), "callTask should support %q", want)
}

for _, absent := range []string{"asyncapi", "openapi", "mcp", "a2a"} {
for _, absent := range []string{"asyncapi", "openapi", "a2a"} {
assert.False(t, slices.Contains(consts, absent), "callTask must not support %q", absent)
}
}
Expand Down
12 changes: 0 additions & 12 deletions metadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ func TestDocumentMetadataDefinitionShape(t *testing.T) {

for _, key := range []string{
propCanMaxHistory,
propScheduleWorkflowName,
propScheduleWorkflowType,
propScheduleID,
propScheduleInput,
Expand All @@ -168,8 +167,6 @@ func TestDocumentMetadataDefinitionShape(t *testing.T) {
}

assert.Equal(t, typeInteger, def.Properties[propCanMaxHistory].Type)
assert.Equal(t, typeString, def.Properties[propScheduleWorkflowName].Type)
assert.True(t, def.Properties[propScheduleWorkflowName].Deprecated, "scheduleWorkflowName is a deprecated alias")
assert.Equal(t, typeString, def.Properties[propScheduleWorkflowType].Type)
assert.False(t, def.Properties[propScheduleWorkflowType].Deprecated)
assert.Equal(t, typeString, def.Properties[propScheduleID].Type)
Expand Down Expand Up @@ -227,10 +224,6 @@ func TestDocumentMetadata_Validation(t *testing.T) {
expectError bool
}{
// ---- valid cases ----
{
name: "scheduleWorkflowName string is accepted",
meta: map[string]any{"scheduleWorkflowName": testWorkflowType},
},
{
name: "scheduleWorkflowType string is accepted",
meta: map[string]any{propScheduleWorkflowType: testWorkflowType},
Expand Down Expand Up @@ -269,11 +262,6 @@ func TestDocumentMetadata_Validation(t *testing.T) {
},

// ---- invalid cases ----
{
name: "scheduleWorkflowName as integer is rejected",
meta: map[string]any{"scheduleWorkflowName": 42},
expectError: true,
},
{
name: "scheduleWorkflowType as integer is rejected",
meta: map[string]any{propScheduleWorkflowType: 42},
Expand Down
Loading
Loading