@mastra/core
Version:
38 lines (25 loc) • 1.22 kB
Markdown
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
# 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
```typescript
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
This method doesn't accept any parameters.
## 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.
## Related
- [Share tools across agents](https://mastra.ai/docs/agents/using-tools)
- [Mastra class](https://mastra.ai/reference/core/mastra-class)
- [Mastra.getTool()](https://mastra.ai/reference/core/getTool)
- [Mastra.getToolById()](https://mastra.ai/reference/core/getToolById)