mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-21 13:32:49 +08:00
### What problem does this PR solve? Feat: Test MCP server #3221 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
import message from '@/components/ui/message';
|
||||
import { IMcpServerListResponse } from '@/interfaces/database/mcp';
|
||||
import { IMcpServerListResponse, IMCPTool } from '@/interfaces/database/mcp';
|
||||
import { ITestMcpRequestBody } from '@/interfaces/request/mcp';
|
||||
import i18n from '@/locales/config';
|
||||
import mcpServerService from '@/services/mcp-server-service';
|
||||
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
||||
@ -164,12 +165,12 @@ export const useTestMcpServer = () => {
|
||||
data,
|
||||
isPending: loading,
|
||||
mutateAsync,
|
||||
} = useMutation({
|
||||
} = useMutation<IMCPTool[], Error, ITestMcpRequestBody>({
|
||||
mutationKey: [McpApiAction.TestMcpServer],
|
||||
mutationFn: async (params: Record<string, any>) => {
|
||||
const { data = {} } = await mcpServerService.test(params);
|
||||
mutationFn: async (params) => {
|
||||
const { data } = await mcpServerService.test(params);
|
||||
|
||||
return data;
|
||||
return data?.data || [];
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user