mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-21 00:21:49 +00:00
feat(mcp): add useMCPToolsets React Query hook
This commit is contained in:
parent
95c4c7097a
commit
b448c44001
1 changed files with 16 additions and 0 deletions
|
|
@ -0,0 +1,16 @@
|
|||
import { useQuery } from "@tanstack/react-query";
|
||||
import { createQueryKeys } from "../common/queryKeysFactory";
|
||||
import { fetchMCPToolsets } from "@/components/networking";
|
||||
import { MCPToolset } from "@/components/mcp_tools/types";
|
||||
import useAuthorized from "../useAuthorized";
|
||||
|
||||
const mcpToolsetKeys = createQueryKeys("mcpToolsets");
|
||||
|
||||
export const useMCPToolsets = () => {
|
||||
const { accessToken } = useAuthorized();
|
||||
return useQuery<MCPToolset[]>({
|
||||
queryKey: mcpToolsetKeys.list(),
|
||||
queryFn: async () => await fetchMCPToolsets(accessToken!),
|
||||
enabled: !!accessToken,
|
||||
});
|
||||
};
|
||||
Loading…
Add table
Reference in a new issue