Skip to content

fix(mcp): child workflow with response block returns error - #3114

Merged
icecrasher321 merged 1 commit into
stagingfrom
fix/mcp-response
Feb 2, 2026
Merged

fix(mcp): child workflow with response block returns error#3114
icecrasher321 merged 1 commit into
stagingfrom
fix/mcp-response

Conversation

@icecrasher321

Copy link
Copy Markdown
Collaborator

Summary

Undefined in response block payload is being interpreted as false returning an error flag even when executed correctly.

Type of Change

  • Bug fix

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercelBot commented Feb 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
ProjectDeploymentActionsUpdated (UTC)
docsSkippedSkippedFeb 2, 2026 5:25pm

Request Review

@greptile-apps

Copy link
Copy Markdown
Contributor

Greptile Overview

Greptile Summary

Fixed a boolean coercion bug in MCP tool execution that incorrectly flagged successful workflows with response blocks as errors. When executeResult.success is undefined (common with response blocks), the old logic !executeResult.success evaluated to true, setting isError: true incorrectly. The fix uses explicit comparison executeResult.success === false to only flag actual failures.

  • Changed isError: !executeResult.success to isError: executeResult.success === false in route.ts:287
  • Now correctly handles three states: undefined/true → no error, false → error
  • Resolves issue where child workflows with response blocks returned error flags despite successful execution

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The change is a precise, targeted fix for a clear boolean coercion bug. The logic is sound: using strict equality (=== false) instead of negation (!) prevents undefined from being falsely interpreted as an error. The fix maintains correct behavior for all three states (undefined, true, false) and only affects the specific edge case described in the PR.
  • No files require special attention

Important Files Changed

FilenameOverview
apps/sim/app/api/mcp/serve/[serverId]/route.tsFixed boolean coercion bug where undefined success field was incorrectly treated as error

Sequence Diagram

sequenceDiagram
participant Client
participant MCP as MCP Server Route
participant DB as Database
participant WF as Workflow Execute API
participant Executor as Workflow Executor
Client->>MCP: POST tools/call (workflow execution)
MCP->>DB: Fetch tool and workflow info
DB-->>MCP: Tool & workflow details
MCP->>WF: POST /api/workflows/{id}/execute
WF->>Executor: Execute workflow with input
Executor->>Executor: Process blocks & response block
alt Workflow with Response Block
Executor-->>WF: Result (success: undefined)
WF-->>MCP: executeResult {output, success: undefined}
Note over MCP: Bug: !undefined = true → isError: true ❌
Note over MCP: Fix: undefined === false → isError: false ✅
else Workflow Execution Failed
Executor-->>WF: Result (success: false)
WF-->>MCP: executeResult {success: false, error}
Note over MCP: false === false → isError: true ✅
else Normal Success
Executor-->>WF: Result (success: true)
WF-->>MCP: executeResult {success: true, output}
Note over MCP: true === false → isError: false ✅
end
MCP-->>Client: CallToolResult {content, isError}
Loading

@greptile-appsgreptile-appsBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@icecrasher321
icecrasher321 merged commit c286f3e into stagingFeb 2, 2026
12 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/mcp-response branch February 3, 2026 18:04
royceP2 pushed a commit to arenadeveloper02/p2-sim that referenced this pull request Mar 3, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@icecrasher321