-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix: add missing tool result to AppsRenderer #1075
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?
fix: add missing tool result to AppsRenderer #1075
Conversation
|
|
||
| const runTool = async () => { | ||
| try { | ||
| const result = await mcpClient.request( |
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.
While calling the tool from here works.
I wonder if the tool result is already present and can be passed as a prop to this component instead of making a brand new tool request.
let me know if that's preferable
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.
I tested this PR and it works. However, I would rather this part operate more like the ToolsTab tool calling scheme. To test the theory, I removed these changes and passed down toolResult from App -> AppsTab -> AppRenderer and it works, but only if I run the tool in the tool tab first.
To complete the scenario, we would need to pass down callTool from the App, and in AppsTab.handleSelectTool, where we set the app to be open if there is no form to fill first, call the tool. Also in AppsTab.handleOpenApp which handles the Open App button if there was a form to fill, call the tool. Probably there can be a common function that is called from both those places.
|
@cliffhall this should also fix the pdf server and the other examples that were failing |
cliffhall
left a comment
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.
Agree that using toolResult and the existing callTool function is better. Following the pattern with ToolsTab I see it can be done.
|
|
||
| const runTool = async () => { | ||
| try { | ||
| const result = await mcpClient.request( |
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.
I tested this PR and it works. However, I would rather this part operate more like the ToolsTab tool calling scheme. To test the theory, I removed these changes and passed down toolResult from App -> AppsTab -> AppRenderer and it works, but only if I run the tool in the tool tab first.
To complete the scenario, we would need to pass down callTool from the App, and in AppsTab.handleSelectTool, where we set the app to be open if there is no form to fill first, call the tool. Also in AppsTab.handleOpenApp which handles the Open App button if there was a form to fill, call the tool. Probably there can be a common function that is called from both those places.
Summary
Fixes Apps tab missing tool result data causing Budget Allocator Server example not to display correctly.
This was to do with missing tool result not passed to the AppsRenderer component
Type of Change
Changes Made
In Apps tab, apps received
ui/notifications/tool-inputbut notui/notifications/tool-result. Apps that initialize from ontoolresult (for example, budget allocator) could render empty due to missing tool dataFile changes:
Added Apps tool execution in
AppRenderer.tsxAfter app/tool input changes, Inspector now calls MCP tools/call with the selected tool and current arguments.
Forwarded the returned result to the iframe via toolResult (which emits ui/notifications/tool-result).
Added race safety with AbortController + run-id latest-wins guard to drop stale results during switch/restart/unmount.
Added error fallback: failed tools/call is converted to app-consumable error result (isError: true) to keep UI stable.
Left Tools tab behavior unchanged.
Tests updated in
AppRenderer.test.tsxRelated Issues
Testing
Test Results and/or Instructions
Run the budget allocation server example: https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/budget-allocator-server
Broken version:

Fixed version:
Checklist
npm run prettier-fix)Breaking Changes
Additional Context