114114 />
115115 </el-form-item >
116116
117+ <!-- MCP-->
117118 <div class =" flex-between mb-16" >
118119 <div class =" lighter" >MCP</div >
119120 <div >
129130 <el-switch size =" small" v-model =" chat_data.mcp_enable" />
130131 </div >
131132 </div >
133+ <div class =" w-full" v-if ="
134+ (chat_data.mcp_tool_id) ||
135+ (chat_data.mcp_servers && chat_data.mcp_servers.length > 0)"
136+ >
137+ <div class =" flex-between border border-r-6 white-bg mb-4" style =" padding : 5px 8px " >
138+ <div class =" flex align-center" style =" line-height : 20px " >
139+ <ToolIcon type =" MCP" class =" mr-8" :size =" 20" />
140+
141+ <div class =" ellipsis" :title =" relatedObject(toolSelectOptions, chat_data.mcp_tool_id, 'id')?.name" >
142+ {{ relatedObject(mcpToolSelectOptions, chat_data.mcp_tool_id, 'id')?.name || $t('common.custom') + ' MCP' }}
143+ </div >
144+ </div >
145+ <el-button text @click =" chat_data.mcp_tool_id = ''" >
146+ <el-icon ><Close /></el-icon >
147+ </el-button >
148+ </div >
149+ </div >
150+ <!-- 工具 -->
132151 <div class =" flex-between mb-16" >
133152 <div class =" lighter" >{{ $t('views.applicationWorkflow.nodes.mcpNode.tool') }}</div >
134153 <div >
144163 <el-switch size =" small" v-model =" chat_data.tool_enable" />
145164 </div >
146165 </div >
166+ <div class =" w-full" v-if =" chat_data.tool_ids?.length > 0" >
167+ <template v-for =" (item , index ) in chat_data .tool_ids " :key =" index " >
168+ <div class =" flex-between border border-r-6 white-bg mb-4" style =" padding : 5px 8px " >
169+ <div class =" flex align-center" style =" line-height : 20px " >
170+ <ToolIcon type =" CUSTOM" class =" mr-8" :size =" 20" />
171+
172+ <div class =" ellipsis" :title =" relatedObject(toolSelectOptions, item, 'id')?.name" >
173+ {{ relatedObject(toolSelectOptions, item, 'id')?.name }}
174+ </div >
175+ </div >
176+ <el-button text @click =" removeTool(item)" >
177+ <el-icon ><Close /></el-icon >
178+ </el-button >
179+ </div >
180+ </template >
181+ </div >
147182
148183 <el-form-item @click.prevent >
149184 <template #label >
@@ -206,6 +241,7 @@ import McpServersDialog from '@/views/application/component/McpServersDialog.vue
206241import { loadSharedApi } from ' @/utils/dynamics-api/shared-api'
207242import { useRoute } from ' vue-router'
208243import ToolDialog from ' @/views/application/component/ToolDialog.vue'
244+ import {relatedObject } from " @/utils/array.ts" ;
209245const getApplicationDetail = inject (' getApplicationDetail' ) as any
210246const route = useRoute ()
211247
@@ -352,7 +388,7 @@ function openMcpServersDialog() {
352388 mcp_tool_id: chat_data .value .mcp_tool_id ,
353389 mcp_source: chat_data .value .mcp_source ,
354390 }
355- mcpServersDialogRef .value .open (config )
391+ mcpServersDialogRef .value .open (config , mcpToolSelectOptions . value )
356392}
357393
358394function submitMcpServersDialog(config : any ) {
@@ -368,6 +404,10 @@ function openToolDialog() {
368404function submitToolDialog(config : any ) {
369405 set (props .nodeModel .properties .node_data , ' tool_ids' , config .tool_ids )
370406}
407+ function removeTool(id : any ) {
408+ const list = props .nodeModel .properties .node_data .tool_ids .filter ((v : any ) => v !== id )
409+ set (props .nodeModel .properties .node_data , ' tool_ids' , list )
410+ }
371411
372412const toolSelectOptions = ref <any []>([])
373413function getToolSelectOptions() {
@@ -392,6 +432,29 @@ function getToolSelectOptions() {
392432 })
393433}
394434
435+ const mcpToolSelectOptions = ref <any []>([])
436+ function getMcpToolSelectOptions() {
437+ const obj =
438+ apiType .value === ' systemManage'
439+ ? {
440+ scope: ' WORKSPACE' ,
441+ tool_type: ' MCP' ,
442+ workspace_id: application .value ?.workspace_id ,
443+ }
444+ : {
445+ scope: ' WORKSPACE' ,
446+ tool_type: ' MCP' ,
447+ }
448+
449+ loadSharedApi ({ type: ' tool' , systemType: apiType .value })
450+ .getAllToolList (obj )
451+ .then ((res : any ) => {
452+ mcpToolSelectOptions .value = [... res .data .shared_tools , ... res .data .tools ].filter (
453+ (item : any ) => item .is_active ,
454+ )
455+ })
456+ }
457+
395458onMounted (() => {
396459 getSelectModel ()
397460 if (typeof props .nodeModel .properties .node_data ?.is_result === ' undefined' ) {
@@ -405,6 +468,7 @@ onMounted(() => {
405468 }
406469
407470 getToolSelectOptions ()
471+ getMcpToolSelectOptions ()
408472})
409473 </script >
410474<style lang="scss" scoped></style >
0 commit comments