Add an MCP tool workflow step backed by the cached server tools
Merged
AB
2d ago+1306+1306+0123456789012345678901234567890123456789-105-105-012345678901234567890123456789
Follows #29667 (merged); rebased onto main.
Demo
Adding a tool from a DeepWiki MCP server as a step, filling its argument, testing the workflow and reading the tool result in the run.
What
Every tool cached on an active mcpServer becomes a workflow step, the "flatten all tools" option Félix suggested rather than one big MCP node.
- New
MCP_TOOLaction type in twenty-shared with its settings schema:{ mcpServerId, toolName, toolInput }plus the usualexpectedOutputSchema, behindIS_MCP_SERVERS_ENABLEDthroughWORKFLOW_ACTION_FEATURE_FLAGS. - Server: the tool call path of the chat provider moves into
McpServerToolCallService(call, map errors, refresh the cached tools when the server no longer knows the tool), used by both the chat provider and the newMcpToolWorkflowAction. The action resolves variables intoolInput, drops the inputs still at their seedednull(user-supplied''and[]go through), checks the server is active and reachable by the run's application, calls the tool as the run user and returns the structured content (or the text blocks) as the step result; a tool failure becomes the step error. Step creation names the step after the tool and seedstoolInputfrom the tool's JSON schema. Output schema comes from the expected-output sample like CODE and HTTP_REQUEST. - Front: the step picker shows one section per MCP server, one entry per tool with its description. The edit panel reuses the logic-function form, driven by the tool's input schema converted with
jsonSchemaToInputSchema, plus the expected-output input; edits are debounced and flushed on unmount like the find-records editor. Icon, color, stroke and header follow the logic-function conventions with the canonical MCP icon. - The query document and the codegen glob live under
modules/mcp-servers/graphql, shared with the settings UI PR (#29669).
Application manifests do not export this step yet (it falls into the existing "not supported in application workflows" path).
Test
- Server: integration spec runs the step against the fake MCP server (variable resolution and result, then the tool disappearing: failed step and refreshed cache). Unit spec covers argument pruning and caller identity, the tool error as step error, inactive server, removed tool and the application reachability check. The manifest converter spec excludes
MCP_TOOLlikeCODE. - Front: jest test for the editor (every quick edit reaches the single debounced save; "Tool not found" state), util specs updated for the new type.