mirror of
https://github.com/labring/FastGPT.git
synced 2025-10-20 02:34:52 +00:00
perf: mcp save raw schema (#5030)
* perf: mcp save raw schema * fix: test * code * perf: json schema test * perf: mcp
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
import { NodeOutputKeyEnum, WorkflowIOValueTypeEnum } from '../../workflow/constants';
|
||||
import {
|
||||
NodeInputKeyEnum,
|
||||
NodeOutputKeyEnum,
|
||||
WorkflowIOValueTypeEnum
|
||||
} from '../../workflow/constants';
|
||||
import {
|
||||
FlowNodeInputTypeEnum,
|
||||
FlowNodeOutputTypeEnum,
|
||||
@@ -9,6 +13,7 @@ import { type McpToolConfigType } from '../type';
|
||||
import { i18nT } from '../../../../web/i18n/utils';
|
||||
import { type RuntimeNodeItemType } from '../../workflow/runtime/type';
|
||||
import { type StoreSecretValueType } from '../../../common/secret/type';
|
||||
import { jsonSchema2NodeInput } from '../jsonschema';
|
||||
|
||||
export const getMCPToolSetRuntimeNode = ({
|
||||
url,
|
||||
@@ -30,14 +35,14 @@ export const getMCPToolSetRuntimeNode = ({
|
||||
intro: 'MCP Tools',
|
||||
inputs: [
|
||||
{
|
||||
key: 'toolSetData',
|
||||
key: NodeInputKeyEnum.toolSetData,
|
||||
label: 'Tool Set Data',
|
||||
valueType: WorkflowIOValueTypeEnum.object,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.hidden],
|
||||
value: {
|
||||
url,
|
||||
toolList,
|
||||
headerSecret
|
||||
headerSecret,
|
||||
toolList
|
||||
}
|
||||
}
|
||||
],
|
||||
@@ -65,7 +70,7 @@ export const getMCPToolRuntimeNode = ({
|
||||
intro: tool.description,
|
||||
inputs: [
|
||||
{
|
||||
key: 'toolData',
|
||||
key: NodeInputKeyEnum.toolData,
|
||||
label: 'Tool Data',
|
||||
valueType: WorkflowIOValueTypeEnum.object,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.hidden],
|
||||
@@ -75,23 +80,7 @@ export const getMCPToolRuntimeNode = ({
|
||||
headerSecret
|
||||
}
|
||||
},
|
||||
...Object.entries(tool.inputSchema?.properties || {}).map(([key, value]) => ({
|
||||
key,
|
||||
label: key,
|
||||
valueType: value.type as WorkflowIOValueTypeEnum, // TODO: 这里需要做一个映射
|
||||
description: value.description,
|
||||
toolDescription: value.description || key,
|
||||
required: tool.inputSchema?.required?.includes(key) || false,
|
||||
renderTypeList: [
|
||||
value.type === 'string'
|
||||
? FlowNodeInputTypeEnum.input
|
||||
: value.type === 'number'
|
||||
? FlowNodeInputTypeEnum.numberInput
|
||||
: value.type === 'boolean'
|
||||
? FlowNodeInputTypeEnum.switch
|
||||
: FlowNodeInputTypeEnum.JSONEditor
|
||||
]
|
||||
}))
|
||||
...jsonSchema2NodeInput(tool.inputSchema)
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
|
Reference in New Issue
Block a user