FLOW-1577: Fix double JSON.parse error in MCP tool return message parsing - (Jira Coding Agent) - #1894
Open
ccallcottstevens wants to merge 1 commit into
Open
Conversation
Add defensive parsing in safeJsonParse to detect and parse double-stringified JSON payloads for MCP tool return messages. This prevents SyntaxError caused by backend accidentally double-stringifying toolCallMessage.args in MCP tool returns (e.g., mcp__atlassian__invoke_tool). Update parseToolReturnMessage tests to cover this scenario, ensuring the UI shows meaningful tool invocation labels instead of generic fallbacks. This fix improves robustness and user experience by correctly displaying MCP tool details in the chat UI.
ccallcottstevens
requested review from
Blastoplex,
amarg-at,
bwieger-atlassian-com,
cabella-dot,
cindy-atl,
dchiew-atl,
jwang19-atlassian,
marcomura,
matt-lassian,
mattcolman,
sdzh-atlassian and
teg-atlassian
as code owners
July 3, 2026 00:00
Contributor
|
The issue is ready for review, and the acceptance criteria have been met:
|
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.
Fix JSON parsing error for MCP tool returns caused by double-stringified payloads
This PR addresses a SyntaxError occurring when parsing MCP tool return messages due to the backend accidentally double-stringifying the JSON payload in
toolCallMessage.args. The fix adds defensive parsing logic to detect and correctly parse double-stringified JSON, ensuring the UI displays meaningful tool invocation labels instead of generic fallbacks.Key changes:
safeJsonParseutility to detect and parse double-stringified JSON strings.parseToolReturnMessageto use the improved parsing for MCP tool return messages (mcp__atlassian__invoke_tool,mcp__atlassian__get_tool_schema,mcp__scout__invoke_tool).Impact:
This is a defensive, low-risk fix that mitigates a medium-severity issue affecting MCP tool integrations. Further backend investigation and UX improvements are recommended as next steps.
Rovo Dev code review: Rovo Dev has reviewed this pull request
Any suggestions or improvements have been posted as pull request comments.