Mastra.listGateways()
Returns a record of all registered gateways, indexed by their registration keys.
Usage example
import { Mastra } from '@mastra/core';
const mastra = new Mastra({
gateways: {
myGateway: new MyCustomGateway(),
anotherGateway: new AnotherGateway(),
},
});
const gateways = mastra.listGateways();
console.log(Object.keys(gateways)); // ['myGateway', 'anotherGateway']
// Iterate over all gateways
for (const [key, gateway] of Object.entries(gateways)) {
console.log(`${key}: ${gateway.name}`);
}
Parameters
None.
Returns
gateways:
Record<string, MastraModelGateway>
A record of gateway instances indexed by registration key
Related
- Mastra.getGateway() - Get gateway by registration key
- Mastra.getGatewayById() - Get gateway by ID
- Mastra.addGateway() - Add a gateway
- MastraModelGateway - Gateway base class
- Custom Gateways Guide - Creating custom gateways