From 14b2e5bd0d4b0e0b20ec40c683cebaa418836754 Mon Sep 17 00:00:00 2001 From: yyh <92089059+lyzno1@users.noreply.github.com> Date: Wed, 14 Jan 2026 13:40:16 +0800 Subject: [PATCH] refactor(web): MCP tool availability to context-based version gating (#30955) --- .../config/agent/agent-tools/index.tsx | 1 - .../model-provider-page/model-modal/Form.tsx | 3 - .../multiple-tool-selector/index.spec.tsx | 33 ++++----- .../multiple-tool-selector/index.tsx | 8 +-- .../tool-selector/index.tsx | 4 -- .../tool-selector/tool-item.tsx | 10 ++- .../workflow/block-selector/all-tools.tsx | 4 -- .../block-selector/featured-tools.tsx | 3 - .../workflow/block-selector/tabs.tsx | 1 - .../workflow/block-selector/tool-picker.tsx | 3 - .../tool/tool-list-flat-view/list.tsx | 3 - .../tool/tool-list-tree-view/item.tsx | 3 - .../tool/tool-list-tree-view/list.tsx | 3 - .../workflow/block-selector/tool/tool.tsx | 6 +- .../workflow/block-selector/tools.tsx | 4 -- .../components/agent-strategy-selector.tsx | 4 +- .../nodes/_base/components/agent-strategy.tsx | 8 +-- .../components/mcp-tool-availability.tsx | 38 +++++++++++ .../components/workflow/nodes/agent/panel.tsx | 67 ++++++++++--------- .../workflow/nodes/agent/use-config.ts | 2 - 20 files changed, 100 insertions(+), 108 deletions(-) create mode 100644 web/app/components/workflow/nodes/_base/components/mcp-tool-availability.tsx diff --git a/web/app/components/app/configuration/config/agent/agent-tools/index.tsx b/web/app/components/app/configuration/config/agent/agent-tools/index.tsx index 02179822c9..7139ba66e0 100644 --- a/web/app/components/app/configuration/config/agent/agent-tools/index.tsx +++ b/web/app/components/app/configuration/config/agent/agent-tools/index.tsx @@ -183,7 +183,6 @@ const AgentTools: FC = () => { onSelect={handleSelectTool} onSelectMultiple={handleSelectMultipleTool} selectedTools={tools as unknown as ToolValue[]} - canChooseMCPTool /> )} diff --git a/web/app/components/header/account-setting/model-provider-page/model-modal/Form.tsx b/web/app/components/header/account-setting/model-provider-page/model-modal/Form.tsx index 5d0a1e5dd1..2927abe549 100644 --- a/web/app/components/header/account-setting/model-provider-page/model-modal/Form.tsx +++ b/web/app/components/header/account-setting/model-provider-page/model-modal/Form.tsx @@ -55,7 +55,6 @@ type FormProps< nodeId?: string nodeOutputVars?: NodeOutPutVar[] availableNodes?: Node[] - canChooseMCPTool?: boolean } function Form< @@ -81,7 +80,6 @@ function Form< nodeId, nodeOutputVars, availableNodes, - canChooseMCPTool, }: FormProps) { const language = useLanguage() const [changeKey, setChangeKey] = useState('') @@ -407,7 +405,6 @@ function Form< value={value[variable] || []} onChange={item => handleFormChange(variable, item as any)} supportCollapse - canChooseMCPTool={canChooseMCPTool} /> {fieldMoreInfo?.(formSchema)} {validating && changeKey === variable && } diff --git a/web/app/components/plugins/plugin-detail-panel/multiple-tool-selector/index.spec.tsx b/web/app/components/plugins/plugin-detail-panel/multiple-tool-selector/index.spec.tsx index 658c40c13c..288289b64d 100644 --- a/web/app/components/plugins/plugin-detail-panel/multiple-tool-selector/index.spec.tsx +++ b/web/app/components/plugins/plugin-detail-panel/multiple-tool-selector/index.spec.tsx @@ -7,6 +7,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest' // ==================== Imports (after mocks) ==================== +import { MCPToolAvailabilityProvider } from '@/app/components/workflow/nodes/_base/components/mcp-tool-availability' import MultipleToolSelector from './index' // ==================== Mock Setup ==================== @@ -190,10 +191,11 @@ type RenderOptions = { nodeOutputVars?: NodeOutPutVar[] availableNodes?: Node[] nodeId?: string - canChooseMCPTool?: boolean + versionSupported?: boolean } const renderComponent = (options: RenderOptions = {}) => { + const { versionSupported, ...overrides } = options const defaultProps = { disabled: false, value: [], @@ -206,16 +208,17 @@ const renderComponent = (options: RenderOptions = {}) => { nodeOutputVars: [createNodeOutputVar()], availableNodes: [createNode()], nodeId: 'test-node-id', - canChooseMCPTool: false, } - const props = { ...defaultProps, ...options } + const props = { ...defaultProps, ...overrides } const queryClient = createQueryClient() return { ...render( - + + + , ), props, @@ -410,7 +413,7 @@ describe('MultipleToolSelector', () => { expect(screen.getByText('2/3')).toBeInTheDocument() }) - it('should track enabled count with MCP tools when canChooseMCPTool is true', () => { + it('should track enabled count with MCP tools when version is supported', () => { // Arrange const mcpTools = [createMCPTool({ id: 'mcp-provider' })] mockMCPToolsData.mockReturnValue(mcpTools) @@ -421,13 +424,13 @@ describe('MultipleToolSelector', () => { ] // Act - renderComponent({ value: tools, canChooseMCPTool: true }) + renderComponent({ value: tools, versionSupported: true }) // Assert expect(screen.getByText('2/2')).toBeInTheDocument() }) - it('should not count MCP tools when canChooseMCPTool is false', () => { + it('should not count MCP tools when version is unsupported', () => { // Arrange const mcpTools = [createMCPTool({ id: 'mcp-provider' })] mockMCPToolsData.mockReturnValue(mcpTools) @@ -438,7 +441,7 @@ describe('MultipleToolSelector', () => { ] // Act - renderComponent({ value: tools, canChooseMCPTool: false }) + renderComponent({ value: tools, versionSupported: false }) // Assert expect(screen.getByText('1/2')).toBeInTheDocument() @@ -721,14 +724,6 @@ describe('MultipleToolSelector', () => { expect(screen.getByTestId('tool-selector-add')).toBeInTheDocument() }) - it('should pass canChooseMCPTool prop correctly', () => { - // Arrange & Act - renderComponent({ canChooseMCPTool: true }) - - // Assert - expect(screen.getByTestId('tool-selector-add')).toBeInTheDocument() - }) - it('should render with supportEnableSwitch for edit selectors', () => { // Arrange const tools = [createToolValue()] @@ -771,13 +766,13 @@ describe('MultipleToolSelector', () => { ] // Act - renderComponent({ value: tools, canChooseMCPTool: true }) + renderComponent({ value: tools, versionSupported: true }) // Assert expect(screen.getByText('2/2')).toBeInTheDocument() }) - it('should exclude MCP tools from enabled count when canChooseMCPTool is false', () => { + it('should exclude MCP tools from enabled count when strategy version is unsupported', () => { // Arrange const mcpTools = [createMCPTool({ id: 'mcp-provider' })] mockMCPToolsData.mockReturnValue(mcpTools) @@ -788,7 +783,7 @@ describe('MultipleToolSelector', () => { ] // Act - renderComponent({ value: tools, canChooseMCPTool: false }) + renderComponent({ value: tools, versionSupported: false }) // Assert - Only regular tool should be counted expect(screen.getByText('1/2')).toBeInTheDocument() diff --git a/web/app/components/plugins/plugin-detail-panel/multiple-tool-selector/index.tsx b/web/app/components/plugins/plugin-detail-panel/multiple-tool-selector/index.tsx index 4a7a6bdc6d..27efea8e08 100644 --- a/web/app/components/plugins/plugin-detail-panel/multiple-tool-selector/index.tsx +++ b/web/app/components/plugins/plugin-detail-panel/multiple-tool-selector/index.tsx @@ -12,6 +12,7 @@ import Divider from '@/app/components/base/divider' import { ArrowDownRoundFill } from '@/app/components/base/icons/src/vender/solid/general' import Tooltip from '@/app/components/base/tooltip' import ToolSelector from '@/app/components/plugins/plugin-detail-panel/tool-selector' +import { useMCPToolAvailability } from '@/app/components/workflow/nodes/_base/components/mcp-tool-availability' import { useAllMCPTools } from '@/service/use-tools' import { cn } from '@/utils/classnames' @@ -27,7 +28,6 @@ type Props = { nodeOutputVars: NodeOutPutVar[] availableNodes: Node[] nodeId?: string - canChooseMCPTool?: boolean } const MultipleToolSelector = ({ @@ -42,14 +42,14 @@ const MultipleToolSelector = ({ nodeOutputVars, availableNodes, nodeId, - canChooseMCPTool, }: Props) => { const { t } = useTranslation() + const { allowed: isMCPToolAllowed } = useMCPToolAvailability() const { data: mcpTools } = useAllMCPTools() const enabledCount = value.filter((item) => { const isMCPTool = mcpTools?.find(tool => tool.id === item.provider_name) if (isMCPTool) - return item.enabled && canChooseMCPTool + return item.enabled && isMCPToolAllowed return item.enabled }).length // collapse control @@ -167,7 +167,6 @@ const MultipleToolSelector = ({ onSelectMultiple={handleAddMultiple} onDelete={() => handleDelete(index)} supportEnableSwitch - canChooseMCPTool={canChooseMCPTool} isEdit /> @@ -190,7 +189,6 @@ const MultipleToolSelector = ({ panelShowState={panelShowState} onPanelShowStateChange={setPanelShowState} isEdit={false} - canChooseMCPTool={canChooseMCPTool} onSelectMultiple={handleAddMultiple} /> diff --git a/web/app/components/plugins/plugin-detail-panel/tool-selector/index.tsx b/web/app/components/plugins/plugin-detail-panel/tool-selector/index.tsx index 62c6fa3cd3..6c2c81a916 100644 --- a/web/app/components/plugins/plugin-detail-panel/tool-selector/index.tsx +++ b/web/app/components/plugins/plugin-detail-panel/tool-selector/index.tsx @@ -64,7 +64,6 @@ type Props = { nodeOutputVars: NodeOutPutVar[] availableNodes: Node[] nodeId?: string - canChooseMCPTool?: boolean } const ToolSelector: FC = ({ value, @@ -86,7 +85,6 @@ const ToolSelector: FC = ({ nodeOutputVars, availableNodes, nodeId = '', - canChooseMCPTool, }) => { const { t } = useTranslation() const [isShow, onShowChange] = useState(false) @@ -267,7 +265,6 @@ const ToolSelector: FC = ({

)} - canChooseMCPTool={canChooseMCPTool} /> )} @@ -300,7 +297,6 @@ const ToolSelector: FC = ({ onSelectMultiple={handleSelectMultipleTool} scope={scope} selectedTools={selectedTools} - canChooseMCPTool={canChooseMCPTool} />
diff --git a/web/app/components/plugins/plugin-detail-panel/tool-selector/tool-item.tsx b/web/app/components/plugins/plugin-detail-panel/tool-selector/tool-item.tsx index 896697c00d..995175c5ea 100644 --- a/web/app/components/plugins/plugin-detail-panel/tool-selector/tool-item.tsx +++ b/web/app/components/plugins/plugin-detail-panel/tool-selector/tool-item.tsx @@ -16,6 +16,7 @@ import Tooltip from '@/app/components/base/tooltip' import { ToolTipContent } from '@/app/components/base/tooltip/content' import Indicator from '@/app/components/header/indicator' import { InstallPluginButton } from '@/app/components/workflow/nodes/_base/components/install-plugin-button' +import { useMCPToolAvailability } from '@/app/components/workflow/nodes/_base/components/mcp-tool-availability' import McpToolNotSupportTooltip from '@/app/components/workflow/nodes/_base/components/mcp-tool-not-support-tooltip' import { SwitchPluginVersion } from '@/app/components/workflow/nodes/_base/components/switch-plugin-version' import { cn } from '@/utils/classnames' @@ -39,7 +40,6 @@ type Props = { versionMismatch?: boolean open: boolean authRemoved?: boolean - canChooseMCPTool?: boolean } const ToolItem = ({ @@ -61,13 +61,13 @@ const ToolItem = ({ errorTip, versionMismatch, authRemoved, - canChooseMCPTool, }: Props) => { const { t } = useTranslation() + const { allowed: isMCPToolAllowed } = useMCPToolAvailability() const providerNameText = isMCPTool ? providerShowName : providerName?.split('/').pop() const isTransparent = uninstalled || versionMismatch || isError const [isDeleting, setIsDeleting] = useState(false) - const isShowCanNotChooseMCPTip = isMCPTool && !canChooseMCPTool + const isShowCanNotChooseMCPTip = isMCPTool && !isMCPToolAllowed return (
)} - {isShowCanNotChooseMCPTip && ( - - )} + {isShowCanNotChooseMCPTip && } {!isError && !uninstalled && !versionMismatch && noAuth && (
))} diff --git a/web/app/components/workflow/block-selector/tool/tool-list-tree-view/item.tsx b/web/app/components/workflow/block-selector/tool/tool-list-tree-view/item.tsx index 308baa45e7..97049e5f79 100644 --- a/web/app/components/workflow/block-selector/tool/tool-list-tree-view/item.tsx +++ b/web/app/components/workflow/block-selector/tool/tool-list-tree-view/item.tsx @@ -14,7 +14,6 @@ type Props = { canNotSelectMultiple?: boolean onSelectMultiple?: (type: BlockEnum, tools: ToolDefaultValue[]) => void selectedTools?: ToolValue[] - canChooseMCPTool?: boolean } const Item: FC = ({ @@ -25,7 +24,6 @@ const Item: FC = ({ canNotSelectMultiple, onSelectMultiple, selectedTools, - canChooseMCPTool, }) => { return (
@@ -43,7 +41,6 @@ const Item: FC = ({ canNotSelectMultiple={canNotSelectMultiple} onSelectMultiple={onSelectMultiple} selectedTools={selectedTools} - canChooseMCPTool={canChooseMCPTool} /> ))}
diff --git a/web/app/components/workflow/block-selector/tool/tool-list-tree-view/list.tsx b/web/app/components/workflow/block-selector/tool/tool-list-tree-view/list.tsx index 38132f1caf..944cc28547 100644 --- a/web/app/components/workflow/block-selector/tool/tool-list-tree-view/list.tsx +++ b/web/app/components/workflow/block-selector/tool/tool-list-tree-view/list.tsx @@ -15,7 +15,6 @@ type Props = { canNotSelectMultiple?: boolean onSelectMultiple?: (type: BlockEnum, tools: ToolDefaultValue[]) => void selectedTools?: ToolValue[] - canChooseMCPTool?: boolean } const ToolListTreeView: FC = ({ @@ -25,7 +24,6 @@ const ToolListTreeView: FC = ({ canNotSelectMultiple, onSelectMultiple, selectedTools, - canChooseMCPTool, }) => { const { t } = useTranslation() const getI18nGroupName = useCallback((name: string) => { @@ -56,7 +54,6 @@ const ToolListTreeView: FC = ({ canNotSelectMultiple={canNotSelectMultiple} onSelectMultiple={onSelectMultiple} selectedTools={selectedTools} - canChooseMCPTool={canChooseMCPTool} /> ))} diff --git a/web/app/components/workflow/block-selector/tool/tool.tsx b/web/app/components/workflow/block-selector/tool/tool.tsx index dba346caa0..b20818fdaa 100644 --- a/web/app/components/workflow/block-selector/tool/tool.tsx +++ b/web/app/components/workflow/block-selector/tool/tool.tsx @@ -9,6 +9,7 @@ import * as React from 'react' import { useCallback, useEffect, useMemo, useRef } from 'react' import { useTranslation } from 'react-i18next' import { Mcp } from '@/app/components/base/icons/src/vender/other' +import { useMCPToolAvailability } from '@/app/components/workflow/nodes/_base/components/mcp-tool-availability' import { useGetLanguage } from '@/context/i18n' import useTheme from '@/hooks/use-theme' import { Theme } from '@/types/app' @@ -38,7 +39,6 @@ type Props = { canNotSelectMultiple?: boolean onSelectMultiple?: (type: BlockEnum, tools: ToolDefaultValue[]) => void selectedTools?: ToolValue[] - canChooseMCPTool?: boolean isShowLetterIndex?: boolean } @@ -51,9 +51,9 @@ const Tool: FC = ({ canNotSelectMultiple, onSelectMultiple, selectedTools, - canChooseMCPTool, }) => { const { t } = useTranslation() + const { allowed: isMCPToolAllowed } = useMCPToolAvailability() const language = useGetLanguage() const isFlatView = viewType === ViewType.flat const notShowProvider = payload.type === CollectionType.workflow @@ -63,7 +63,7 @@ const Tool: FC = ({ const ref = useRef(null) const isHovering = useHover(ref) const isMCPTool = payload.type === CollectionType.mcp - const isShowCanNotChooseMCPTip = !canChooseMCPTool && isMCPTool + const isShowCanNotChooseMCPTip = !isMCPToolAllowed && isMCPTool const { theme } = useTheme() const normalizedIcon = useMemo(() => { return normalizeProviderIcon(payload.icon) ?? payload.icon diff --git a/web/app/components/workflow/block-selector/tools.tsx b/web/app/components/workflow/block-selector/tools.tsx index 8035cc2dbf..9247f5aea9 100644 --- a/web/app/components/workflow/block-selector/tools.tsx +++ b/web/app/components/workflow/block-selector/tools.tsx @@ -21,7 +21,6 @@ type ToolsProps = { className?: string indexBarClassName?: string selectedTools?: ToolValue[] - canChooseMCPTool?: boolean } const Tools = ({ onSelect, @@ -35,7 +34,6 @@ const Tools = ({ className, indexBarClassName, selectedTools, - canChooseMCPTool, }: ToolsProps) => { // const tools: any = [] const language = useGetLanguage() @@ -109,7 +107,6 @@ const Tools = ({ canNotSelectMultiple={canNotSelectMultiple} onSelectMultiple={onSelectMultiple} selectedTools={selectedTools} - canChooseMCPTool={canChooseMCPTool} indexBar={} /> ) @@ -121,7 +118,6 @@ const Tools = ({ canNotSelectMultiple={canNotSelectMultiple} onSelectMultiple={onSelectMultiple} selectedTools={selectedTools} - canChooseMCPTool={canChooseMCPTool} /> ) )} diff --git a/web/app/components/workflow/nodes/_base/components/agent-strategy-selector.tsx b/web/app/components/workflow/nodes/_base/components/agent-strategy-selector.tsx index d49defad7a..4635a5575c 100644 --- a/web/app/components/workflow/nodes/_base/components/agent-strategy-selector.tsx +++ b/web/app/components/workflow/nodes/_base/components/agent-strategy-selector.tsx @@ -92,13 +92,12 @@ function formatStrategy(input: StrategyPluginDetail[], getIcon: (i: string) => s export type AgentStrategySelectorProps = { value?: Strategy onChange: (value?: Strategy) => void - canChooseMCPTool: boolean } export const AgentStrategySelector = memo((props: AgentStrategySelectorProps) => { const { enable_marketplace } = useGlobalPublicStore(s => s.systemFeatures) - const { value, onChange, canChooseMCPTool } = props + const { value, onChange } = props const [open, setOpen] = useState(false) const [viewType, setViewType] = useState(ViewType.flat) const [query, setQuery] = useState('') @@ -242,7 +241,6 @@ export const AgentStrategySelector = memo((props: AgentStrategySelectorProps) => indexBarClassName="top-0 xl:top-36" hasSearchText={false} canNotSelectMultiple - canChooseMCPTool={canChooseMCPTool} isAgent /> {enable_marketplace && ( diff --git a/web/app/components/workflow/nodes/_base/components/agent-strategy.tsx b/web/app/components/workflow/nodes/_base/components/agent-strategy.tsx index cc58176fb6..8303681d90 100644 --- a/web/app/components/workflow/nodes/_base/components/agent-strategy.tsx +++ b/web/app/components/workflow/nodes/_base/components/agent-strategy.tsx @@ -43,7 +43,6 @@ export type AgentStrategyProps = { nodeOutputVars?: NodeOutPutVar[] availableNodes?: Node[] nodeId?: string - canChooseMCPTool: boolean } type CustomSchema = Omit & { type: Type } & Field @@ -54,7 +53,7 @@ type MultipleToolSelectorSchema = CustomSchema<'array[tools]'> type CustomField = ToolSelectorSchema | MultipleToolSelectorSchema export const AgentStrategy = memo((props: AgentStrategyProps) => { - const { strategy, onStrategyChange, formSchema, formValue, onFormValueChange, nodeOutputVars, availableNodes, nodeId, canChooseMCPTool } = props + const { strategy, onStrategyChange, formSchema, formValue, onFormValueChange, nodeOutputVars, availableNodes, nodeId } = props const { t } = useTranslation() const docLink = useDocLink() const defaultModel = useDefaultModel(ModelTypeEnum.textGeneration) @@ -189,7 +188,6 @@ export const AgentStrategy = memo((props: AgentStrategyProps) => { value={value} onSelect={item => onChange(item)} onDelete={() => onChange(null)} - canChooseMCPTool={canChooseMCPTool} onSelectMultiple={noop} /> @@ -212,7 +210,6 @@ export const AgentStrategy = memo((props: AgentStrategyProps) => { onChange={onChange} supportCollapse required={schema.required} - canChooseMCPTool={canChooseMCPTool} /> ) } @@ -220,7 +217,7 @@ export const AgentStrategy = memo((props: AgentStrategyProps) => { } return (
- + { strategy ? ( @@ -241,7 +238,6 @@ export const AgentStrategy = memo((props: AgentStrategyProps) => { nodeId={nodeId} nodeOutputVars={nodeOutputVars || []} availableNodes={availableNodes || []} - canChooseMCPTool={canChooseMCPTool} />
) diff --git a/web/app/components/workflow/nodes/_base/components/mcp-tool-availability.tsx b/web/app/components/workflow/nodes/_base/components/mcp-tool-availability.tsx new file mode 100644 index 0000000000..d32899a945 --- /dev/null +++ b/web/app/components/workflow/nodes/_base/components/mcp-tool-availability.tsx @@ -0,0 +1,38 @@ +'use client' +import type { ReactNode } from 'react' +import { createContext, useContext } from 'react' + +type MCPToolAvailabilityContextValue = { + versionSupported?: boolean +} + +const MCPToolAvailabilityContext = createContext(undefined) + +export type MCPToolAvailability = { + allowed: boolean + versionSupported?: boolean +} + +export const MCPToolAvailabilityProvider = ({ + versionSupported, + children, +}: { + versionSupported?: boolean + children: ReactNode +}) => ( + + {children} + +) + +export const useMCPToolAvailability = (): MCPToolAvailability => { + const context = useContext(MCPToolAvailabilityContext) + if (context === undefined) + return { allowed: true } + + const { versionSupported } = context + return { + allowed: versionSupported === true, + versionSupported, + } +} diff --git a/web/app/components/workflow/nodes/agent/panel.tsx b/web/app/components/workflow/nodes/agent/panel.tsx index e37492d521..14232bc639 100644 --- a/web/app/components/workflow/nodes/agent/panel.tsx +++ b/web/app/components/workflow/nodes/agent/panel.tsx @@ -6,9 +6,11 @@ import type { StrategyParamItem } from '@/app/components/plugins/types' import { memo } from 'react' import { useTranslation } from 'react-i18next' import { toType } from '@/app/components/tools/utils/to-form-schema' +import { isSupportMCP } from '@/utils/plugin-version-feature' import { useStore } from '../../store' import { AgentStrategy } from '../_base/components/agent-strategy' import Field from '../_base/components/field' +import { MCPToolAvailabilityProvider } from '../_base/components/mcp-tool-availability' import MemoryConfig from '../_base/components/memory-config' import OutputVars, { VarItem } from '../_base/components/output-vars' import Split from '../_base/components/split' @@ -40,9 +42,9 @@ const AgentPanel: FC> = (props) => { readOnly, outputSchema, handleMemoryChange, - canChooseMCPTool, } = useConfig(props.id, props.data) const { t } = useTranslation() + const isMCPVersionSupported = isSupportMCP(inputs.meta?.version) const resetEditor = useStore(s => s.setControlPromptEditorRerenderKey) return ( @@ -53,37 +55,38 @@ const AgentPanel: FC> = (props) => { className="px-4 py-2" tooltip={t('nodes.agent.strategy.tooltip', { ns: 'workflow' })} > - { - setInputs({ - ...inputs, - agent_strategy_provider_name: strategy?.agent_strategy_provider_name, - agent_strategy_name: strategy?.agent_strategy_name, - agent_strategy_label: strategy?.agent_strategy_label, - output_schema: strategy!.agent_output_schema, - plugin_unique_identifier: strategy!.plugin_unique_identifier, - meta: strategy?.meta, - }) - resetEditor(Date.now()) - }} - formSchema={currentStrategy?.parameters?.map(strategyParamToCredientialForm) || []} - formValue={formData} - onFormValueChange={onFormChange} - nodeOutputVars={availableVars} - availableNodes={availableNodesWithParent} - nodeId={props.id} - canChooseMCPTool={canChooseMCPTool} - /> + + { + setInputs({ + ...inputs, + agent_strategy_provider_name: strategy?.agent_strategy_provider_name, + agent_strategy_name: strategy?.agent_strategy_name, + agent_strategy_label: strategy?.agent_strategy_label, + output_schema: strategy!.agent_output_schema, + plugin_unique_identifier: strategy!.plugin_unique_identifier, + meta: strategy?.meta, + }) + resetEditor(Date.now()) + }} + formSchema={currentStrategy?.parameters?.map(strategyParamToCredientialForm) || []} + formValue={formData} + onFormValueChange={onFormChange} + nodeOutputVars={availableVars} + availableNodes={availableNodesWithParent} + nodeId={props.id} + /> +
{isChatMode && currentStrategy?.features?.includes(AgentFeature.HISTORY_MESSAGES) && ( diff --git a/web/app/components/workflow/nodes/agent/use-config.ts b/web/app/components/workflow/nodes/agent/use-config.ts index 49af451f4c..ce8765d833 100644 --- a/web/app/components/workflow/nodes/agent/use-config.ts +++ b/web/app/components/workflow/nodes/agent/use-config.ts @@ -11,7 +11,6 @@ import { } from '@/app/components/workflow/hooks' import { useCheckInstalled, useFetchPluginsInMarketPlaceByIds } from '@/service/use-plugins' import { useStrategyProviderDetail } from '@/service/use-strategy' -import { isSupportMCP } from '@/utils/plugin-version-feature' import { VarType as VarKindType } from '../../types' import useAvailableVarList from '../_base/hooks/use-available-var-list' import useNodeCrud from '../_base/hooks/use-node-crud' @@ -222,7 +221,6 @@ const useConfig = (id: string, payload: AgentNodeType) => { outputSchema, handleMemoryChange, isChatMode, - canChooseMCPTool: isSupportMCP(inputs.meta?.version), } }