Repository navigation
feat(workflow-executor): let an MCP step make several tool calls - #1991
Open
hercemer42 wants to merge 3 commits into
Open
hercemer42 wants to merge 3 commits into
hercemer42 wants to merge 3 commits into
Conversation
An MCP step could call exactly one tool, then a separate AI call summarized its result. Tasks that need a lookup before an action (find a user, then open a ticket for them) could not be done in one step. The step now runs a loop over its allowed tools: the AI makes one call at a time, sees every previous result, and ends by calling complete-step, whose summary becomes formattedResponse. Each executed call is recorded in toolCalls; executionParams and toolResult keep the last call so readers of the single-call shape still work. A step is capped at 10 calls. Automatic mode stays 'executing' from the first call to the final answer, so an interruption still raises the existing StepStateError. Under confirmation every proposed call pauses with its confirmation cleared, and a rejection keeps the completed calls. A re-authentication pause keeps the completed calls and resumes from them, so they never run twice. Refs: PRD-1485 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Coverage Impact This PR will not change total coverage. Modified Files with Diff Coverage (4)
🛟 Help
|
The base step executor reports a timeout without cancelling the work, so a loop that outlived its step timeout went on asking the AI and calling tools in the background, and could mark the step done after it was reported as failed. The loop now checks the step's deadline before each AI decision and each tool call. Refs: PRD-1485 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
hercemer42
marked this pull request as ready for review
October 8, 2026 14:58
…P step made An MCP step handled manually, rejected or failed after some calls left later steps a summary naming only the proposed call: the calls that already ran, side effects included, were invisible to the AI of every following step. Such a step's summary now lists its calls with their results, and no longer presents an approved call as merely proposed. Refs: PRD-1485 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Lets an MCP step make several tool calls over its allowed tools, one at a time, before giving its answer. Under confirmation, each call is approved on its own.
fixes PRD-1485
What changes
complete-step, whose summary becomesformattedResponse. A step that asks for an 11th call fails.executionParams/executionResultdescribed the one call. After:McpStepExecutionData.toolCallslists every executed call ({ name, sourceId, input, result }).executionParamsandtoolResulthold the last call, andexecutionResultkeeps its shape.pendingDatawith the previous confirmation cleared. Accepting it runs that call and continues; rejecting it skips the step and keepstoolCalls.executingfrom the first call to the final answer, so a crash still raises the existing interrupted error. A re-authentication pause keeps the completed calls and resumes from them, so they never run twice. A step that has timed out starts no further AI decision or tool call.Not tested manually against a live executor: covered by the unit and integration suites (
mcp-step-executor.test.ts,workflow-execution.test.ts).Release plan
Ships last in PRD-130's stage 2, after PRD-1486 (forestadmin run view), so the run view already renders several calls when this executor emits them. No floor: the loop adds no field the orchestrator or front gates on, and PRD-1482's allow-list floor still applies.
Decisions
Squash message
Definition of Done
General
Security
🤖 Generated with Claude Code
Note
Let MCP steps in
workflow-executormake multiple tool calls in a loopMcpStepExecutorwith an iterative loop. The model now sees acomplete-steptool and a bounded list of scoped remote tools, and it chooses either another tool call or a final summary after each result.McpStepExecutionData.toolCalls. The last call is still written toexecutionParamsfor single-call readers, and the model's final summary becomes the formatted response.McpToolCallLimitError, and the model is instructed to narrow its prompt use when it hits the limit.McpStepExecutor.selectToolandformatToolResultare removed, and persisted MCP records gain thetoolCallsfield (see step-execution-data.ts). Steps that previously ended after one tool call now continue until the model callscomplete-step.Macroscope summarized 114c6e7.