File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
packages/service/core/app/plugin Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ import type {
4242import { isProduction } from '@fastgpt/global/common/system/constants' ;
4343import { Output_Template_Error_Message } from '@fastgpt/global/core/workflow/template/output' ;
4444import { splitCombinePluginId } from '@fastgpt/global/core/app/plugin/utils' ;
45- import { getMCPToolRuntimeNode } from '@fastgpt/global/core/app/mcpTools/utils' ;
45+ import { getMCPParentId , getMCPToolRuntimeNode } from '@fastgpt/global/core/app/mcpTools/utils' ;
4646import { AppTypeEnum } from '@fastgpt/global/core/app/constants' ;
4747import { getMCPChildren } from '../mcp' ;
4848import { cloneDeep } from 'lodash' ;
@@ -227,9 +227,15 @@ export async function getChildAppPreviewNode({
227227
228228 const version = await getAppVersionById ( { appId : parentId , versionId, app : item } ) ;
229229 const toolConfig = version . nodes [ 0 ] . toolConfig ?. mcpToolSet ;
230- const tool = toolConfig ?. toolList . find ( ( item ) => item . name === toolName ) ;
231- if ( ! tool || ! toolConfig ) return Promise . reject ( PluginErrEnum . unExist ) ;
232-
230+ const tool = await ( async ( ) => {
231+ if ( toolConfig ?. toolList ) {
232+ // new mcp toolset
233+ return toolConfig . toolList . find ( ( item ) => item . name === toolName ) ;
234+ }
235+ // old mcp toolset
236+ return ( await getMCPChildren ( item ) ) . find ( ( item ) => item . name === toolName ) ;
237+ } ) ( ) ;
238+ if ( ! tool ) return Promise . reject ( PluginErrEnum . unExist ) ;
233239 return {
234240 avatar : item . avatar ,
235241 id : appId ,
You can’t perform that action at this time.
0 commit comments