get_neo_feed
Retrieve Near Earth Object (NEO) data for specific date ranges using the NASA API Desktop Extension. Input start and end dates to access up-to-date astronomical information.
Instructions
근지구 천체(Near Earth Objects) 정보를 가져옵니다
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| end_date | No | 종료 날짜 (YYYY-MM-DD) | |
| start_date | No | 시작 날짜 (YYYY-MM-DD) |
Implementation Reference
- server/index.js:262-315 (handler)The main handler function that fetches Near Earth Object (NEO) feed data from NASA's API based on provided date range, processes the asteroids data, and returns a formatted text response listing up to 10 NEOs with details like name, size, hazard status, and approach data.async getNEOFeed(args) { const { start_date, end_date } = args || {}; const params = new URLSearchParams({ api_key: this.apiKey, }); if (start_date) params.append('start_date', start_date); if (end_date) params.append('end_date', end_date); const response = await fetch(`${this.baseUrl}/neo/rest/v1/feed?${params}`); const data = await response.json(); if (!response.ok) { throw new Error(`NASA API 오류: ${data.error?.message || '알 수 없는 오류'}`); } const totalCount = data.element_count; const dates = Object.keys(data.near_earth_objects); let neoList = []; dates.forEach(date => { data.near_earth_objects[date].forEach(neo => { neoList.push({ date, name: neo.name, id: neo.id, diameter: neo.estimated_diameter.kilometers, hazardous: neo.is_potentially_hazardous_asteroid, close_approach: neo.close_approach_data[0], }); }); }); return { content: [ { type: 'text', text: `**근지구 천체 정보** (${start_date || '오늘'} ~ ${end_date || '7일 후'}) 총 ${totalCount}개의 근지구 천체가 발견되었습니다: ${neoList.slice(0, 10).map((neo, index) => ` ${index + 1}. **${neo.name}** - **ID**: ${neo.id} - **날짜**: ${neo.date} - **지름**: ${neo.diameter.estimated_diameter_min.toFixed(3)} - ${neo.diameter.estimated_diameter_max.toFixed(3)} km - **위험 여부**: ${neo.hazardous ? '위험' : '안전'} - **최근접 거리**: ${parseFloat(neo.close_approach.miss_distance.kilometers).toLocaleString()} km - **속도**: ${parseFloat(neo.close_approach.relative_velocity.kilometers_per_hour).toLocaleString()} km/h `).join('')}`, }, ], }; }
- server/index.js:88-100 (schema)Input schema definition for the get_neo_feed tool, specifying optional start_date and end_date parameters as strings in YYYY-MM-DD format.inputSchema: { type: 'object', properties: { start_date: { type: 'string', description: '시작 날짜 (YYYY-MM-DD)', }, end_date: { type: 'string', description: '종료 날짜 (YYYY-MM-DD)', }, }, },
- server/index.js:85-101 (registration)Tool registration entry in the listTools response, including name 'get_neo_feed', Korean description, and input schema.{ name: 'get_neo_feed', description: '근지구 천체(Near Earth Objects) 정보를 가져옵니다', inputSchema: { type: 'object', properties: { start_date: { type: 'string', description: '시작 날짜 (YYYY-MM-DD)', }, end_date: { type: 'string', description: '종료 날짜 (YYYY-MM-DD)', }, }, }, },
- server/index.js:167-168 (registration)Switch case in the CallToolRequest handler that routes 'get_neo_feed' tool calls to the getNEOFeed method.case 'get_neo_feed': return await this.getNEOFeed(args);