> Discover all available pages from the documentation index: https://mastra.zisheng.pro/zh-TW/llms.txt # Mastra.listGateways() 傳回以註冊鍵為索引的所有已註冊 gateway 的記錄。 ## 使用範例 ```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}`) } ``` ## 參數 無。 ## 傳回值 **gateways** (`Record`): 以註冊鍵為索引的 gateway 執行個體記錄 ## 相關內容 - [Mastra.getGateway()](https://mastra.zisheng.pro/zh-TW/reference/core/getGateway): 依註冊鍵取得 gateway - [Mastra.getGatewayById()](https://mastra.zisheng.pro/zh-TW/reference/core/getGatewayById): 依 ID 取得 gateway - [Mastra.addGateway()](https://mastra.zisheng.pro/zh-TW/reference/core/addGateway): 新增 gateway - [MastraModelGateway](https://mastra.zisheng.pro/zh-TW/reference/core/mastra-model-gateway): Gateway 基類 - [自訂 Gateway 指南](https://mastra.zisheng.pro/zh-TW/models/gateways/custom-gateways): 建立自訂 gateway