mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-21 02:40:14 +01:00
🏃♂️ refactor: Improve Agent Run Context & Misc. Changes (#6448)
* chore: bump Model Context Protocol SDK dependencies * fix: correct indentation in MCPConnection class * refactor: enhance SSE transport with abort controller and add error handling for empty results * chore: remove outdated Model Context Protocol SDK dependency * chore: update @modelcontextprotocol/sdk dependency to version 1.7.0 * chore: add debugging comments for PingRequest handling in MCPConnection class * refactor: update callTool method to accept structured arguments and options * refactor: simplify maxContextTokens calculation in initializeAgentOptions * chore: update @babel/runtime dependency to version 7.26.10 * chore: update @librechat/agents dependency to version 2.2.9 * chore: update @librechat/agents dependency to version 2.3.6 * refactor: imports and prevent s3 initialization if strategy not configured * refactor: mark redis as non-experimental * refactor: add missing `maxContextTokens` for OpenAI parameters * refactor: improve log message for Redis initialization * chore: update @librechat/agents dependency to version 2.3.8 * refactor: extend `streamBuffer` condition to include BEDROCK provider as easily gets throttled by AWS * refactor: filter out 'think' parts from message content in Anthropic and OpenAI clients
This commit is contained in:
parent
e768a07738
commit
bc88ac846d
13 changed files with 446 additions and 382 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import { CallToolResultSchema } from '@modelcontextprotocol/sdk/types.js';
|
||||
import type { RequestOptions } from '@modelcontextprotocol/sdk/shared/protocol.js';
|
||||
import type { JsonSchemaType, MCPOptions } from 'librechat-data-provider';
|
||||
import type { Logger } from 'winston';
|
||||
import type * as t from './types/mcp';
|
||||
|
|
@ -192,12 +193,19 @@ export class MCPManager {
|
|||
}
|
||||
}
|
||||
|
||||
async callTool(
|
||||
serverName: string,
|
||||
toolName: string,
|
||||
provider: t.Provider,
|
||||
toolArguments?: Record<string, unknown>,
|
||||
): Promise<t.FormattedToolResponse> {
|
||||
async callTool({
|
||||
serverName,
|
||||
toolName,
|
||||
provider,
|
||||
toolArguments,
|
||||
options,
|
||||
}: {
|
||||
serverName: string;
|
||||
toolName: string;
|
||||
provider: t.Provider;
|
||||
toolArguments?: Record<string, unknown>;
|
||||
options?: RequestOptions;
|
||||
}): Promise<t.FormattedToolResponse> {
|
||||
const connection = this.connections.get(serverName);
|
||||
if (!connection) {
|
||||
throw new Error(
|
||||
|
|
@ -213,7 +221,10 @@ export class MCPManager {
|
|||
},
|
||||
},
|
||||
CallToolResultSchema,
|
||||
{ timeout: connection.timeout },
|
||||
{
|
||||
timeout: connection.timeout,
|
||||
...options,
|
||||
},
|
||||
);
|
||||
return formatToolContent(result, provider);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue