> Discover all available pages from the documentation index: https://mastra.zisheng.pro/zh-TW/llms.txt # Mastra.listTools() `.listTools()` 方法傳回 Mastra 執行個體上設定的 Tool。傳回記錄以 Mastra 註冊鍵作為鍵,以 Tool 執行個體作為值。 ## 使用範例 ```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 ``` ## 參數 此方法不接受任何參數。 ## 傳回值 **tools** (`TTools | undefined`): Mastra 級 Tool registry,其中每個鍵都是註冊鍵,每個值都是 Tool 執行個體。沒有可用 registry 時傳回 undefined。 此方法列出 Mastra 級 registry,不包括僅存在於函式型 Agent `tools` callback 中的 Tool。 ## 相關內容 - [在 Agent 之間共享 Tool](https://mastra.zisheng.pro/zh-TW/docs/agents/using-tools) - [Mastra 類別](https://mastra.zisheng.pro/zh-TW/reference/core/mastra-class) - [Mastra.getTool()](https://mastra.zisheng.pro/zh-TW/reference/core/getTool) - [Mastra.getToolById()](https://mastra.zisheng.pro/zh-TW/reference/core/getToolById)