mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 13:03:50 +00:00
mcp server tool alias (#4621)
This commit is contained in:
@@ -62,6 +62,7 @@ const SelectAppModal = ({
|
||||
{
|
||||
appId: string;
|
||||
toolName: string;
|
||||
toolAlias: string;
|
||||
avatar: string;
|
||||
description: string;
|
||||
}[]
|
||||
@@ -75,6 +76,7 @@ const SelectAppModal = ({
|
||||
data.map((item) => ({
|
||||
appId: item.id,
|
||||
toolName: item.name,
|
||||
toolAlias: item.name,
|
||||
avatar: item.avatar,
|
||||
description: selectedApps.find((app) => app.appId === item.id)?.description || ''
|
||||
}))
|
||||
@@ -174,6 +176,7 @@ const SelectAppModal = ({
|
||||
{
|
||||
appId: item._id,
|
||||
toolName: item.name,
|
||||
toolAlias: item.name,
|
||||
avatar: item.avatar,
|
||||
description: item.intro
|
||||
}
|
||||
@@ -252,7 +255,6 @@ const EditMcpModal = ({
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
const isEdit = !!editMcp.id;
|
||||
console.log(editMcp);
|
||||
const {
|
||||
isOpen: isOpenSelectApp,
|
||||
onOpen: onOpenSelectApp,
|
||||
@@ -279,6 +281,7 @@ const EditMcpModal = ({
|
||||
apps: data.apps.map((item) => ({
|
||||
appId: item.appId,
|
||||
toolName: item.toolName,
|
||||
toolAlias: item.toolAlias,
|
||||
description: item.description
|
||||
}))
|
||||
}),
|
||||
@@ -296,6 +299,7 @@ const EditMcpModal = ({
|
||||
apps: data.apps.map((item) => ({
|
||||
appId: item.appId,
|
||||
toolName: item.toolName,
|
||||
toolAlias: item.toolAlias,
|
||||
description: item.description
|
||||
}))
|
||||
}),
|
||||
@@ -311,7 +315,7 @@ const EditMcpModal = ({
|
||||
<>
|
||||
<MyModal
|
||||
iconSrc="key"
|
||||
title={isEdit ? '编辑MCP' : '创建MCP'}
|
||||
title={isEdit ? t('dashboard_mcp:edit_mcp') : t('dashboard_mcp:create_mcp')}
|
||||
w={'100%'}
|
||||
maxW={['90vw', '600px']}
|
||||
isOpen
|
||||
@@ -336,6 +340,7 @@ const EditMcpModal = ({
|
||||
<Thead>
|
||||
<Tr>
|
||||
<Th>{t('dashboard_mcp:app_name')}</Th>
|
||||
<Th>{t('dashboard_mcp:app_tool_name')}</Th>
|
||||
<Th>{t('dashboard_mcp:app_description')}</Th>
|
||||
<Th></Th>
|
||||
</Tr>
|
||||
@@ -345,6 +350,14 @@ const EditMcpModal = ({
|
||||
return (
|
||||
<Tr key={app.id} fontWeight={500} fontSize={'mini'} color={'myGray.900'}>
|
||||
<Td>{app.toolName}</Td>
|
||||
<Td>
|
||||
<Input
|
||||
{...register(`apps.${index}.toolAlias`)}
|
||||
placeholder={app.toolName}
|
||||
bg={'myGray.50'}
|
||||
w={'100%'}
|
||||
/>
|
||||
</Td>
|
||||
<Td>
|
||||
<Input
|
||||
{...register(`apps.${index}.description`, { required: true })}
|
||||
@@ -400,6 +413,7 @@ const EditMcpModal = ({
|
||||
e.map((item) => ({
|
||||
appId: item.appId,
|
||||
toolName: item.toolName,
|
||||
toolAlias: item.toolAlias,
|
||||
description: item.description
|
||||
}))
|
||||
);
|
||||
|
@@ -184,7 +184,7 @@ async function handler(
|
||||
const app = appList.find((app) => {
|
||||
const mcpApp = mcp.apps.find((mcpApp) => String(mcpApp.appId) === String(app._id))!;
|
||||
|
||||
return toolName === mcpApp.toolName;
|
||||
return toolName === mcpApp.toolAlias || toolName === mcpApp.toolName;
|
||||
});
|
||||
|
||||
if (!app) {
|
||||
|
@@ -138,7 +138,7 @@ async function handler(
|
||||
);
|
||||
|
||||
return {
|
||||
name: mcpApp.toolName,
|
||||
name: mcpApp.toolAlias || mcpApp.toolName,
|
||||
description: mcpApp.description,
|
||||
inputSchema: isPlugin
|
||||
? pluginNodes2InputSchema(version.nodes)
|
||||
|
Reference in New Issue
Block a user