get_exchange_rate
Retrieve the current USD to KRW exchange rate from Naver to calculate cryptocurrency price differences between Korean and international markets.
Instructions
Naver에서 현재 USD/KRW 환율을 조회합니다.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- index.js:45-59 (handler)Core handler function getExchangeRate() that fetches the USD/KRW exchange rate from Naver's search API using axios.async function getExchangeRate() { const url = 'https://m.search.naver.com/p/csearch/content/qapirender.nhn?key=calculator&pkid=141&q=%ED%99%98%EC%9C%A8&where=m&u1=keb&u6=standardUnit&u7=0&u3=USD&u4=KRW&u8=down&u2=1'; try { const response = await axios.get(url, { timeout: 5000 }); const data = response.data; // 환율 값 추출 (콤마 제거) const krwValue = parseFloat(data.country[1].value.replace(/,/g, '')); return krwValue; } catch (error) { throw new Error(`환율 API 오류: ${error.message}`); } }
- index.js:147-153 (registration)Registration of the 'get_exchange_rate' tool in the ListTools response, including name, description, and empty input schema.name: 'get_exchange_rate', description: 'Naver에서 현재 USD/KRW 환율을 조회합니다.', inputSchema: { type: 'object', properties: {}, }, },
- index.js:216-232 (handler)MCP CallTool handler for 'get_exchange_rate': calls getExchangeRate() and returns formatted text response.case 'get_exchange_rate': { const rate = await getExchangeRate(); result = { success: true, exchangeRate: rate, timestamp: new Date().toISOString(), }; return { content: [ { type: 'text', text: `💱 현재 USD/KRW 환율\n\n${rate.toLocaleString('ko-KR', { minimumFractionDigits: 2, maximumFractionDigits: 2 })} 원\n\n⏰ ${new Date().toLocaleString('ko-KR')}`, }, ], }; }