メインコンテンツへ移動

Mastra.listTools()

.listTools() メソッドは、Mastra インスタンスに設定されている Tool を返します。返されるレコードでは Mastra の登録キーがキー、Tool インスタンスが値になります。

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

src/mastra/index.ts
import { Mastra } from '@mastra/core/mastra'
import { weatherTool } from './tools/weather-tool'

export const mastra = new Mastra({
tools: {
weather: weatherTool,
},
})

const tools = mastra.listTools()
const weather = tools?.weather

パラメーター
パラメーターへの直接リンク

このメソッドはパラメーターを受け取りません。

戻り値
戻り値への直接リンク

tools:

TTools | undefined
Mastra レベルの Tool レジストリ。各キーは登録キー、各値は Tool インスタンスです。レジストリがない場合は undefined を返します。

このメソッドが一覧表示するのは Mastra レベルのレジストリです。関数形式の Agent tools コールバック内にのみ存在する Tool は含まれません。