get_exchange_rate
Retrieve current USD/KRW exchange rates 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 that fetches USD/KRW exchange rate from Naver API via axios.get and parses the response.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:146-153 (registration)Registers the get_exchange_rate tool in the MCP ListTools response with name, description, and empty input schema.{ name: 'get_exchange_rate', description: 'Naver에서 현재 USD/KRW 환율을 조회합니다.', inputSchema: { type: 'object', properties: {}, }, },
- index.js:216-232 (handler)MCP CallToolRequestSchema handler case that calls getExchangeRate, processes result, 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')}`, }, ], }; }