mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-02-23 10:54:11 +01:00
🧰 refactor: Decouple MCP Tools from System Tools (#9748)
This commit is contained in:
parent
9d2aba5df5
commit
386900fb4f
29 changed files with 1032 additions and 1195 deletions
29
client/src/data-provider/mcp.ts
Normal file
29
client/src/data-provider/mcp.ts
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
/**
|
||||
* Dedicated queries for MCP (Model Context Protocol) tools
|
||||
* Decoupled from regular LibreChat tools
|
||||
*/
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { QueryKeys, dataService } from 'librechat-data-provider';
|
||||
import type { UseQueryOptions, QueryObserverResult } from '@tanstack/react-query';
|
||||
import type { TPlugin } from 'librechat-data-provider';
|
||||
|
||||
/**
|
||||
* Hook for fetching MCP-specific tools
|
||||
* @param config - React Query configuration
|
||||
* @returns MCP tools grouped by server
|
||||
*/
|
||||
export const useMCPToolsQuery = <TData = TPlugin[]>(
|
||||
config?: UseQueryOptions<TPlugin[], unknown, TData>,
|
||||
): QueryObserverResult<TData> => {
|
||||
return useQuery<TPlugin[], unknown, TData>(
|
||||
[QueryKeys.mcpTools],
|
||||
() => dataService.getMCPTools(),
|
||||
{
|
||||
refetchOnWindowFocus: false,
|
||||
refetchOnReconnect: false,
|
||||
refetchOnMount: false,
|
||||
staleTime: 5 * 60 * 1000, // 5 minutes
|
||||
...config,
|
||||
},
|
||||
);
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue