Skip to content

Commit 444c6b5

Browse files
committed
Fix lint
1 parent 5dd6615 commit 444c6b5

File tree

1 file changed

+36
-30
lines changed

1 file changed

+36
-30
lines changed

client/src/components/ToolsTab.tsx

Lines changed: 36 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ import ListPane from "./ListPane";
1919
import JsonView from "./JsonView";
2020
import ToolResults from "./ToolResults";
2121

22+
// Type guard to safely detect the optional _meta field without using `any`
23+
const hasMeta = (tool: Tool): tool is Tool & { _meta: unknown } =>
24+
typeof (tool as { _meta?: unknown })._meta !== "undefined";
25+
2226
const ToolsTab = ({
2327
tools,
2428
listTools,
@@ -246,38 +250,40 @@ const ToolsTab = ({
246250
</div>
247251
</div>
248252
)}
249-
{selectedTool && (selectedTool as any)._meta && (
250-
<div className="bg-gray-50 dark:bg-gray-900 p-3 rounded-lg">
251-
<div className="flex items-center justify-between mb-2">
252-
<h4 className="text-sm font-semibold">Meta:</h4>
253-
<Button
254-
size="sm"
255-
variant="ghost"
256-
onClick={() => setIsMetaExpanded(!isMetaExpanded)}
257-
className="h-6 px-2"
253+
{selectedTool &&
254+
hasMeta(selectedTool) &&
255+
selectedTool._meta && (
256+
<div className="bg-gray-50 dark:bg-gray-900 p-3 rounded-lg">
257+
<div className="flex items-center justify-between mb-2">
258+
<h4 className="text-sm font-semibold">Meta:</h4>
259+
<Button
260+
size="sm"
261+
variant="ghost"
262+
onClick={() => setIsMetaExpanded(!isMetaExpanded)}
263+
className="h-6 px-2"
264+
>
265+
{isMetaExpanded ? (
266+
<>
267+
<ChevronUp className="h-3 w-3 mr-1" />
268+
Collapse
269+
</>
270+
) : (
271+
<>
272+
<ChevronDown className="h-3 w-3 mr-1" />
273+
Expand
274+
</>
275+
)}
276+
</Button>
277+
</div>
278+
<div
279+
className={`transition-all ${
280+
isMetaExpanded ? "" : "max-h-[8rem] overflow-y-auto"
281+
}`}
258282
>
259-
{isMetaExpanded ? (
260-
<>
261-
<ChevronUp className="h-3 w-3 mr-1" />
262-
Collapse
263-
</>
264-
) : (
265-
<>
266-
<ChevronDown className="h-3 w-3 mr-1" />
267-
Expand
268-
</>
269-
)}
270-
</Button>
271-
</div>
272-
<div
273-
className={`transition-all ${
274-
isMetaExpanded ? "" : "max-h-[8rem] overflow-y-auto"
275-
}`}
276-
>
277-
<JsonView data={(selectedTool as any)._meta} />
283+
<JsonView data={selectedTool._meta} />
284+
</div>
278285
</div>
279-
</div>
280-
)}
286+
)}
281287
<Button
282288
onClick={async () => {
283289
try {

0 commit comments

Comments
 (0)