-
Notifications
You must be signed in to change notification settings - Fork 166
fix: fix the schema for embeddings parameter MCP-281 #763
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes the schema for embedding parameters to ensure compatibility with OpenAPI JSON Schema requirements. The change addresses the limitation that OpenAPI JSON Schema only supports enum values as strings, not numbers.
Key Changes:
- Updated
outputDimensionschema to accept stringified numbers ("256", "512", etc.) instead of numeric literals - Added transformation logic to parse string values back to numbers for internal use
- Updated all test cases to use stringified dimension values
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/tools/mongodb/mongodbSchemas.ts | Modified schema definitions to accept stringified numbers for outputDimension with transformation logic, and separated API parameters schema to maintain numeric types internally |
| tests/integration/tools/mongodb/read/aggregate.test.ts | Updated all test cases to use stringified outputDimension values ("256" instead of 256) |
| tests/integration/tools/mongodb/create/insertMany.test.ts | Updated test cases and commented code to use stringified outputDimension values |
src/tools/mongodb/mongodbSchemas.ts
Outdated
| .transform((value): number => Number.parseInt(value)) | ||
| .optional() | ||
| .default(1024), | ||
| .default("1024"), |
Copilot
AI
Nov 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default value should be applied before the transformation, not after. The .default() should come before .transform() to provide the default string value that will then be transformed to a number. Current order means the default is applied after transformation, which expects a number but receives a string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gagik do you know if the order of function application is relevant here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried using the schema as is on its own and it seemed to work fine.
Co-authored-by: Copilot <[email protected]>
Pull Request Test Coverage Report for Build 19708808618Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
Proposed changes
This PR updates the schema of
embeddingsParametersto expect a union on stringified numbers instead of numbers because OpenAPI JSON Schema supports enum of string only.Checklist