> Discover all available pages from the documentation index: https://mastra.zisheng.pro/zh-HK/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 登錄,其中每個鍵都是註冊鍵,每個值都是 Tool 實例。如沒有可用的登錄,則傳回 undefined。 此方法列出 Mastra 層級的登錄,不包括只存在於函數式 Agent `tools` 回呼中的 Tool。 ## 相關內容 - [在 Agent 之間共享 Tool](https://mastra.zisheng.pro/zh-HK/docs/agents/using-tools) - [Mastra 類別](https://mastra.zisheng.pro/zh-HK/reference/core/mastra-class) - [Mastra.getTool()](https://mastra.zisheng.pro/zh-HK/reference/core/getTool) - [Mastra.getToolById()](https://mastra.zisheng.pro/zh-HK/reference/core/getToolById)