Skip to content
This repository was archived by the owner on May 21, 2026. It is now read-only.

Commit dc06590

Browse files
committed
feat(inspector): enhance ToolsTab with MCP UI resource preview functionality
- Add conditional rendering for MCP UI resources in ToolsTab component - Implement buttons to toggle between preview and JSON modes for better user interaction - Remove redundant URI display logic to streamline the component
1 parent 49a87f6 commit dc06590

1 file changed

Lines changed: 32 additions & 30 deletions

File tree

packages/inspector/src/client/components/ToolsTab.tsx

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,38 @@ export function ToolsTab({ tools, callTool, isConnected }: ToolsTabProps) {
539539
</span>
540540
</div>
541541
)}
542+
{hasMcpUIResources && (
543+
<div className="flex items-center gap-4 ml-4">
544+
<span className="text-xs text-gray-500 dark:text-gray-400">
545+
URI:
546+
{' '}
547+
{mcpUIResources[0]?.resource?.uri || 'No URI'}
548+
</span>
549+
<div className="flex items-center gap-2">
550+
<button
551+
onClick={() => setPreviewMode(true)}
552+
className={`text-xs font-medium ${
553+
previewMode
554+
? 'text-black dark:text-white'
555+
: 'text-zinc-500 dark:text-zinc-400'
556+
}`}
557+
>
558+
Preview
559+
</button>
560+
<span className="text-xs text-zinc-400">|</span>
561+
<button
562+
onClick={() => setPreviewMode(false)}
563+
className={`text-xs font-medium ${
564+
!previewMode
565+
? 'text-black dark:text-white'
566+
: 'text-zinc-500 dark:text-zinc-400'
567+
}`}
568+
>
569+
JSON
570+
</button>
571+
</div>
572+
</div>
573+
)}
542574
<Button
543575
variant="ghost"
544576
size="sm"
@@ -569,36 +601,6 @@ export function ToolsTab({ tools, callTool, isConnected }: ToolsTabProps) {
569601
<div className="space-y-4">
570602
{mcpUIResources.map((item: any, idx: number) => (
571603
<div key={idx} className="mx-4">
572-
<div className="mb-2 flex items-center gap-4">
573-
<span className="text-xs text-gray-500 dark:text-gray-400">
574-
URI:
575-
{' '}
576-
{item.resource.uri || 'No URI'}
577-
</span>
578-
<div className="flex items-center gap-2">
579-
<button
580-
onClick={() => setPreviewMode(true)}
581-
className={`text-xs font-medium ${
582-
previewMode
583-
? 'text-black dark:text-white'
584-
: 'text-zinc-500 dark:text-zinc-400'
585-
}`}
586-
>
587-
Preview
588-
</button>
589-
<span className="text-xs text-zinc-400">|</span>
590-
<button
591-
onClick={() => setPreviewMode(false)}
592-
className={`text-xs font-medium ${
593-
!previewMode
594-
? 'text-black dark:text-white'
595-
: 'text-zinc-500 dark:text-zinc-400'
596-
}`}
597-
>
598-
JSON
599-
</button>
600-
</div>
601-
</div>
602604
<div className="w-full">
603605
<McpUIRenderer
604606
resource={item.resource}

0 commit comments

Comments
 (0)