set_n2yo_api_key
Configure your N2YO API key to enable satellite tracking functionality, including position queries, pass predictions, and TLE data access.
Instructions
Configure N2YO API key for satellite tracking
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| apiKey | Yes | N2YO API key from your account |
Implementation Reference
- src/server.ts:567-579 (handler)The primary handler function for the set_n2yo_api_key tool. It validates the provided API key and sets it on the N2YOClient instance, then returns a success response.private async setApiKey(apiKey: string): Promise<CallToolResult> { SatelliteValidator.validateApiKey(apiKey); this.n2yoClient.setApiKey(apiKey); return { content: [ { type: "text", text: "Successfully configured N2YO API key", }, ], }; }
- src/satellite-validation.ts:84-96 (schema)Runtime input validation for the API key parameter, enforcing type, length, and character set requirements.static validateApiKey(apiKey: string): void { if (!apiKey || typeof apiKey !== "string") { throw new ValidationError("API key is required and must be a string"); } if (apiKey.length < 10 || apiKey.length > 100) { throw new ValidationError("API key must be between 10 and 100 characters"); } if (!/^[a-zA-Z0-9-_]+$/.test(apiKey)) { throw new ValidationError("API key must contain only alphanumeric characters, hyphens, and underscores"); } }
- src/server.ts:20-33 (registration)Tool registration definition in the getTools() method, specifying name, description, and input schema.{ name: "set_n2yo_api_key", description: "Configure N2YO API key for satellite tracking", inputSchema: { type: "object", properties: { apiKey: { type: "string", description: "N2YO API key from your account", }, }, required: ["apiKey"], }, },
- src/n2yo-client.ts:114-116 (helper)Helper method in N2YOClient that stores the API key in the client instance for use in subsequent API requests.setApiKey(apiKey: string): void { this.apiKey = apiKey; }