UNPKG

@mastra/core

Version:
33 lines (22 loc) 947 B
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt # Mastra.getTool() The `.getTool()` method retrieves a tool from the Mastra-level registry by its registration key. ## Usage example Register a tool under the `weather` key, then use that key to retrieve it. ```typescript import { Mastra } from '@mastra/core/mastra' import { weatherTool } from './tools/weather-tool' export const mastra = new Mastra({ tools: { weather: weatherTool, }, }) const tool = mastra.getTool('weather') ``` ## Parameters **name** (`TToolName extends keyof TTools`): The registration key of the tool in the Mastra tools registry. ## Related - [Share tools across agents](https://mastra.ai/docs/agents/using-tools) - [Mastra class](https://mastra.ai/reference/core/mastra-class) - [Mastra.getToolById()](https://mastra.ai/reference/core/getToolById) - [Mastra.listTools()](https://mastra.ai/reference/core/listTools)