mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-17 07:55:32 +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
|
|
@ -11,5 +11,6 @@ export * from './connection';
|
|||
export * from './mutations';
|
||||
export * from './prompts';
|
||||
export * from './queries';
|
||||
export * from './mcp';
|
||||
export * from './roles';
|
||||
export * from './tags';
|
||||
|
|
|
|||
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,
|
||||
},
|
||||
);
|
||||
};
|
||||
|
|
@ -178,7 +178,8 @@ export const useConversationTagsQuery = (
|
|||
*/
|
||||
|
||||
/**
|
||||
* Hook for getting all available tools for Assistants
|
||||
* Hook for getting available LibreChat tools (excludes MCP tools)
|
||||
* For MCP tools, use `useMCPToolsQuery` from mcp-queries.ts
|
||||
*/
|
||||
export const useAvailableToolsQuery = <TData = t.TPlugin[]>(
|
||||
endpoint: t.AssistantsEndpoint | EModelEndpoint.agents,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue