Skip to content

Conversation

@alexandrudanpop
Copy link
Contributor

Fixes OPS-3483

Copilot AI review requested due to automatic review settings January 27, 2026 15:51
@linear
Copy link

linear bot commented Jan 27, 2026

@alexandrudanpop alexandrudanpop requested review from cezudas and removed request for Copilot January 27, 2026 15:51
Copilot AI review requested due to automatic review settings January 28, 2026 08:27
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for capturing and processing frontend tool execution results in the AI chat system. The implementation allows the frontend to send tool outputs back to the backend, which are then properly integrated into the chat history for continued conversation flow.

Changes:

  • Added ToolResult type and extraction logic to capture frontend tool execution outputs
  • Refactored tool result handling to use actual frontend results instead of placeholder messages
  • Updated message parsing to support tool-result-only submissions

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/shared/src/lib/ai/chat/index.ts Adds ToolResult type and AIChatMessage union type for structured tool output
packages/server/api/test/unit/mcp/tool-utils.test.ts Comprehensive test coverage for new tool result extraction and mapping utilities
packages/server/api/src/app/ai/mcp/tool-utils.ts Implements tool result extraction from messages and logic to add missing UI tool results to chat history
packages/server/api/src/app/ai/chat/user-message-handler.ts Integrates frontend tool results into chat history processing flow
packages/server/api/src/app/ai/chat/message-parser.ts Updates message parser to handle tool-result-only submissions with dedicated constant
packages/server/api/src/app/ai/chat/chat-request-router.ts Adds routing support for tool-result-only messages and passes frontend results through request pipeline
packages/server/api/src/app/ai/chat/ai-mcp-chat.controller.ts Extracts tool results from incoming messages and handles tool-result-only submissions
packages/react-ui/src/app/features/ai/lib/assistant-ui-chat-hook.ts Updates frontend to use addToolOutput with structured state information instead of addToolResult

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 217 to 219
input: isToolResultOnly
? UI_TOOL_RESULT_SUBMISSION_MESSAGE
: messageContent,
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this change? As you also change the 'parseUserMessage', I think the messageContent has the right value

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 2, 2026

❌ The last analysis has failed.

See analysis details on SonarQube Cloud

@alexandrudanpop alexandrudanpop merged commit aa8cc31 into main Feb 2, 2026
25 checks passed
@alexandrudanpop alexandrudanpop deleted the feat/fe-tool-output branch February 2, 2026 12:54
Sign up for free to 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.

3 participants