Skip to main content
Glama
MaxwellCalkin

N2YO Satellite Tracker MCP Server

query_satellites_with_tle

Find satellites using natural language queries and retrieve structured data with names and TLE (Two-Line Element) information. Filter by category and control result count for satellite tracking.

Instructions

Find satellites by natural language query and return structured data with Name and TLE

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesNatural language query about satellites (e.g., 'ISS', 'Starlink satellites over California', 'military satellites')
categoryFilterNoOptional filter for satellite categoryall
maxResultsNoMaximum number of satellites to return (default: 10)

Implementation Reference

  • Primary implementation of the tool handler. Queries satellites using natural language via querySatellitesNatural, fetches TLE for each using getSatelliteTle, and structures the response with names and TLE data.
    private async querySatellitesWithTle(query: string, categoryFilter: string = "all", maxResults: number = 10): Promise<CallToolResult> { try { // First, use the existing natural language query to find satellites const naturalQueryResult = await this.querySatellitesNatural(query, categoryFilter); if (naturalQueryResult.isError) { return naturalQueryResult; } // Parse the response to extract satellite data const responseText = naturalQueryResult.content[0]?.text; if (typeof responseText !== 'string') { throw new Error('Invalid response format from natural query'); } const naturalData = JSON.parse(responseText); const satellites = naturalData.satellites || []; // Limit results const limitedSatellites = satellites.slice(0, maxResults); // Get TLE data for each satellite const satellitesWithTle = []; for (const satellite of limitedSatellites) { try { const tleResult = await this.getSatelliteTle(String(satellite.noradId)); if (!tleResult.isError) { const tleResponseText = tleResult.content[0]?.text; if (typeof tleResponseText !== 'string') { continue; } const tleData = JSON.parse(tleResponseText); satellitesWithTle.push({ name: satellite.name, noradId: String(satellite.noradId), tle: tleData, position: satellite.position, launchDate: satellite.launchDate, internationalDesignator: satellite.internationalDesignator, }); } } catch (error) { // Skip satellites that don't have TLE data available console.warn(`Could not get TLE for satellite ${satellite.noradId}: ${error}`); } } // Return structured response const response = { query: query, location: naturalData.location, time: naturalData.time, categoryFilter: categoryFilter, satellites: satellitesWithTle, count: satellitesWithTle.length, totalFound: satellites.length, summary: `Found ${satellitesWithTle.length} satellites with TLE data (${satellites.length} total matches)`, }; return { content: [ { type: "text", text: JSON.stringify(response, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error processing query with TLE: ${error instanceof Error ? error.message : String(error)}`, }, ], isError: true, }; } }
  • src/server.ts:64-88 (registration)
    Tool registration in the getTools() method of N2YOServer class, defining the tool name, description, and input schema.
    { name: "query_satellites_with_tle", description: "Find satellites by natural language query and return structured data with Name and TLE", inputSchema: { type: "object", properties: { query: { type: "string", description: "Natural language query about satellites (e.g., 'ISS', 'Starlink satellites over California', 'military satellites')", }, categoryFilter: { type: "string", enum: ["all", "military", "weather", "gps", "amateur", "starlink", "space-stations"], default: "all", description: "Optional filter for satellite category", }, maxResults: { type: "number", default: 10, description: "Maximum number of satellites to return (default: 10)", }, }, required: ["query"], }, },
  • Dispatcher case in the callTool method that routes calls to the specific handler method.
    case "query_satellites_with_tle": return await this.querySatellitesWithTle(args.query, args.categoryFilter, args.maxResults);

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/MaxwellCalkin/N2YO-MCP'

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