Skip to main content
Glama
marcusbai

Caiyun Weather MCP Server

by marcusbai

get_minutely_forecast

Retrieve minute-level precipitation forecasts for specific coordinates using the Caiyun Weather MCP Server. Supports multiple languages and unit systems for accurate weather insights.

Instructions

获取分钟级降水预报

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
languageNo语言zh_CN
latitudeYes纬度
longitudeYes经度
unitNo单位制 (metric: 公制, imperial: 英制)metric

Implementation Reference

  • MCP tool handler for get_minutely_forecast: validates longitude/latitude params, calls CaiyunWeatherService.getMinutely, formats response with formatMinutelyData, and returns JSON string as text content.
    case 'get_minutely_forecast': {
      if (!this.isValidLocationArgs(args)) {
        throw new McpError(
          ErrorCode.InvalidParams,
          '无效的位置参数'
        );
      }
      
      const { longitude, latitude } = args;
      
      const weatherData = await weatherService.getMinutely(longitude, latitude);
      
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(weatherService.formatMinutelyData(weatherData), null, 2),
          },
        ],
      };
    }
  • src/index.ts:186-215 (registration)
    Tool registration in ListToolsRequestSchema, including name, description, and input schema for longitude, latitude, optional language and unit.
    {
      name: 'get_minutely_forecast',
      description: '获取分钟级降水预报',
      inputSchema: {
        type: 'object',
        properties: {
          longitude: {
            type: 'number',
            description: '经度',
          },
          latitude: {
            type: 'number',
            description: '纬度',
          },
          language: {
            type: 'string',
            enum: ['zh_CN', 'en_US'],
            description: '语言',
            default: 'zh_CN',
          },
          unit: {
            type: 'string',
            enum: ['metric', 'imperial'],
            description: '单位制 (metric: 公制, imperial: 英制)',
            default: 'metric',
          },
        },
        required: ['longitude', 'latitude'],
      },
    },
  • Core helper function in CaiyunWeatherService that performs the API request to Caiyun's minutely precipitation forecast endpoint.
    async getMinutely(longitude: number, latitude: number): Promise<CaiyunWeatherResponse> {
      try {
        const url = `${this.baseUrl}/${this.apiKey}/${longitude},${latitude}/minutely`;
        const response = await axios.get<CaiyunWeatherResponse>(url, {
          params: {
            lang: this.language,
            unit: this.unit
          }
        });
        
        return response.data;
      } catch (error) {
        if (axios.isAxiosError(error)) {
          throw new Error(`彩云天气API错误: ${error.response?.data?.error || error.message}`);
        }
        throw error;
      }
    }
  • Helper function to format the raw minutely forecast API response into a structured object with location, server_time, description, precipitation arrays, and probability.
    formatMinutelyData(data: CaiyunWeatherResponse) {
      const minutely = data.result.minutely;
      if (!minutely) {
        throw new Error('没有分钟级降水预报数据');
      }
    
      return {
        location: data.location,
        server_time: new Date(data.server_time * 1000).toISOString(),
        description: minutely.description,
        precipitation: minutely.precipitation,
        precipitation_2h: minutely.precipitation_2h,
        probability: minutely.probability
      };
    }
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 only states what the tool does ('get minutely precipitation forecast') without mentioning any behavioral traits such as rate limits, data freshness, error handling, or what the output might contain (e.g., precipitation intensity, duration). This is inadequate for a tool with no annotation coverage.

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 phrase ('获取分钟级降水预报') that directly states the tool's purpose without any wasted words. It's appropriately sized and front-loaded, making it easy for an agent to parse quickly.

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 complexity of a weather forecasting tool with no annotations and no output schema, the description is incomplete. It lacks details on behavioral aspects (e.g., data sources, update frequency) and doesn't hint at the output structure, which is critical for an agent to use the tool effectively in a broader context.

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 adds no parameter semantics beyond what the input schema provides. Since schema description coverage is 100%, the baseline score is 3. The description doesn't explain why parameters like 'latitude' and 'longitude' are required or how they affect the forecast, so it doesn't compensate for any gaps.

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 verb ('获取' meaning 'get') and resource ('分钟级降水预报' meaning 'minutely precipitation forecast'), providing a specific purpose. However, it doesn't explicitly distinguish this tool from its siblings like 'get_hourly_forecast' or 'get_daily_forecast' beyond the 'minutely' qualifier, which is why it doesn't reach 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. With siblings like 'get_hourly_forecast' and 'get_daily_forecast', it's unclear if this tool is for short-term precipitation predictions or specific use cases, leaving the agent to infer usage from the name alone.

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/marcusbai/caiyun-weather-mcp'

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