-
Notifications
You must be signed in to change notification settings - Fork 44
feat: Add vector index create and update #252
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
feat: Add vector index create and update #252
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.
lgtm
} | ||
export const VectorIndexArgs = { | ||
name: z.string().describe("The name of the index"), | ||
vectorDefinition: z |
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.
nit: we could use z.strictObject
to forbid unexpected fields in the input.
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'm wondering why the existing repo doesn't use strictObject
. Maybe it allows some flexibility in including additional fields that perhaps the API now accepts but the MCP server has not been updated to reflect?
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.
You can also circumvent that by exposing your schema information to the chatbot (so index json passed is always up to date with what MCP server wants to support)
FILTER = "filter", | ||
} | ||
export const VectorIndexArgs = { | ||
name: z.string().describe("The name of the index"), |
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.
nit: maybe to add .min(1)
to strict the validation a bit?
…nkworks/create-add-vector-search
const VECTOR_INDEX_TYPE = "vectorSearch"; | ||
export class CreateVectorIndexTool extends MongoDBToolBase { | ||
protected name = "create-vector-index"; | ||
protected description = "Create an Atlas Search vector for a collection"; |
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.
nit: Create an Atlas Vector Search Index for a collection
z.object({ | ||
path: z | ||
.string() | ||
.min(1) |
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.
Is this a type? Not sure what min(1)
means for a string field
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.
This enforces a minimum length of 1 so empty strings do not pass validation
…nkworks/create-add-vector-search
Add create and update for a vector index.
Manual testing included below. Test functions will be added in a separate PR.
It also works with a more free-form request
