LibreChat/packages/api/src/tools
Danny Avila ccbf9dc093
🧰 fix: Convert const to enum in MCP Schemas for Gemini Compatibility (#11784)
* fix: Convert `const` to `enum` in MCP tool schemas for Gemini/Vertex AI compatibility

  Gemini/Vertex AI rejects the JSON Schema `const` keyword in function declarations
  with a 400 error. Previously, the Zod conversion layer accidentally stripped `const`,
  but after migrating to pass raw JSON schemas directly to providers, the unsupported
  keyword now reaches Gemini verbatim.

  Add `normalizeJsonSchema` to recursively convert `const: X` → `enum: [X]`, which is
  semantically equivalent per the JSON Schema spec and supported by all providers.

* fix: Update secure cookie handling in AuthService to use dynamic secure flag

Replaced the static `secure: isProduction` with a call to `shouldUseSecureCookie()` in the `setOpenIDAuthTokens` function. This change ensures that the secure cookie setting is evaluated at runtime, improving cookie handling in development environments while maintaining security in production.

* refactor: Simplify MCP tool key formatting and remove unused mocks in tests

- Updated MCP test suite to replace static tool key formatting with a dynamic delimiter from Constants, enhancing consistency and maintainability.
- Removed unused mock implementations for `@langchain/core/tools` and `@librechat/agents`, streamlining the test setup.
- Adjusted related test cases to reflect the new tool key format, ensuring all tests remain functional.

* chore: import order
2026-02-13 13:33:25 -05:00
..
registry 🦥 refactor: Event-Driven Lazy Tool Loading (#11588) 2026-02-01 08:50:57 -05:00
toolkits 🔄 refactor: Sequential Event Ordering in Redis Streaming Mode (#11650) 2026-02-05 17:57:33 +01:00
classification.spec.ts 🗑️ chore: Remove Dev Artifacts for Deferred Tools Capability (#11601) 2026-02-01 22:33:12 -05:00
classification.ts 🗑️ chore: Remove Dev Artifacts for Deferred Tools Capability (#11601) 2026-02-01 22:33:12 -05:00
definitions.spec.ts 📬 feat: Implement Delta Buffering System for Out-of-Order SSE Events (#11643) 2026-02-05 14:00:54 +01:00
definitions.ts 🧰 fix: Convert const to enum in MCP Schemas for Gemini Compatibility (#11784) 2026-02-13 13:33:25 -05:00
format.spec.ts 🧬 refactor: Optimize MCP Tool Queries with Server-Centric Architecture 2025-09-21 20:40:14 -04:00
format.ts 🧬 refactor: Optimize MCP Tool Queries with Server-Centric Architecture 2025-09-21 20:40:14 -04:00
index.ts 🦥 refactor: Event-Driven Lazy Tool Loading (#11588) 2026-02-01 08:50:57 -05:00