Skip to main content
Glama
RyanCardin15

LocalTides MCP Server

get_sun_position

Calculate the sun's position for any date, time, and location using latitude and longitude inputs. Output in JSON or text format for precise astronomical 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 main handler function in SunService that computes the sun's position (azimuth, altitude, declination, right ascension) for given date, time, latitude, and longitude using SunCalc.getPosition and custom calculations for equatorial coordinates.
    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
      };
    }
  • Zod schema defining the input parameters (date, time, latitude, longitude, format) for the get_sun_position tool.
    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)')
    });
  • Registers the 'get_sun_position' tool with the FastMCP server, providing description, input schema, and an execute handler that calls the SunService method and handles text/JSON output formatting.
    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');
        }
      }
    });
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 what the tool does but lacks details on behavioral traits like error handling, rate limits, authentication needs, or output format implications. 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 words. Every part of the sentence earns its place by specifying the action and key inputs, making it highly concise and well-structured.

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 adequate but incomplete. It covers the basic purpose but lacks behavioral context and usage guidelines. With no output schema, it doesn't explain return values, and the absence of annotations means more detail is needed for full completeness.

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 input schema has 100% description coverage, clearly documenting all five parameters with details like formats, defaults, and constraints. The description adds minimal value beyond the schema, only implying that parameters are used for 'specific date, time, and location.' Since the schema does the heavy lifting, the baseline score of 3 is appropriate.

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 resource ('sun position information'), making the function evident. However, it doesn't explicitly differentiate from sibling tools like 'get_sun_times' or 'get_next_sun_event,' which might offer related solar data, so it doesn't reach the highest score.

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 contextual factors that might influence tool selection, such as comparing it to 'get_sun_times' for different solar data. Without any usage context or exclusions, it offers minimal guidance.

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-TidesAndCurrents-MCP'

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