🔃 refactor: Conslidate JSON Schema Conversion to Schema

This commit is contained in:
Danny Avila 2025-07-10 18:52:24 -04:00
parent 4bbdc4c402
commit e4531d682d
No known key found for this signature in database
GPG key ID: BF31EEB2C5CA0956
3 changed files with 64 additions and 51 deletions

View file

@ -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,
});