Skip to content

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

Merged
merged 7 commits into from
May 14, 2025

Conversation

edgarw19
Copy link
Collaborator

@edgarw19 edgarw19 commented May 14, 2025

Add create and update for a vector index.

Manual testing included below. Test functions will be added in a separate PR.

Pasted Graphic 1

Pasted Graphic 2

It also works with a more free-form request
image

edgarw19 added 2 commits May 14, 2025 11:37
save

save

vector index args

save

save

save

saving

vector search
@edgarw19 edgarw19 requested a review from a team as a code owner May 14, 2025 16:03
@edgarw19 edgarw19 changed the base branch from main to search-skunkworks-2025 May 14, 2025 16:06
@edgarw19 edgarw19 changed the title Tools: Add vector index create and update feat: Add vector index create and update May 14, 2025
Copy link
Collaborator

@vm-mishchenko vm-mishchenko left a 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
Copy link
Collaborator

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.

Copy link
Collaborator Author

@edgarw19 edgarw19 May 14, 2025

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?

Copy link
Collaborator

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"),
Copy link
Collaborator

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?

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";
Copy link
Collaborator

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)
Copy link
Collaborator

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

Copy link
Collaborator Author

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

@edgarw19 edgarw19 merged commit 08203de into search-skunkworks-2025 May 14, 2025
9 checks passed
@edgarw19 edgarw19 deleted the skunkworks/create-add-vector-search branch May 14, 2025 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants