Skip to content

Commit a114db8

Browse files
committed
mcp: update resources + icon alignment
1 parent 35286a2 commit a114db8

File tree

3 files changed

+65
-32
lines changed

3 files changed

+65
-32
lines changed

client/src/components/PromptsTab.tsx

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ import {
99
PromptReference,
1010
ResourceReference,
1111
} from "@modelcontextprotocol/sdk/types.js";
12-
import { AlertCircle } from "lucide-react";
12+
import { AlertCircle, ChevronRight } from "lucide-react";
1313
import { useEffect, useState } from "react";
1414
import ListPane from "./ListPane";
1515
import { useCompletionState } from "@/lib/hooks/useCompletionState";
1616
import JsonView from "./JsonView";
17-
import IconDisplay from "./IconDisplay";
17+
import IconDisplay, { WithIcons } from "./IconDisplay";
1818

1919
export type Prompt = {
2020
name: string;
@@ -110,12 +110,17 @@ const PromptsTab = ({
110110
setPromptArgs({});
111111
}}
112112
renderItem={(prompt) => (
113-
<div className="flex flex-col items-start">
114-
<IconDisplay icons={prompt.icons} size="sm" />
115-
<span className="flex-1">{prompt.name}</span>
116-
<span className="text-sm text-gray-500 text-left">
117-
{prompt.description}
118-
</span>
113+
<div className="flex items-start w-full gap-2">
114+
<div className="flex-shrink-0 mt-1">
115+
<IconDisplay icons={prompt.icons} size="sm" />
116+
</div>
117+
<div className="flex flex-col flex-1 min-w-0">
118+
<span className="truncate">{prompt.name}</span>
119+
<span className="text-sm text-gray-500 text-left line-clamp-2">
120+
{prompt.description}
121+
</span>
122+
</div>
123+
<ChevronRight className="w-4 h-4 flex-shrink-0 text-gray-400 mt-1" />
119124
</div>
120125
)}
121126
title="Prompts"
@@ -125,9 +130,17 @@ const PromptsTab = ({
125130

126131
<div className="bg-card border border-border rounded-lg shadow">
127132
<div className="p-4 border-b border-gray-200 dark:border-border">
128-
<h3 className="font-semibold">
129-
{selectedPrompt ? selectedPrompt.name : "Select a prompt"}
130-
</h3>
133+
<div className="flex items-center gap-2">
134+
{selectedPrompt && (
135+
<IconDisplay
136+
icons={(selectedPrompt as WithIcons).icons}
137+
size="md"
138+
/>
139+
)}
140+
<h3 className="font-semibold">
141+
{selectedPrompt ? selectedPrompt.name : "Select a prompt"}
142+
</h3>
143+
</div>
131144
</div>
132145
<div className="p-4">
133146
{error ? (

client/src/components/ResourcesTab.tsx

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { useEffect, useState } from "react";
1717
import { useCompletionState } from "@/lib/hooks/useCompletionState";
1818
import JsonView from "./JsonView";
1919
import { UriTemplate } from "@modelcontextprotocol/sdk/shared/uriTemplate.js";
20+
import IconDisplay, { WithIcons } from "./IconDisplay";
2021

2122
const ResourcesTab = ({
2223
resources,
@@ -129,7 +130,10 @@ const ResourcesTab = ({
129130
}}
130131
renderItem={(resource) => (
131132
<div className="flex items-center w-full">
132-
<FileText className="w-4 h-4 mr-2 flex-shrink-0 text-gray-500" />
133+
<IconDisplay icons={(resource as WithIcons).icons} size="sm" />
134+
{!(resource as WithIcons).icons && (
135+
<FileText className="w-4 h-4 mr-2 flex-shrink-0 text-gray-500" />
136+
)}
133137
<span className="flex-1 truncate" title={resource.uri.toString()}>
134138
{resource.name}
135139
</span>
@@ -159,7 +163,10 @@ const ResourcesTab = ({
159163
}}
160164
renderItem={(template) => (
161165
<div className="flex items-center w-full">
162-
<FileText className="w-4 h-4 mr-2 flex-shrink-0 text-gray-500" />
166+
<IconDisplay icons={(template as WithIcons).icons} size="sm" />
167+
{!(template as WithIcons).icons && (
168+
<FileText className="w-4 h-4 mr-2 flex-shrink-0 text-gray-500" />
169+
)}
163170
<span className="flex-1 truncate" title={template.uriTemplate}>
164171
{template.name}
165172
</span>
@@ -175,16 +182,26 @@ const ResourcesTab = ({
175182

176183
<div className="bg-card border border-border rounded-lg shadow">
177184
<div className="p-4 border-b border-gray-200 dark:border-border flex justify-between items-center">
178-
<h3
179-
className="font-semibold truncate"
180-
title={selectedResource?.name || selectedTemplate?.name}
181-
>
182-
{selectedResource
183-
? selectedResource.name
184-
: selectedTemplate
185-
? selectedTemplate.name
186-
: "Select a resource or template"}
187-
</h3>
185+
<div className="flex items-center gap-2 truncate">
186+
{(selectedResource || selectedTemplate) && (
187+
<IconDisplay
188+
icons={
189+
((selectedResource || selectedTemplate) as WithIcons).icons
190+
}
191+
size="md"
192+
/>
193+
)}
194+
<h3
195+
className="font-semibold truncate"
196+
title={selectedResource?.name || selectedTemplate?.name}
197+
>
198+
{selectedResource
199+
? selectedResource.name
200+
: selectedTemplate
201+
? selectedTemplate.name
202+
: "Select a resource or template"}
203+
</h3>
204+
</div>
188205
{selectedResource && (
189206
<div className="flex row-auto gap-1 justify-end w-2/5">
190207
{resourceSubscriptionsSupported &&

client/src/components/ToolsTab.tsx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import {
3030
Send,
3131
ChevronDown,
3232
ChevronUp,
33+
ChevronRight,
3334
AlertCircle,
3435
Copy,
3536
CheckCheck,
@@ -159,12 +160,17 @@ const ToolsTab = ({
159160
}}
160161
setSelectedItem={setSelectedTool}
161162
renderItem={(tool) => (
162-
<div className="flex flex-col items-start">
163-
<IconDisplay icons={(tool as WithIcons).icons} size="sm" />
164-
<span className="flex-1">{tool.name}</span>
165-
<span className="text-sm text-gray-500 text-left line-clamp-3">
166-
{tool.description}
167-
</span>
163+
<div className="flex items-start w-full gap-2">
164+
<div className="flex-shrink-0 mt-1">
165+
<IconDisplay icons={(tool as WithIcons).icons} size="sm" />
166+
</div>
167+
<div className="flex flex-col flex-1 min-w-0">
168+
<span className="truncate">{tool.name}</span>
169+
<span className="text-sm text-gray-500 text-left line-clamp-2">
170+
{tool.description}
171+
</span>
172+
</div>
173+
<ChevronRight className="w-4 h-4 flex-shrink-0 text-gray-400 mt-1" />
168174
</div>
169175
)}
170176
title="Tools"
@@ -174,9 +180,6 @@ const ToolsTab = ({
174180

175181
<div className="bg-card border border-border rounded-lg shadow">
176182
<div className="p-4 border-b border-gray-200 dark:border-border">
177-
<h3 className="font-semibold">
178-
{selectedTool ? selectedTool.name : "Select a tool"}
179-
</h3>
180183
<div className="flex items-center gap-2">
181184
{selectedTool && (
182185
<IconDisplay

0 commit comments

Comments
 (0)