diff --git a/tools/ui/src/lib/components/app/chat/ChatForm/ChatForm.svelte b/tools/ui/src/lib/components/app/chat/ChatForm/ChatForm.svelte index 8572f7ccb3..893f8077dd 100644 --- a/tools/ui/src/lib/components/app/chat/ChatForm/ChatForm.svelte +++ b/tools/ui/src/lib/components/app/chat/ChatForm/ChatForm.svelte @@ -628,7 +628,6 @@ isReasoning={chatStore.isReasoning} {isRecording} onFileUpload={handleFileUpload} - onMcpResourcesClick={() => (isResourceDialogOpen = true)} onMcpSettingsClick={() => (isMcpServersDialogOpen = true)} onMicClick={handleMicClick} {onStop} diff --git a/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionAdd/ChatFormActionAddDropdown.svelte b/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionAdd/ChatFormActionAddDropdown.svelte index 8e00deee05..61f816affa 100644 --- a/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionAdd/ChatFormActionAddDropdown.svelte +++ b/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionAdd/ChatFormActionAddDropdown.svelte @@ -30,13 +30,11 @@ const attachmentMenu = useAttachmentMenu( () => ({ hasAudioModality: chatFormActions.hasAudioModality, - hasMcpResourcesSupport: chatFormActions.hasMcpResourcesSupport, hasVideoModality: chatFormActions.hasVideoModality, hasVisionModality: chatFormActions.hasVisionModality }), () => ({ onFileUpload: chatFormActions.onFileUpload, - onMcpResourcesClick: chatFormActions.onMcpResourcesClick, onSystemPromptClick: chatFormActions.onSystemPromptClick }), () => { diff --git a/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionAdd/ChatFormActionAddSheet.svelte b/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionAdd/ChatFormActionAddSheet.svelte index 3b665143d7..acd0f4d211 100644 --- a/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionAdd/ChatFormActionAddSheet.svelte +++ b/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionAdd/ChatFormActionAddSheet.svelte @@ -44,13 +44,11 @@ const attachmentMenu = useAttachmentMenu( () => ({ hasAudioModality: chatFormActions.hasAudioModality, - hasMcpResourcesSupport: chatFormActions.hasMcpResourcesSupport, hasVideoModality: chatFormActions.hasVideoModality, hasVisionModality: chatFormActions.hasVisionModality }), () => ({ onFileUpload: chatFormActions.onFileUpload, - onMcpResourcesClick: chatFormActions.onMcpResourcesClick, onSystemPromptClick: chatFormActions.onSystemPromptClick }), () => { diff --git a/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActions.svelte b/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActions.svelte index 5ab973c9a4..395f2cfbe1 100644 --- a/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActions.svelte +++ b/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActions.svelte @@ -11,9 +11,9 @@ import { Button } from '$lib/components/ui/button'; import { ICON_CLASS_DEFAULT } from '$lib/constants'; import { setChatFormActionsContext } from '$lib/contexts'; - import { FileTypeCategory, MessageRole, ToolSource } from '$lib/enums'; + import { FileTypeCategory, MessageRole } from '$lib/enums'; import { ChatService } from '$lib/services'; - import { chatStore, conversationsStore, mcpStore, settingsStore } from '$lib/stores'; + import { chatStore, conversationsStore, settingsStore } from '$lib/stores'; import { getFileTypeCategory } from '$lib/utils'; interface Props { @@ -31,7 +31,6 @@ onMicClick?: () => void; onStop?: () => void; onSystemPromptClick?: () => void; - onMcpResourcesClick?: () => void; onMcpSettingsClick?: () => void; } @@ -44,7 +43,6 @@ isReasoning = false, isRecording = false, onFileUpload, - onMcpResourcesClick, onMcpSettingsClick, onMicClick, onStop, @@ -56,23 +54,6 @@ let currentConfig = $derived(settingsStore.config); - // usable MCP servers for this conversation: globally enabled and not - // disabled by the effective tool policy (category or server-scoped key) - let policyEnabledMcpServerIds = $derived.by(() => { - const prefs = conversationsStore.preferences; - - if (!prefs.isCategoryEnabled(ToolSource.MCP)) return new Set(); - - return new Set( - mcpStore - .getServers() - .filter((s) => s.enabled && prefs.isServerToolsEnabled(s.id)) - .map((s) => s.id) - ); - }); - - let hasMcpResourcesSupport = $derived(mcpStore.hasResourcesCapability(policyEnabledMcpServerIds)); - let hasAudioModality = $state(false); let hasVideoModality = $state(false); let hasVisionModality = $state(false); @@ -145,9 +126,6 @@ get hasAudioModality() { return hasAudioModality; }, - get hasMcpResourcesSupport() { - return hasMcpResourcesSupport; - }, get hasVideoModality() { return hasVideoModality; }, @@ -157,9 +135,6 @@ get onFileUpload() { return onFileUpload; }, - get onMcpResourcesClick() { - return onMcpResourcesClick; - }, get onMcpSettingsClick() { return onMcpSettingsClick; }, diff --git a/tools/ui/src/lib/enums/attachment.enums.ts b/tools/ui/src/lib/enums/attachment.enums.ts index 3b7443eed3..5f096b9744 100644 --- a/tools/ui/src/lib/enums/attachment.enums.ts +++ b/tools/ui/src/lib/enums/attachment.enums.ts @@ -19,7 +19,6 @@ export enum AttachmentType { export enum AttachmentMenuItemId { AUDIO = 'audio', IMAGES = 'images', - MCP_RESOURCES = 'mcp-resources', PDF = 'pdf', SYSTEM_MESSAGE = 'system-message', TEXT = 'text', @@ -41,7 +40,6 @@ export enum AttachmentItemEnabledWhen { */ export enum AttachmentAction { FILE_UPLOAD = 'onFileUpload', - MCP_RESOURCES_CLICK = 'onMcpResourcesClick', SYSTEM_PROMPT_CLICK = 'onSystemPromptClick' } @@ -54,10 +52,3 @@ export enum AttachmentLabel { MCP_RESOURCE = 'MCP Resource', PDF_FILE = 'PDF File' } - -/** - * Visibility conditions for attachment menu items. - */ -export enum AttachmentItemVisibleWhen { - HAS_MCP_RESOURCES_SUPPORT = 'hasMcpResourcesSupport' -} diff --git a/tools/ui/src/lib/enums/index.ts b/tools/ui/src/lib/enums/index.ts index 89105c6b08..efe5789e20 100644 --- a/tools/ui/src/lib/enums/index.ts +++ b/tools/ui/src/lib/enums/index.ts @@ -3,8 +3,7 @@ export { AttachmentType, AttachmentMenuItemId, AttachmentItemEnabledWhen, - AttachmentAction, - AttachmentItemVisibleWhen + AttachmentAction } from './attachment.enums'; export { diff --git a/tools/ui/src/lib/hooks/use-attachment-menu.svelte.ts b/tools/ui/src/lib/hooks/use-attachment-menu.svelte.ts index 3940d7dbb0..c738c266a6 100644 --- a/tools/ui/src/lib/hooks/use-attachment-menu.svelte.ts +++ b/tools/ui/src/lib/hooks/use-attachment-menu.svelte.ts @@ -5,19 +5,16 @@ export interface AttachmentModalityFlags { hasVisionModality: boolean; hasAudioModality: boolean; hasVideoModality: boolean; - hasMcpResourcesSupport: boolean; } export interface AttachmentActionCallbacks { onFileUpload?: () => void; onSystemPromptClick?: () => void; - onMcpResourcesClick?: () => void; } export interface UseAttachmentMenuReturn { readonly callbacks: Record void>; isItemEnabled(enabledWhen: string | undefined): boolean; - isItemVisible(visibleWhen: string | undefined): boolean; getSystemMessageTooltip(): string; } @@ -47,7 +44,6 @@ export function useAttachmentMenu( return { [AttachmentAction.FILE_UPLOAD]: wrap(cbs.onFileUpload), - [AttachmentAction.MCP_RESOURCES_CLICK]: wrap(cbs.onMcpResourcesClick), [AttachmentAction.SYSTEM_PROMPT_CLICK]: wrap(cbs.onSystemPromptClick) }; }); @@ -58,12 +54,6 @@ export function useAttachmentMenu( return !!modalityFlags[enabledWhen as keyof AttachmentModalityFlags]; } - function isItemVisible(visibleWhen: string | undefined): boolean { - if (!visibleWhen) return true; - - return !!modalityFlags[visibleWhen as keyof AttachmentModalityFlags]; - } - function getSystemMessageTooltip(): string { return !page.params.id ? 'Add custom system message for a new conversation' @@ -75,7 +65,6 @@ export function useAttachmentMenu( return callbacks; }, getSystemMessageTooltip, - isItemEnabled, - isItemVisible + isItemEnabled }; } diff --git a/tools/ui/src/lib/stores/mcp/index.svelte.ts b/tools/ui/src/lib/stores/mcp/index.svelte.ts index 0da5e871fe..768e2c1aa0 100644 --- a/tools/ui/src/lib/stores/mcp/index.svelte.ts +++ b/tools/ui/src/lib/stores/mcp/index.svelte.ts @@ -811,40 +811,6 @@ class MCPStore implements McpHealthHost { return Boolean(this.buildMcpClientConfig(settingsStore.config)); } - /** - * Check if any enabled server with successful health check supports resources. - * Uses health check state since servers may not have active connections until - * the user actually sends a message or uses prompts. - */ - hasResourcesCapability(enabledServerIds?: ReadonlySet): boolean { - const ids = enabledServerIds ?? this.globalEnabledServerIds(); - - if (ids.size === 0) { - return false; - } - - for (const [serverId, state] of Object.entries(this.health.checks)) { - if (!ids.has(serverId)) continue; - - if ( - state.status === HealthCheckStatus.SUCCESS && - state.capabilities?.server?.resources !== undefined - ) { - return true; - } - } - - for (const [serverName, connection] of this.connections) { - if (!ids.has(serverName)) continue; - - if (MCPService.supportsResources(connection)) { - return true; - } - } - - return false; - } - /** * Check if any connected server has instructions. */ diff --git a/tools/ui/src/lib/types/chat.d.ts b/tools/ui/src/lib/types/chat.d.ts index e41a1df0c4..274131dd43 100644 --- a/tools/ui/src/lib/types/chat.d.ts +++ b/tools/ui/src/lib/types/chat.d.ts @@ -3,7 +3,6 @@ import type { DatabaseMessage, DatabaseMessageExtra } from './database'; import type { AttachmentAction, AttachmentItemEnabledWhen, - AttachmentItemVisibleWhen, AttachmentMenuItemId, ChatFormCommandAction, ErrorDialogType, @@ -30,8 +29,6 @@ export interface AttachmentMenuItem { disabledTooltip?: string; /** Callback key on the Props interface to invoke when clicked */ action: AttachmentAction; - /** Whether the item is only shown when a specific capability is present */ - visibleWhen?: AttachmentItemVisibleWhen; /** Whether this item has a tooltip even when enabled (uses dynamic text) */ hasEnabledTooltip?: boolean; } @@ -336,9 +333,7 @@ export interface ChatFormActionsContext { readonly hasAudioModality: boolean; readonly hasVideoModality: boolean; readonly hasVisionModality: boolean; - readonly hasMcpResourcesSupport: boolean; onFileUpload?: () => void; onSystemPromptClick?: () => void; - onMcpResourcesClick?: () => void; onMcpSettingsClick?: () => void; }