UNPKG

@mastra/core

Version:

Mastra is a framework for building AI-powered applications and agents with a modern TypeScript stack.

40 lines (28 loc) 1.19 kB
# Mastra.listGateways() Returns a record of all registered gateways, indexed by their registration keys. ## Usage example ```typescript 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()](https://mastra.ai/reference/core/getGateway): Get gateway by registration key - [Mastra.getGatewayById()](https://mastra.ai/reference/core/getGatewayById): Get gateway by ID - [Mastra.addGateway()](https://mastra.ai/reference/core/addGateway): Add a gateway - [MastraModelGateway](https://mastra.ai/reference/core/mastra-model-gateway): Gateway base class - [Custom Gateways Guide](https://mastra.ai/models/gateways/custom-gateways): Creating custom gateways