get_earth_imagery
Retrieve satellite images of Earth using NASA's API by specifying latitude, longitude, and date. Display detailed visualizations with customizable image size for geographic analysis.
Instructions
NASA의 지구 이미지 API를 통해 위성 이미지를 가져옵니다
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| date | No | 날짜 (YYYY-MM-DD) | |
| dim | No | 이미지 크기 (0.03 ~ 0.5) | |
| lat | Yes | 위도 | |
| lon | Yes | 경도 |
Implementation Reference
- server/index.js:355-394 (handler)The handler function for get_earth_imagery. It constructs the NASA Earth Imagery API request using lat, lon, optional date and dim, fetches the imagery, and returns a formatted text response with the image URL.async getEarthImagery(args) { const { lat, lon, date, dim = 0.15 } = args; const params = new URLSearchParams({ lat: lat.toString(), lon: lon.toString(), dim: dim.toString(), api_key: this.apiKey, }); if (date) { params.append('date', date); } const response = await fetch(`${this.baseUrl}/planetary/earth/imagery?${params}`); if (!response.ok) { const errorData = await response.json(); throw new Error(`NASA Earth Imagery API 오류: ${errorData.error?.message || '알 수 없는 오류'}`); } // 이미지 데이터를 직접 반환하는 대신 URL을 구성 const imageUrl = `${this.baseUrl}/planetary/earth/imagery?${params}`; return { content: [ { type: 'text', text: `**지구 위성 이미지** 위치: 위도 ${lat}, 경도 ${lon} ${date ? `날짜: ${date}` : '최신 이미지'} 이미지 크기: ${dim} 이미지 URL: ${imageUrl} 이 이미지는 NASA의 Landsat 8 위성에서 촬영된 지구 표면의 위성 이미지입니다.`, }, ], }; }
- server/index.js:130-152 (schema)Input schema definition for the get_earth_imagery tool, specifying parameters lat, lon (required), date, and dim.inputSchema: { type: 'object', properties: { lat: { type: 'number', description: '위도', }, lon: { type: 'number', description: '경도', }, date: { type: 'string', description: '날짜 (YYYY-MM-DD)', }, dim: { type: 'number', description: '이미지 크기 (0.03 ~ 0.5)', default: 0.15, }, }, required: ['lat', 'lon'], },
- server/index.js:127-153 (registration)Registration of the get_earth_imagery tool in the listTools handler, including name, description, and schema.{ name: 'get_earth_imagery', description: 'NASA의 지구 이미지 API를 통해 위성 이미지를 가져옵니다', inputSchema: { type: 'object', properties: { lat: { type: 'number', description: '위도', }, lon: { type: 'number', description: '경도', }, date: { type: 'string', description: '날짜 (YYYY-MM-DD)', }, dim: { type: 'number', description: '이미지 크기 (0.03 ~ 0.5)', default: 0.15, }, }, required: ['lat', 'lon'], }, },
- server/index.js:171-172 (registration)Dispatch case in the CallToolRequestSchema handler that routes to the getEarthImagery method.case 'get_earth_imagery': return await this.getEarthImagery(args);