|
15 | 15 | + [HTTP](#http-call)
|
16 | 16 | + [OpenAPI](#openapi-call)
|
17 | 17 | + [A2A](#a2a-call)
|
| 18 | + + [MCP](#mcp-call) |
18 | 19 | - [Do](#do)
|
19 | 20 | - [Emit](#emit)
|
20 | 21 | - [For](#for)
|
@@ -322,6 +323,7 @@ Serverless Workflow defines several default functions that **MUST** be supported
|
322 | 323 | - [HTTP](#http-call)
|
323 | 324 | - [OpenAPI](#openapi-call)
|
324 | 325 | - [A2A](#a2a-call)
|
| 326 | +- [MCP](#mcp-call) |
325 | 327 |
|
326 | 328 | ##### AsyncAPI Call
|
327 | 329 |
|
|
527 | 529 | text: Generate the Q1 sales report.
|
528 | 530 | ```
|
529 | 531 |
|
| 532 | +##### MCP Call |
| 533 | + |
| 534 | +The [MCP Call](#mcp-call) enables workflows to interact with MCP servers that are used by AI agents (https://modelcontextprotocol.io/). |
| 535 | + |
| 536 | +###### Properties |
| 537 | + |
| 538 | +| Name | Type | Required | Description| |
| 539 | +|:--|:---:|:---:|:---| |
| 540 | +| method | `string` | `yes` | The MCP JSON-RPC method to send.<br>*Supported values are: `initialize`, `notifications/initialized`, `prompts/list`, `prompts/get`, `notifications/prompts/list_changed`, `resources/list`, `resources/read`, `resources/templates/list`, `notifications/resources/list_changed`, `tools/list`, `tools/call`, `notifications/tools/list_changed`, `logging/setLevel`, and `notifications/message`* | |
| 541 | +| server | `string`\|[`endpoint`](#endpoint) | `yes` | An URI, an object (for HTTP) or a filename (for STDIO) that describes the MCP server to call.<br>| |
| 542 | +| parameters | `map` <br> `string` | `no` | The parameters for the MCP RPC method. For the `initialize` method, runtimes must set the `protocolVersion` parameter to the used version. Runtimes must implement the MCP specification version of 2025-06-18. <br>*Can be an object or a runtime expression.* | |
| 543 | + |
| 544 | +> [!NOTE] |
| 545 | +> On success the output is the JSON-RPC result. On failure runtimes must raise an error with type [https://serverlessworkflow.io/spec/1.0.0/errors/runtime](https://github.com/serverlessworkflow/specification/blob/main/dsl-reference.md#standard-error-types). |
| 546 | +> |
| 547 | +> This call supports MCP over both HTTP and STDIO (communication over standard in and standard out) transport mechanisms. |
| 548 | + |
| 549 | +###### Examples |
| 550 | + |
| 551 | +This example shows an initialization phase as the first interaction between MCP client and server. The client sends its supported version, capabilities, and implementation information in the initialize request. The server MUST respond with its own capabilities and information including the supported version. |
| 552 | + |
| 553 | +```yaml |
| 554 | +document: |
| 555 | + dsl: '1.0.1' |
| 556 | + namespace: test |
| 557 | + name: mcp-example |
| 558 | + version: '0.1.0' |
| 559 | +do: |
| 560 | + - GenerateReport: |
| 561 | + call: mcp |
| 562 | + with: |
| 563 | + method: initialize |
| 564 | + server: |
| 565 | + endpoint: https://example.com/mcp |
| 566 | + parameters: |
| 567 | + protocolVersion: '2025-03-26' |
| 568 | + capabilities: |
| 569 | + roots: |
| 570 | + listChanged: true |
| 571 | + clientInfo: |
| 572 | + name: 'ExampleClient' |
| 573 | + version: '1.0.0' |
| 574 | +``` |
| 575 | + |
| 576 | +The following example showcases a prompts/list request by the client to retrieve available prompts from the MCP server. |
| 577 | + |
| 578 | +```yaml |
| 579 | +document: |
| 580 | + dsl: '1.0.1' |
| 581 | + namespace: test |
| 582 | + name: mcp-example |
| 583 | + version: '0.1.0' |
| 584 | +do: |
| 585 | + - GenerateReport: |
| 586 | + call: mcp |
| 587 | + with: |
| 588 | + method: prompts/get |
| 589 | + server: |
| 590 | + endpoint: https://example.com/mcp |
| 591 | + parameters: |
| 592 | + name: "code_review" |
| 593 | + arguments: |
| 594 | + code: "def hello():\n print('world')" |
| 595 | +``` |
| 596 | + |
530 | 597 | #### Do
|
531 | 598 |
|
532 | 599 | Serves as a fundamental building block within workflows, enabling the sequential execution of multiple subtasks. By defining a series of subtasks to perform in sequence, the Do task facilitates the efficient execution of complex operations, ensuring that each subtask is completed before the next one begins.
|
@@ -2706,4 +2773,4 @@ References a workflow definition.
|
2706 | 2773 | name: greet
|
2707 | 2774 | namespace: samples
|
2708 | 2775 | version: '0.1.0-rc2'
|
2709 |
| -``` |
| 2776 | +``` |
0 commit comments