tool list data binding

This commit is contained in:
jZonG 2025-05-28 09:44:46 +08:00
parent 195a349cb5
commit 598c469be2
2 changed files with 4 additions and 4 deletions

View File

@ -43,11 +43,11 @@ const MCPDetailContent: FC<Props> = ({
const { t } = useTranslation() const { t } = useTranslation()
const { isCurrentWorkspaceManager } = useAppContext() const { isCurrentWorkspaceManager } = useAppContext()
const { data: toolList = [], isPending: isGettingTools } = useMCPTools(detail.is_team_authorization ? detail.id : '') const { data, isPending: isGettingTools } = useMCPTools(detail.is_team_authorization ? detail.id : '')
console.log('MCPDetailContent', detail, toolList)
const invalidateMCPTools = useInvalidateMCPTools() const invalidateMCPTools = useInvalidateMCPTools()
const { mutateAsync: updateTools, isPending: isUpdating } = useUpdateMCPTools(detail.id) const { mutateAsync: updateTools, isPending: isUpdating } = useUpdateMCPTools(detail.id)
const { mutateAsync: authorizeMcp, isPending: isAuthorizing } = useAuthorizeMCP() const { mutateAsync: authorizeMcp, isPending: isAuthorizing } = useAuthorizeMCP()
const toolList = data?.tools || []
const handleUpdateTools = useCallback(async () => { const handleUpdateTools = useCallback(async () => {
if (!detail) if (!detail)

View File

@ -157,7 +157,7 @@ export const useMCPTools = (providerID: string) => {
return useQuery({ return useQuery({
enabled: !!providerID, enabled: !!providerID,
queryKey: [NAME_SPACE, 'get-MCP-provider-tool', providerID], queryKey: [NAME_SPACE, 'get-MCP-provider-tool', providerID],
queryFn: () => get<Tool[]>(`/workspaces/current/tool-provider/mcp/tools/${providerID}`), queryFn: () => get<{ tools: Tool[] }>(`/workspaces/current/tool-provider/mcp/tools/${providerID}`),
}) })
} }
export const useInvalidateMCPTools = () => { export const useInvalidateMCPTools = () => {
@ -172,7 +172,7 @@ export const useInvalidateMCPTools = () => {
export const useUpdateMCPTools = (providerID: string) => { export const useUpdateMCPTools = (providerID: string) => {
return useMutation({ return useMutation({
mutationFn: () => get<Tool[]>(`/workspaces/current/tool-provider/mcp/update/${providerID}`), mutationFn: () => get<{ tools: Tool[] }>(`/workspaces/current/tool-provider/mcp/update/${providerID}`),
}) })
} }