Skip to main content
Glama
lincw

CWA MCP Server

by lincw

get_weather_forecast

Retrieve detailed 36-hour weather forecasts for Taiwan by specifying a county or city name in Traditional Chinese. This tool connects to the Central Weather Administration API, providing accurate weather data for all regions in Taiwan.

Instructions

Get Taiwan weather forecast for the next 36 hours by county/city name. Available locations: 宜蘭縣, 花蓮縣, 臺東縣, 澎湖縣, 金門縣, 連江縣, 臺北市, 新北市, 桃園市, 臺中市, 臺南市, 高雄市, 基隆市, 新竹縣, 新竹市, 苗栗縣, 彰化縣, 南投縣, 雲林縣, 嘉義縣, 嘉義市, 屏東縣

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
locationNameYesTaiwan county/city name in Traditional Chinese (e.g., 臺北市, 高雄市)

Implementation Reference

  • Executes the get_weather_forecast tool: destructures locationName from arguments, validates presence and validity against Taiwanese locations, calls fetchCWAData with F-C0032-001 endpoint, returns formatted JSON of forecast records.
    case "get_weather_forecast": {
      const { locationName } = request.params.arguments;
      
      if (!locationName) {
        throw new Error("locationName parameter is required");
      }
      
      if (!LOCATION_NAMES.includes(locationName)) {
        throw new Error(`Invalid locationName. Available options: ${LOCATION_NAMES.join(', ')}`);
      }
      
      // F-C0032-001 is the endpoint for 36-hour weather forecast
      const result = await fetchCWAData('F-C0032-001', { locationName });
      
      return {
        content: [{ type: "text", text: JSON.stringify(result.records, null, 2) }],
      };
    }
  • Input schema definition for get_weather_forecast tool, specifying locationName as required string parameter with description.
    inputSchema: {
      type: "object",
      properties: {
        locationName: {
          type: "string",
          description: "Taiwan county/city name in Traditional Chinese (e.g., 臺北市, 高雄市)"
        }
      },
      required: ["locationName"]
    }
  • cwa-server.js:67-86 (registration)
    Registers the get_weather_forecast tool in the ListToolsRequestSchema handler by returning it in the tools array with name, description, and schema.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [
          {
            name: "get_weather_forecast",
            description: `Get Taiwan weather forecast for the next 36 hours by county/city name. Available locations: ${LOCATION_NAMES.join(', ')}`,
            inputSchema: {
              type: "object",
              properties: {
                locationName: {
                  type: "string",
                  description: "Taiwan county/city name in Traditional Chinese (e.g., 臺北市, 高雄市)"
                }
              },
              required: ["locationName"]
            }
          }
        ],
      };
    });
  • Helper utility function used by the tool to make authenticated requests to the CWA Open Data API, handling API key, errors, and returning parsed data.
    async function fetchCWAData(endpoint, params = {}) {
      const apiKey = process.env.CWA_API_KEY;
      
      if (!apiKey) {
        throw new Error('CWA API key not set. Set the CWA_API_KEY environment variable.');
      }
    
      const url = `${API_BASE_URL}/${endpoint}`;
      
      try {
        const response = await axios.get(url, {
          params: {
            ...params,
            Authorization: apiKey
          }
        });
    
        if (response.status !== 200) {
          throw new Error(`CWA API Error: ${response.status} ${response.statusText}`);
        }
    
        return response.data;
      } catch (error) {
        throw new Error(`Error fetching CWA data: ${error.message}`);
      }
    }
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 describes what the tool does but lacks details on behavioral traits such as rate limits, error handling, authentication needs, or what the output format looks like. This leaves gaps in understanding how the tool behaves beyond its basic function.

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 appropriately sized and front-loaded, starting with the core purpose and followed by essential details (time frame and locations). Every sentence earns its place by providing necessary information without redundancy, making it efficient and easy to understand.

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 low complexity (one parameter, no output schema, no annotations), the description is complete enough for basic usage but lacks details on output format and behavioral aspects. It covers the what and where adequately but falls short on how the tool behaves and what results to expect.

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 parameter 'locationName' fully documented in the schema. The description adds value by listing all available locations, which provides semantic context beyond the schema's generic description, but does not elaborate further on parameter usage or constraints.

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

Purpose5/5

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

The description clearly states the specific action ('Get Taiwan weather forecast'), resource ('weather forecast'), scope ('next 36 hours'), and geographical constraint ('by county/city name'). It distinguishes itself by specifying the exact time range and available locations, making the purpose unambiguous and comprehensive.

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

Usage Guidelines4/5

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

The description provides clear context for when to use this tool by specifying the geographical scope (Taiwan), time frame (next 36 hours), and available locations. However, it does not mention when not to use it or any alternatives, as there are no sibling tools provided, so explicit exclusions are not necessary but could be implied.

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/lincw/cwa-mcp-server'

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