File size: 2,169 Bytes
90ad830
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<script lang="ts">
	import {
		Database,
		ExternalLink,
		FileText,
		ListChecks,
		MessageSquare,
		Sparkles,
		Wrench
	} from '@lucide/svelte';
	import { Badge } from '$lib/components/ui/badge';
	import type { MCPCapabilitiesInfo } from '$lib/types';

	interface Props {
		capabilities?: MCPCapabilitiesInfo;
		onBrowseResources?: () => void;
	}

	let { capabilities, onBrowseResources }: Props = $props();
</script>

{#if capabilities}
	{#if capabilities.server.tools}
		<Badge class="h-5 gap-1 bg-green-50 px-1.5 text-[10px] dark:bg-green-950" variant="outline">
			<Wrench class="h-3 w-3 text-green-600 dark:text-green-400" />

			Tools
		</Badge>
	{/if}

	{#if capabilities.server.resources}
		<Badge
			class="h-5 cursor-pointer gap-1 bg-blue-50 px-1.5 text-[10px] transition-colors hover:bg-blue-100 dark:bg-blue-950 dark:hover:bg-blue-900"
			onclick={onBrowseResources}
			onkeydown={(e) => {
				if (e.key === 'Enter' || e.key === ' ') {
					e.preventDefault();
					onBrowseResources?.();
				}
			}}
			role="button"
			tabindex={0}
			variant="outline"
		>
			<Database class="h-3 w-3 text-blue-600 dark:text-blue-400" />

			Resources

			<ExternalLink class="h-3 w-3 text-blue-600 dark:text-blue-400" />
		</Badge>
	{/if}

	{#if capabilities.server.prompts}
		<Badge class="h-5 gap-1 bg-purple-50 px-1.5 text-[10px] dark:bg-purple-950" variant="outline">
			<MessageSquare class="h-3 w-3 text-purple-600 dark:text-purple-400" />

			Prompts
		</Badge>
	{/if}

	{#if capabilities.server.logging}
		<Badge class="h-5 gap-1 bg-orange-50 px-1.5 text-[10px] dark:bg-orange-950" variant="outline">
			<FileText class="h-3 w-3 text-orange-600 dark:text-orange-400" />

			Logging
		</Badge>
	{/if}

	{#if capabilities.server.completions}
		<Badge class="h-5 gap-1 bg-cyan-50 px-1.5 text-[10px] dark:bg-cyan-950" variant="outline">
			<Sparkles class="h-3 w-3 text-cyan-600 dark:text-cyan-400" />

			Completions
		</Badge>
	{/if}

	{#if capabilities.server.tasks}
		<Badge class="h-5 gap-1 bg-pink-50 px-1.5 text-[10px] dark:bg-pink-950" variant="outline">
			<ListChecks class="h-3 w-3 text-pink-600 dark:text-pink-400" />

			Tasks
		</Badge>
	{/if}
{/if}