メインコンテンツへ移動

Mastra.listGateways()

登録キーでインデックス付けされた、登録済みのすべての Gateway のレコードを返します。

使用例
使用例への直接リンク

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<string, MastraModelGateway>
登録キーでインデックス付けされた Gateway インスタンスのレコード