chore: in tool picker can not choose mcp

This commit is contained in:
Joel 2025-05-27 15:21:59 +08:00
parent 8d2238d631
commit d1983e4d06
3 changed files with 13 additions and 7 deletions

View File

@ -35,6 +35,7 @@ type AllToolsProps = {
canNotSelectMultiple?: boolean
onSelectMultiple?: (type: BlockEnum, tools: ToolDefaultValue[]) => void
selectedTools?: ToolValue[]
isHideMCPTools?: boolean
}
const DEFAULT_TAGS: AllToolsProps['tags'] = []
@ -52,9 +53,10 @@ const AllTools = ({
customTools,
mcpTools = [],
selectedTools,
isHideMCPTools,
}: AllToolsProps) => {
const language = useGetLanguage()
const tabs = useToolTabs()
const tabs = useToolTabs(isHideMCPTools)
const [activeTab, setActiveTab] = useState(ToolTypeEnum.All)
const [activeView, setActiveView] = useState<ViewType>(ViewType.flat)
const hasFilter = searchText || tags.length > 0

View File

@ -31,10 +31,9 @@ export const useTabs = () => {
]
}
export const useToolTabs = () => {
export const useToolTabs = (isHideMCPTools?: boolean) => {
const { t } = useTranslation()
return [
const tabs = [
{
key: ToolTypeEnum.All,
name: t('workflow.tabs.allTool'),
@ -51,9 +50,13 @@ export const useToolTabs = () => {
key: ToolTypeEnum.Workflow,
name: t('workflow.tabs.workflowTool'),
},
{
]
if(!isHideMCPTools) {
tabs.push({
key: ToolTypeEnum.MCP,
name: 'MCP',
},
]
})
}
return tabs
}

View File

@ -83,6 +83,7 @@ const Tabs: FC<TabsProps> = ({
customTools={customTools || []}
workflowTools={workflowTools || []}
mcpTools={mcpTools || []}
isHideMCPTools
/>
)
}