Mastra.getTool()
La méthode .getTool() récupère un Tool depuis le registre au niveau de Mastra à partir de sa clé d’enregistrement.
Exemple d’utilisationLien direct vers Exemple d’utilisation
Enregistrez un Tool sous la clé weather, puis utilisez cette clé pour le récupérer.
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 tool = mastra.getTool('weather')
ParamètresLien direct vers Paramètres
name:
TToolName extends keyof TTools
Clé d’enregistrement du Tool dans le registre Mastra
tools.