Skip to main content
Glama
seoh0711

NASA API Desktop Extension

by seoh0711

search_nasa_images

Search NASA’s image, video, and audio library for space-related media. Specify search queries, media types, and page numbers to find and explore space content directly from NASA’s database.

Instructions

NASA 이미지 및 비디오 라이브러리에서 검색합니다

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
media_typeNo미디어 타입image
pageNo페이지 번호
qYes검색 쿼리

Implementation Reference

  • The main handler function that executes the tool logic: destructures args, fetches from NASA images API, handles errors, limits results to 10, and returns formatted text content with search results.
    async searchNASAImages(args) { const { q, media_type = 'image', page = 1 } = args; const params = new URLSearchParams({ q, media_type, page: page.toString(), }); const response = await fetch(`https://images-api.nasa.gov/search?${params}`); const data = await response.json(); if (!response.ok) { throw new Error(`NASA Images API 오류: ${data.reason || '알 수 없는 오류'}`); } const items = data.collection.items.slice(0, 10); // 최대 10개 결과만 반환 return { content: [ { type: 'text', text: `**NASA 이미지 검색 결과** - "${q}" 총 ${data.collection.metadata.total_hits}개의 결과를 찾았습니다. 처음 ${items.length}개를 보여드립니다: ${items.map((item, index) => ` ${index + 1}. **${item.data[0].title}** - **설명**: ${item.data[0].description || '설명 없음'} - **날짜**: ${item.data[0].date_created} - **미디어 타입**: ${item.data[0].media_type} - **이미지 URL**: ${item.links?.[0]?.href || '이미지 없음'} - **NASA ID**: ${item.data[0].nasa_id} `).join('')}`, }, ], }; }
  • Input schema definition for the tool, specifying required 'q' parameter and optional media_type and page.
    inputSchema: { type: 'object', properties: { q: { type: 'string', description: '검색 쿼리', }, media_type: { type: 'string', enum: ['image', 'video', 'audio'], description: '미디어 타입', default: 'image', }, page: { type: 'number', description: '페이지 번호', default: 1, }, }, required: ['q'], },
  • Tool registration in the ListToolsRequestSchema handler, including name, description, and input schema.
    { name: 'search_nasa_images', description: 'NASA 이미지 및 비디오 라이브러리에서 검색합니다', inputSchema: { type: 'object', properties: { q: { type: 'string', description: '검색 쿼리', }, media_type: { type: 'string', enum: ['image', 'video', 'audio'], description: '미디어 타입', default: 'image', }, page: { type: 'number', description: '페이지 번호', default: 1, }, }, required: ['q'], }, },
  • Dispatch registration in the CallToolRequestSchema switch statement, mapping the tool name to its handler method.
    case 'search_nasa_images': return await this.searchNASAImages(args);

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/seoh0711/dxt_nasa'

If you have feedback or need assistance with the MCP directory API, please join our Discord server