> Discover all available pages from the documentation index: https://mastra.zisheng.pro/ko/llms.txt # voice.addTools() 그만큼`addTools()`방법은 Model이 실시간 상호 작용 중에 호출할 수 있는 Tool(기능)를 음성 제공자에게 제공합니다. 음성 도우미는 이러한 Tool을 사용하여 정보를 검색하거나 계산할 수 있습니다. 또한 외부 시스템과 상호 작용할 수도 있습니다. ## 사용예 ```typescript import { OpenAIRealtimeVoice } from '@mastra/voice-openai-realtime' import { createTool } from '@mastra/core/tools' import { z } from 'zod' // Define tools const weatherTool = createTool({ id: 'getWeather', description: 'Get the current weather for a location', inputSchema: z.object({ location: z.string().describe('The city and state, e.g. San Francisco, CA'), }), outputSchema: z.object({ message: z.string(), }), execute: async inputData => { // Fetch weather data from an API const response = await fetch( `https://api.weather.com?location=${encodeURIComponent(inputData.location)}`, ) const data = await response.json() return { message: `The current temperature in ${inputData.location} is ${data.temperature}°F with ${data.conditions}.`, } }, }) // Initialize a real-time voice provider const voice = new OpenAIRealtimeVoice({ realtimeConfig: { model: 'gpt-5.1-realtime', apiKey: process.env.OPENAI_API_KEY, }, }) // Add tools to the voice provider voice.addTools({ getWeather: weatherTool, }) // Connect to the real-time service await voice.connect() ``` ## 매개변수 **tools** (`ToolsInput`): 음성 Model이 호출할 수 있는 Tool 정의를 포함하는 객체 ## 반환 값 이 메서드는 값을 반환하지 않습니다. ## 메모 - Tool은 이름, 설명, 입력 스키마 및 실행 기능이 포함된 Mastra Tool 형식을 따라야 합니다. - 이 메서드는 주로 함수 호출을 지원하는 실시간 음성 Provider에 사용됩니다. - Tool을 지원하지 않는 음성 Provider에서 호출하면 경고를 기록하고 아무 작업도 수행하지 않습니다. - 이 메서드로 추가된 Tool은 일반적으로 연결된 Agent가 제공하는 Tool과 결합됩니다. - 최상의 결과를 얻으려면 대화를 시작하기 전(`connect()`를 호출하기 전)에 Tool을 추가하세요. - 음성 Provider는 Model이 Tool 핸들러를 사용하기로 결정하면 Tool 핸들러 호출을 자동으로 처리합니다. - `addTools()`를 여러 번 호출하면 Provider 구현에 따라 기존 Tool을 대체하거나 병합할 수 있습니다.