Skip to main content
Glama
RyanCardin15

noaa-tidesandcurrents-mcp

get_sun_position

Calculate the sun's position for a specific date, time, and location. Input latitude, longitude, and format (JSON/text) to retrieve accurate solar data.

Instructions

Get sun position information for a specific date, time, and location

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dateNoDate to get sun position for (YYYY-MM-DD format). Defaults to current date.
formatNoOutput format (json or text)
latitudeYesLatitude for location-specific calculations
longitudeYesLongitude for location-specific calculations
timeNoTime to get sun position for (HH:MM:SS format). Defaults to current time.

Implementation Reference

  • The MCP tool handler for 'get_sun_position', which calls the sun service and handles text/JSON output formatting and error handling.
    server.addTool({
      name: 'get_sun_position',
      description: 'Get sun position information for a specific date, time, and location',
      parameters: SunPositionParamsSchema,
      execute: async (params) => {
        try {
          const result = sunService.getSunPosition(params);
          if (params.format === 'text') {
            let text = `Sun position for ${result.date} ${result.time} at latitude ${params.latitude}, longitude ${params.longitude}:\n`;
            text += `Azimuth: ${result.azimuth.toFixed(2)}°\n`;
            text += `Altitude: ${result.altitude.toFixed(2)}°\n`;
            text += `Declination: ${result.declination.toFixed(2)}°\n`;
            text += `Right Ascension: ${result.rightAscension.toFixed(2)}h\n`;
            return text;
          }
          return JSON.stringify(result);
        } catch (error) {
          if (error instanceof Error) {
            throw new Error(`Failed to get sun position: ${error.message}`);
          }
          throw new Error('Failed to get sun position');
        }
      }
    });
  • Zod schema defining input parameters for the get_sun_position tool, including date, time, location, and format.
    export const SunPositionParamsSchema = z.object({
      date: z.string().optional().describe('Date to get sun position for (YYYY-MM-DD format). Defaults to current date.'),
      time: z.string().optional().describe('Time to get sun position for (HH:MM:SS format). Defaults to current time.'),
      latitude: z.number().min(-90).max(90).describe('Latitude for location-specific calculations'),
      longitude: z.number().min(-180).max(180).describe('Longitude for location-specific calculations'),
      format: z.enum(['json', 'text']).optional().describe('Output format (json or text)')
    });
    
    export type SunPositionParams = z.infer<typeof SunPositionParamsSchema>;
  • Calls registerSunTools to register sun tools including get_sun_position to the MCP server.
    registerSunTools(server, sunService);
  • Core implementation of sun position calculation using SunCalc library, including position retrieval and approximate equatorial coordinates computation.
    getSunPosition(params: SunPositionParams): SunPositionInfo {
      const date = params.date ? new Date(params.date) : new Date();
      const time = params.time;
      const { latitude, longitude } = params;
      
      // Set the time if provided
      if (time) {
        const [hours, minutes, seconds] = time.split(':').map(Number);
        
        if (!isNaN(hours) && !isNaN(minutes) && (!seconds || !isNaN(seconds))) {
          date.setHours(hours, minutes, seconds || 0, 0);
        } else {
          throw new Error('Invalid time format. Please use HH:MM:SS format.');
        }
      }
      
      // Get sun position data
      const position = SunCalc.getPosition(date, latitude, longitude);
      
      // Calculate right ascension and declination (approximate values)
      // Note: These are approximate calculations and may not be precise
      const equatorialCoords = this.calculateEquatorialCoordinates(date, position.azimuth, position.altitude, latitude, longitude);
      
      return {
        date: date.toISOString().split('T')[0],
        time: date.toISOString().split('T')[1].split('.')[0],
        azimuth: position.azimuth * (180 / Math.PI),
        altitude: position.altitude * (180 / Math.PI),
        declination: equatorialCoords.declination,
        rightAscension: equatorialCoords.rightAscension
      };
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves information but doesn't cover aspects like rate limits, authentication needs, error handling, or the format of the returned sun position data. For a tool with no annotations, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose without unnecessary details. It's appropriately sized for the tool's complexity, with no wasted words, making it easy for an AI agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (5 parameters, no output schema, no annotations), the description is minimally adequate. It covers the basic purpose but lacks details on behavioral traits and usage guidelines. Without an output schema, it doesn't explain return values, which could be important for understanding the sun position data format.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description mentions 'date, time, and location,' which aligns with the parameters in the input schema (date, time, latitude, longitude). However, with 100% schema description coverage, the schema already fully documents all parameters, including defaults and constraints. The description adds no additional semantic value beyond what the schema provides, so it meets the baseline of 3.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Get sun position information for a specific date, time, and location.' It uses a specific verb ('Get') and identifies the resource ('sun position information'), but it doesn't explicitly differentiate from sibling tools like 'get_sun_times' or 'get_next_sun_event', which is why it doesn't earn a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools or specify contexts where this tool is preferred, such as for astronomical calculations versus tide-related tools in the server. This lack of comparative guidance limits its utility for an AI agent.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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/RyanCardin15/NOAA'

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