mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-16 16:30:15 +01:00
🔃 refactor: Conslidate JSON Schema Conversion to Schema
This commit is contained in:
parent
4bbdc4c402
commit
e4531d682d
3 changed files with 64 additions and 51 deletions
|
|
@ -8,8 +8,7 @@ const {
|
|||
sendEvent,
|
||||
MCPOAuthHandler,
|
||||
normalizeServerName,
|
||||
resolveJsonSchemaRefs,
|
||||
convertJsonSchemaToZod,
|
||||
convertWithResolvedRefs,
|
||||
} = require('@librechat/api');
|
||||
const { findToken, createToken, updateToken } = require('~/models');
|
||||
const { getMCPManager, getFlowStateManager } = require('~/config');
|
||||
|
|
@ -114,8 +113,7 @@ async function createMCPTool({ req, res, toolKey, provider: _provider }) {
|
|||
/** @type {LCTool} */
|
||||
const { description, parameters } = toolDefinition;
|
||||
const isGoogle = _provider === Providers.VERTEXAI || _provider === Providers.GOOGLE;
|
||||
const resolvedJsonSchema = resolveJsonSchemaRefs(parameters);
|
||||
let schema = convertJsonSchemaToZod(resolvedJsonSchema, {
|
||||
let schema = convertWithResolvedRefs(parameters, {
|
||||
allowEmptyObject: !isGoogle,
|
||||
transformOneOfAnyOf: true,
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue