Skip to main content
Mastra v1 is coming in January 2026. Get ahead by starting new projects with the beta or upgrade your existing project today.

Mastra.getVector()

The .getVector() method is used to retrieve a vector store by its name. The method accepts a single string parameter for the vector store's name.

Usage exampleDirect link to Usage example

mastra.getVector("testVectorStore");

ParametersDirect link to Parameters

name:

TVectorName extends keyof TVectors
The name of the vector store to retrieve. Must be a valid vector store name that exists in the Mastra configuration.

ReturnsDirect link to Returns

vector:

TVectors[TVectorName]
The vector store instance with the specified name. Throws an error if the vector store is not found.

On this page