Skip to main content
Glama

nasa_osdr_files

Retrieve data files for specific OSD studies by providing the study accession number, enabling access to NASA's Open Science Data Repository for research and analysis.

Instructions

NASA OSDR - Get data files for an OSD study

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
accession_numberYesOSD study accession number (e.g., '87')

Implementation Reference

  • The osdrFilesHandler function implements the core logic for the 'nasa_osdr_files' tool. It validates the accession_number parameter, fetches data files metadata from the NASA OSDR API, adds the result as a MCP resource, and returns formatted JSON content or error.
    export async function osdrFilesHandler(args: OsdrFilesParams) { try { // Validate required parameters if (!args.accession_number) { throw new Error('Missing required parameter: accession_number must be provided.'); } // Base URL for the OSDR API const baseUrl = 'https://osdr.nasa.gov/osdr/data/osd/files'; const apiUrl = `${baseUrl}/${encodeURIComponent(args.accession_number)}`; // Make the API request using GET const response = await axios.get(apiUrl, { // OSDR API might require specific headers, e.g., Accept headers: { 'Accept': 'application/json' } }); const data = response.data; // Create a resource URI const resourceUri = `nasa://osdr/files/${encodeURIComponent(args.accession_number)}`; const resourceName = `OSDR Files for ${args.accession_number}`; // Add response to resources addResource(resourceUri, { name: resourceName, mimeType: "application/json", text: JSON.stringify(data, null, 2) }); // Format the response for MCP return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; } catch (error: any) { let errorMessage = `Error accessing NASA OSDR Files API: ${error.message}`; if (error.response) { // Include more detail from the API response if available errorMessage += `\nStatus: ${error.response.status}\nData: ${JSON.stringify(error.response.data)}`; } return { content: [{ type: "text", text: errorMessage }], isError: true }; } }
  • MCP tool schema definition and registration for 'nasa_osdr_files' in the tools/list handler response, specifying the required 'accession_number' input parameter.
    name: "nasa_osdr_files", description: "NASA OSDR - Get data files for an OSD study", inputSchema: { type: "object", properties: { accession_number: { type: "string", description: "OSD study accession number (e.g., '87')" } }, required: ["accession_number"] } },
  • TypeScript interface defining the input parameters expected by the osdrFilesHandler.
    interface OsdrFilesParams { accession_number: string; }
  • src/index.ts:1866-1871 (registration)
    Dynamic import logic in handleToolCall function that loads the osdr_files.ts handler module at runtime based on the tool endpoint 'osdr_files' for NASA tools.
    const handlerModule = await import(`./handlers/nasa/${endpoint}.js`); serverInstance?.sendLoggingMessage({ level: "info", data: `Successfully imported handler module for: ./handlers/nasa/${endpoint}.js`, });

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/ProgramComputer/NASA-MCP-server'

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