Skip to main content
Glama
RyanCardin15

noaa-tidesandcurrents-mcp

get_moon_phases_range

Retrieve moon phase data for a specified date range and location using latitude and longitude. Output in JSON or text format for precise astronomical insights.

Instructions

Get moon phase information for a date range

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
end_dateYesEnd date (YYYY-MM-DD format)
formatNoOutput format (json or text)
latitudeNoLatitude for location-specific calculations
longitudeNoLongitude for location-specific calculations
start_dateYesStart date (YYYY-MM-DD format)

Implementation Reference

  • Core handler function that computes moon phases for a range of dates by iterating day-by-day and delegating to getMoonPhase method using the SunCalc library.
    getMoonPhasesRange(params: MoonPhasesRangeParams): MoonPhaseInfo[] {
      const startDate = new Date(params.start_date);
      const endDate = new Date(params.end_date);
      
      if (isNaN(startDate.getTime()) || isNaN(endDate.getTime())) {
        throw new Error('Invalid date format. Please use YYYY-MM-DD format.');
      }
      
      if (startDate > endDate) {
        throw new Error('Start date must be before end date.');
      }
      
      const result: MoonPhaseInfo[] = [];
      const currentDate = new Date(startDate);
      
      while (currentDate <= endDate) {
        result.push(this.getMoonPhase({
          date: currentDate.toISOString().split('T')[0],
          latitude: params.latitude,
          longitude: params.longitude
        }));
        
        // Move to next day
        currentDate.setDate(currentDate.getDate() + 1);
      }
      
      return result;
    }
  • Input schema definition using Zod for validating tool parameters including start_date, end_date, optional location and format.
    export const MoonPhasesRangeParamsSchema = z.object({
      start_date: z.string().describe('Start date (YYYY-MM-DD format)'),
      end_date: z.string().describe('End date (YYYY-MM-DD format)'),
      latitude: z.number().min(-90).max(90).optional().describe('Latitude for location-specific calculations'),
      longitude: z.number().min(-180).max(180).optional().describe('Longitude for location-specific calculations'),
      format: z.enum(['json', 'text']).optional().describe('Output format (json or text)')
    });
    
    export type MoonPhasesRangeParams = z.infer<typeof MoonPhasesRangeParamsSchema>;
  • MCP tool registration that binds the tool name to the service handler, provides description, input schema, and a wrapper execute function for formatting output as text or JSON.
      name: 'get_moon_phases_range',
      description: 'Get moon phase information for a date range',
      parameters: MoonPhasesRangeParamsSchema,
      execute: async (params) => {
        try {
          const results = moonPhaseService.getMoonPhasesRange(params);
          if (params.format === 'text') {
            return results.map(result => 
              `${result.date}: ${result.phaseName} (${(result.illumination * 100).toFixed(1)}% illuminated)`
            ).join('\n');
          }
          return JSON.stringify(results);
        } catch (error) {
          if (error instanceof Error) {
            throw new Error(`Failed to get moon phases: ${error.message}`);
          }
          throw new Error('Failed to get moon phases');
        }
      }
    });
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure but only states the basic action without details on permissions, rate limits, data sources, or response behavior. It doesn't mention if location parameters are optional or how missing data is handled, leaving significant gaps in understanding the tool's operational traits.

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 extremely concise and front-loaded, consisting of a single, clear sentence that directly states the tool's purpose without any unnecessary words or fluff. Every part of the sentence earns its place by conveying essential information efficiently.

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

Completeness2/5

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

Given the tool's complexity (5 parameters, no output schema, and no annotations), the description is incomplete. It lacks details on behavioral aspects, output format implications, and usage context, making it insufficient for an AI agent to fully understand how to invoke and interpret results without relying heavily on the schema alone.

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 schema description coverage is 100%, with all parameters well-documented in the input schema, so the description doesn't need to add parameter details. It implies a date range but doesn't provide extra semantic context beyond what the schema offers, aligning with the baseline score for high schema coverage.

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 with a specific verb ('Get') and resource ('moon phase information for a date range'), making it easy to understand what it does. However, it doesn't explicitly differentiate from its sibling tool 'get_moon_phase', which might be for a single date, leaving some ambiguity about when to choose one over the other.

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, such as the sibling 'get_moon_phase' or other related tools like 'get_next_moon_phase'. It lacks context about prerequisites, exclusions, or specific scenarios where this tool is preferred, offering only a basic functional statement without usage instructions.

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