Skip to main content
Glama
YunYouJun

Starter MCP Server

by YunYouJun

Weather alerts

get-alerts

Retrieve weather alerts for any U.S. state using two-letter state codes to monitor severe conditions and stay informed about local warnings.

Instructions

Get weather alerts for a state

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
stateYesTwo-letter state code (e.g. CA, NY)

Implementation Reference

  • The handler function that implements the core logic of the 'get-alerts' tool: fetches weather alerts from NWS API for a given state, handles errors and empty results, formats alerts, and returns a markdown text response.
    async ({ state }) => {
      const stateCode = state.toUpperCase()
      const alertsUrl = `${NWS_API_BASE}/alerts?area=${stateCode}`
      const alertsData = await makeNWSRequest<AlertsResponse>(alertsUrl)
    
      if (!alertsData) {
        return {
          content: [
            {
              type: 'text',
              text: 'Failed to retrieve alerts data',
            },
          ],
        }
      }
    
      const features = alertsData.features || []
      if (features.length === 0) {
        return {
          content: [
            {
              type: 'text',
              text: `No active alerts for ${stateCode}`,
            },
          ],
        }
      }
    
      const formattedAlerts = features.map(formatAlert)
      const alertsText = `Active alerts for ${stateCode}:\n\n${formattedAlerts.join('\n')}`
    
      return {
        content: [
          {
            type: 'text',
            text: alertsText,
          },
        ],
      }
    },
  • Zod input schema defining the 'state' parameter as a 2-character string.
    inputSchema: z.object({
      state: z.string().length(2).describe('Two-letter state code (e.g. CA, NY)'),
    }),
  • The server.registerTool call that registers the 'get-alerts' tool with its name, metadata, schema, and handler function.
    server.registerTool(
      'get-alerts',
      {
        title: 'Weather alerts',
        description: 'Get weather alerts for a state',
        inputSchema: z.object({
          state: z.string().length(2).describe('Two-letter state code (e.g. CA, NY)'),
        }),
      },
      async ({ state }) => {
        const stateCode = state.toUpperCase()
        const alertsUrl = `${NWS_API_BASE}/alerts?area=${stateCode}`
        const alertsData = await makeNWSRequest<AlertsResponse>(alertsUrl)
    
        if (!alertsData) {
          return {
            content: [
              {
                type: 'text',
                text: 'Failed to retrieve alerts data',
              },
            ],
          }
        }
    
        const features = alertsData.features || []
        if (features.length === 0) {
          return {
            content: [
              {
                type: 'text',
                text: `No active alerts for ${stateCode}`,
              },
            ],
          }
        }
    
        const formattedAlerts = features.map(formatAlert)
        const alertsText = `Active alerts for ${stateCode}:\n\n${formattedAlerts.join('\n')}`
    
        return {
          content: [
            {
              type: 'text',
              text: alertsText,
            },
          ],
        }
      },
    )
  • src/index.ts:9-9 (registration)
    Invocation of registerGetAlerts() to perform the tool registration when the server starts.
    registerGetAlerts()
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 the tool 'Get weather alerts,' which implies a read-only operation, but does not disclose any behavioral traits such as rate limits, authentication needs, error handling, or what the alerts include (e.g., severity, types). This is a significant gap 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 sentence: 'Get weather alerts for a state.' It is front-loaded with the core purpose, has zero waste, and is appropriately sized for the tool's simplicity. Every word earns its place.

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 lack of annotations and output schema, the description is incomplete. It does not explain what the tool returns (e.g., alert details, format), potential errors, or usage constraints. For a tool with no structured behavioral data, the description should provide more context to aid the agent 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 input schema has 100% description coverage, with the 'state' parameter fully documented in the schema. The description does not add any meaning beyond what the schema provides, as it only mentions 'for a state' without detailing the parameter. Given the high schema coverage, the baseline score of 3 is appropriate, as the schema does the heavy lifting.

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 weather alerts for a state.' It specifies the verb ('Get') and resource ('weather alerts'), and includes a scope ('for a state'). However, it does not explicitly differentiate from its sibling tool 'get-forecast,' which likely provides different weather data, so it misses full sibling differentiation.

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 does not mention the sibling tool 'get-forecast' or any other tools, nor does it specify contexts, prerequisites, or exclusions for usage. This leaves the agent without clear direction on tool selection.

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/YunYouJun/starter-mcp-server'

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