Conversation
Junyi-99
commented
Oct 28, 2025
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for rendering JSON-RPC tool call responses in the UI with a collapsible card interface. It introduces a new component specifically designed to display JSON-RPC formatted results from MCP (Model Context Protocol) tools.
- Adds
JsonRpccomponent with collapsible UI for JSON-RPC tool responses - Implements JSON-RPC result parsing utilities
- Integrates JSON-RPC rendering into the tools routing system
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| webapp/_webapp/src/index.css | Adds styling for narrow tool cards and JSON-RPC specific title styles |
| webapp/_webapp/src/components/message-entry-container/tools/utils/common.tsx | Defines JSON-RPC types and parsing utilities |
| webapp/_webapp/src/components/message-entry-container/tools/unknown-jsonrpc.tsx | Creates fallback component for unknown JSON-RPC tools |
| webapp/_webapp/src/components/message-entry-container/tools/tools.tsx | Routes JSON-RPC tools to appropriate card component |
| webapp/_webapp/src/components/message-entry-container/tools/jsonrpc.tsx | Implements collapsible card UI for JSON-RPC results |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| export const parseJsonRpcResult = (message: string): JsonRpcResult | undefined => { | ||
| try { | ||
| const json = JSON.parse(message); | ||
| return json as JsonRpcResult; | ||
| } catch (error) { | ||
| return undefined; | ||
| } | ||
| } No newline at end of file |
There was a problem hiding this comment.
The function uses a type assertion without validating that the parsed JSON actually matches the JsonRpcResult structure. Consider adding runtime validation to ensure the parsed object has the expected properties (jsonrpc, id, and either result or error) before casting.
webapp/_webapp/src/components/message-entry-container/tools/tools.tsx
Outdated
Show resolved
Hide resolved
webapp/_webapp/src/components/message-entry-container/tools/jsonrpc.tsx
Outdated
Show resolved
Hide resolved
…onrpc.tsx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ols.tsx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ger/paperdebugger into feat-frontend-jsonrpc
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <div className="flex items-center justify-between cursor-pointer" onClick={toggleCollapse}> | ||
| <h3 className="tool-card-title tool-card-jsonrpc">{functionName}</h3> | ||
| <button | ||
| onClick={toggleCollapse} |
There was a problem hiding this comment.
The button's onClick handler is redundant since its parent div already has onClick={toggleCollapse}. This creates duplicate click handling and could cause the toggle function to be called twice.
| onClick={toggleCollapse} |