Mastra.listTools()
The .listTools() method returns the tools configured on a Mastra instance. The returned record uses Mastra registration keys and tool instances as values.
Usage exampleDirect link to Usage example
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
ParametersDirect link to Parameters
This method doesn't accept any parameters.
ReturnsDirect link to Returns
tools:
TTools | undefined
The Mastra-level tool registry, where each key is a registration key and each value is a tool instance. Returns
undefined when no registry is available.This method lists the Mastra-level registry. It doesn't include tools that exist only in a function-based Agent tools callback.