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
1 change: 1 addition & 0 deletions constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,5 @@ const (
propThen = "then"
propWorkflowType = "workflowType"
propVersion = "version"
propHttp = "http"
)
146 changes: 145 additions & 1 deletion 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{
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.",
OneOf: []*jsonschema.Schema{
{
Type: typeObject,
AdditionalProperties: falseSchema(),
},
{
Type: typeString,
},
},
},
"timeout": {
Title: "McpCallTimeout",
Description: "The duration after which the MCP call times out.",
Ref: SchemaRef("duration"),
},
"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
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
167 changes: 167 additions & 0 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,173 @@
}
}
]
},
{
"type": "object",
"title": "CallMCP",
"description": "Defines the MCP call to perform.",
"required": [
"call",
"with"
],
"unevaluatedProperties": false,
"allOf": [
{
"$ref": "#/$defs/taskBase"
},
{
"properties": {
"call": {
"type": "string",
"const": "mcp"
},
"with": {
"type": "object",
"properties": {
"client": {
"type": "object",
"properties": {
"name": {
"type": "string",
"title": "McpClientName",
"description": "The name of the client used to connect to the MCP server."
},
"version": {
"type": "string",
"title": "McpClientVersion",
"description": "The version of the client used to connect to the MCP server."
}
},
"title": "McpClient",
"description": "Describes the client used to perform the MCP call.",
"required": [
"name",
"version"
]
},
"method": {
"type": "string",
"title": "McpMethod",
"description": "The MCP method to call.",
"enum": [
"tools/list",
"tools/call",
"prompts/list",
"prompts/get",
"resources/list",
"resources/read",
"resources/templates/list"
]
},
"parameters": {
"title": "McpMethodParameters",
"description": "The MCP method parameters.",
"oneOf": [
{
"type": "object",
"additionalProperties": false
},
{
"type": "string"
}
]
},
"timeout": {
"$ref": "#/$defs/duration",
"title": "McpCallTimeout",
"description": "The duration after which the MCP call times out."
},
"transport": {
"type": "object",
"properties": {
"http": {
"type": "object",
"properties": {
"endpoint": {
"$ref": "#/$defs/endpoint",
"title": "McpHttpTransportEndpoint",
"description": "The MCP server endpoint to connect to."
},
"headers": {
"type": "object",
"title": "McpHttpTransportHeaders",
"description": "A key/value mapping of the HTTP headers to send with requests, if any.",
"additionalProperties": {
"type": "string"
}
}
},
"title": "McpHttpTransport",
"description": "The definition of the HTTP transport to use.",
"required": [
"endpoint"
]
},
"options": {
"type": "object",
"additionalProperties": {
"type": "object"
}
},
"stdio": {
"type": "object",
"properties": {
"arguments": {
"type": "array",
"items": {
"type": "string"
},
"title": "McpStdioTransportArguments",
"description": "An optional list of arguments to pass to the command."
},
"command": {
"type": "string",
"title": "McpStdioTransportCommand",
"description": "The command used to run the MCP server."
},
"environment": {
"type": "object",
"title": "McpStdioTransportEnvironment",
"description": "A key/value mapping, if any, of environment variables used to configure the MCP server.",
"additionalProperties": {
"type": "string"
}
}
},
"title": "McpStdioTransport",
"description": "The definition of the STDIO transport to use.",
"required": [
"command"
]
}
},
"title": "McpCallTransport",
"description": "The transport to use to perform the MCP call.",
"oneOf": [
{
"required": [
"http"
]
},
{
"required": [
"stdio"
]
}
]
}
},
"title": "MCPArguments",
"description": "The MCP call arguments.",
"required": [
"method",
"transport"
],
"unevaluatedProperties": false
}
}
}
]
}
]
},
Expand Down
Loading
Loading