> Discover all available pages from the documentation index: https://mastra.zisheng.pro/ko/llms.txt # 마스트라.getToolById() 그만큼`.getToolById()`메서드는 먼저 Mastra 수준 레지스트리에서 일치하는 내장 항목이 있는 Tool을 검색합니다.`id`. 일치하는 고유 ID가 없으면 값을 등록 키로 처리합니다. ## 사용예 이 예제에서는 `weather`를 등록 키로 사용하고 `weather-tool`을 Tool 자체의 ID로 사용합니다. ```typescript import { Mastra } from '@mastra/core/mastra' import { createTool } from '@mastra/core/tools' import { z } from 'zod' const weatherTool = createTool({ id: 'weather-tool', description: 'Fetches weather for a location', inputSchema: z.object({ location: z.string(), }), outputSchema: z.object({ weather: z.string(), }), execute: async ({ location }) => ({ weather: `Weather for ${location}`, }), }) export const mastra = new Mastra({ tools: { weather: weatherTool, }, }) const toolById = mastra.getToolById('weather-tool') ``` ## 매개변수 **id** (`TTools[TToolName]['id']`): 찾을 Tool 자체의 ID입니다. 해당 ID를 가진 Tool이 없으면 Mastra는 이 값을 등록 키로 사용합니다. ## 관련된 - [Agent 간 Tool 공유](https://mastra.zisheng.pro/ko/docs/agents/using-tools) - [마스트라 수업](https://mastra.zisheng.pro/ko/reference/core/mastra-class) - [마스트라.getTool()](https://mastra.zisheng.pro/ko/reference/core/getTool) - [Mastra.listTools()](https://mastra.zisheng.pro/ko/reference/core/listTools)