Skip to main content
Glama
hyen43

Model Context Protocol Server

by hyen43

weather_api

Fetch real-time weather data for any city using the Open-Meteo API to integrate weather information into applications and workflows.

Instructions

Open-Meteo API를 사용하여 도시의 실제 날씨 정보를 가져오기

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cityYes날씨를 가져올 도시 이름

Implementation Reference

  • The handler function that performs geocoding for the city, fetches current weather data from Open-Meteo API, processes the response, and returns formatted weather information.
    async execute({ city }: WeatherApiInput): Promise<WeatherApiResponse> {
      try {
        // 첫째, 도시의 좌표를 가져옵니다
        const geoResponse = await axios.get(this.GEOCODING_URL, {
          params: {
            name: city,
            count: 1,
            language: "en",
            format: "json",
          },
        });
    
        if (!geoResponse.data.results?.length) {
          throw new Error(`도시 '${city}'를 찾을 수 없습니다`);
        }
    
        const location = geoResponse.data.results[0];
    
        // 그런 다음 좌표를 사용하여 날씨 데이터를 가져옵니다
        const weatherResponse = await axios.get(this.WEATHER_URL, {
          params: {
            latitude: location.latitude,
            longitude: location.longitude,
            current: [
              "temperature_2m",
              "relative_humidity_2m",
              "apparent_temperature",
              "precipitation",
              "weather_code",
              "wind_speed_10m",
            ],
            timezone: "auto",
          },
        });
    
        const current = weatherResponse.data.current;
    
        // 날씨 코드에 따라 조건 매핑
        const condition = this.getWeatherCondition(current.weather_code);
    
        return {
          city: location.name,
          temperature: Math.round(current.temperature_2m),
          condition,
          humidity: Math.round(current.relative_humidity_2m),
          windSpeed: Math.round(current.wind_speed_10m),
          feelsLike: Math.round(current.apparent_temperature),
          precipitation: current.precipitation,
        };
      } catch (error: unknown) {
        if (error instanceof Error) {
          throw new Error(`날씨 데이터 가져오기 실패: ${error.message}`);
        }
        throw new Error(
          "날씨 데이터 가져오기 실패: 알 수 없는 오류가 발생했습니다"
        );
      }
    }
  • Zod-based input schema defining the 'city' parameter as a required string.
    schema = {
      city: {
        type: z.string(),
        description: "날씨를 가져올 도시 이름",
      },
    };
  • Tool class registration extending MCPTool, defining the tool name 'weather_api' and description. Likely auto-registered by the MCP framework.
    class WeatherApiTool extends MCPTool<WeatherApiInput> {
      name = "weather_api";
      description = "Open-Meteo API를 사용하여 도시의 실제 날씨 정보를 가져오기";
  • Helper function to map WMO weather codes to human-readable Korean descriptions.
    private getWeatherCondition(code: number): string {
      // WMO 날씨 해석 코드 (https://open-meteo.com/en/docs)
      const conditions: Record<number, string> = {
        0: "맑은 하늘",
        1: "주로 맑음",
        2: "부분적으로 흐림",
        3: "흐림",
        45: "안개",
        48: "서리안개",
        51: "가벼운 이슬비",
        53: "보통 이슬비",
        55: "강한 이슬비",
        61: "약한 비",
        63: "보통 비",
        65: "강한 비",
        71: "약한 눈",
        73: "보통 눈",
        75: "강한 눈",
        77: "눈 알갱이",
        80: "약한 소나기",
        81: "보통 소나기",
        82: "강한 소나기",
        85: "약한 눈소나기",
        86: "강한 눈소나기",
        95: "천둥번개",
        96: "약한 우박을 동반한 천둥번개",
        99: "강한 우박을 동반한 천둥번개",
      };
    
      return conditions[code] || "알 수 없음";
    }
  • TypeScript interfaces defining input (WeatherApiInput) and output (WeatherApiResponse) shapes.
    interface WeatherApiInput {
      city: string;
    }
    
    interface WeatherApiResponse {
      city: string;
      temperature: number;
      condition: string;
      humidity: number;
      windSpeed: number;
      feelsLike: number;
      precipitation: number;
    }
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 mentions using the Open-Meteo API but does not describe traits like rate limits, authentication needs, error handling, or response format. This is a significant gap for an API-based tool with no output schema.

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

Conciseness4/5

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

The description is a single, efficient sentence in Korean that directly states the tool's function. It is appropriately sized and front-loaded, with no wasted words, though it could be slightly more structured for clarity.

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 an API tool with no annotations and no output schema, the description is incomplete. It lacks details on behavioral traits, response format, and differentiation from siblings, making it inadequate for an agent to fully understand how to use this tool effectively.

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 the 'city' parameter fully documented in the schema. The description adds no additional parameter details beyond implying the city is used to fetch weather data, which is already clear from the schema. This meets the baseline 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: '가져오기' (fetch/retrieve) weather information for a city using the Open-Meteo API. It specifies the resource (weather information) and the target (city), but does not distinguish it from the sibling 'weather' tool, which might have overlapping functionality.

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 like the sibling 'weather' tool. It lacks explicit context, exclusions, or prerequisites, leaving the agent to infer usage based on the tool name and description 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

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/hyen43/mcpServer'

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