Skip to main content

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 example
Direct 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

Parameters
Direct link to Parameters

This method doesn't accept any parameters.

Returns
Direct 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.

On this page