get_aprs_position
Retrieve current position data for a ham radio callsign using the APRS.fi API, ideal for tracking and analysis in operations like balloon chasing or radio location monitoring.
Instructions
Get current position data for a specific callsign from APRS.fi
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| apiKey | No | APRS.fi API key (optional if set via /set-api-key) | |
| callsign | Yes | The callsign to look up (e.g., "W1AW") |
Implementation Reference
- index.ts:61-114 (handler)Core implementation of get_aprs_position tool: fetches current APRS position data for a callsign from aprs.fi API, handles API key, validation, error handling, and returns parsed positions.async getPosition(callsign: string, apiKey?: string): Promise<APRSPosition[]> { const keyToUse = apiKey || this.apiKey; if (!keyToUse) { throw new APRSError('APRS API key not provided. Use /set-api-key command or provide apiKey parameter.'); } if (!callsign?.trim()) { throw new APRSError('Callsign is required'); } const params = new URLSearchParams({ name: callsign.trim().toUpperCase(), what: 'loc', apikey: keyToUse, format: 'json' }); try { const response = await fetch(`${this.baseUrl}?${params}`); if (!response.ok) { throw new APRSError( `APRS API request failed: ${response.status} ${response.statusText}`, response.status ); } const data: APRSResponse = await response.json(); if (data.result !== 'ok') { throw new APRSError(`APRS API error: ${data.result}`); } if (data.found === 0) { return []; } return data.entries.map(entry => ({ ...entry, timestamp: entry.timestamp * 1000, })); } catch (error) { if (error instanceof APRSError) { throw error; } if (error instanceof TypeError && error.message.includes('fetch')) { throw new APRSError('Network error: Unable to connect to APRS.fi API. Check your internet connection.'); } throw new APRSError(`Unexpected error: ${error instanceof Error ? error.message : 'Unknown error'}`); } }
- index.ts:380-392 (handler)MCP CallToolRequestSchema handler switch case for 'get_aprs_position': extracts arguments, calls APRSMCPService.getPosition, and formats response as JSON text content.case 'get_aprs_position': const positions = await this.aprsService.getPosition( args.callsign as string, args.apiKey as string ); return { content: [ { type: 'text', text: JSON.stringify(positions, null, 2), }, ], };
- index.ts:288-305 (registration)Registers the get_aprs_position tool in ListToolsRequestSchema response, including name, description, and input schema.{ name: 'get_aprs_position', description: 'Get current position data for a specific callsign from APRS.fi', inputSchema: { type: 'object', properties: { callsign: { type: 'string', description: 'The callsign to look up (e.g., "W1AW")', }, apiKey: { type: 'string', description: 'APRS.fi API key (optional if set via /set-api-key)', }, }, required: ['callsign'], }, },
- index.ts:291-304 (schema)Input schema definition for get_aprs_position tool: requires callsign string, optional apiKey string.inputSchema: { type: 'object', properties: { callsign: { type: 'string', description: 'The callsign to look up (e.g., "W1AW")', }, apiKey: { type: 'string', description: 'APRS.fi API key (optional if set via /set-api-key)', }, }, required: ['callsign'], },
- index.ts:15-27 (schema)TypeScript interface defining the structure of APRS position data returned by the tool.interface APRSPosition { name: string; callsign: string; lat: number; lng: number; altitude?: number; timestamp: number; comment?: string; speed?: number; course?: number; symbol?: string; path?: string; }