-
Notifications
You must be signed in to change notification settings - Fork 166
Add FE tool output #1895
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add FE tool output #1895
Conversation
There was a problem hiding this 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
ToolResulttype 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.
| ...aiConfig, | ||
| model: currentModel, | ||
| }; | ||
|
|
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This conditional logic for skipping newMessage addition when isToolResultOnly is true lacks explanation. Add a comment explaining why tool-result-only submissions should not add the user message to history (e.g., 'Tool results are added separately to avoid duplicate/placeholder messages in history').
| // For tool-result-only submissions, tool outputs are recorded separately, | |
| // so we skip adding a placeholder user message to history to avoid | |
| // duplicate or misleading entries. |
|



Fixes OPS-3483