Skip to main content
Glama
jacebenson

AI MCP ServiceNow

by jacebenson

get-weather

Retrieve current weather conditions for any specified city to support planning and decision-making within ServiceNow workflows.

Instructions

Tool to get the weather of a city

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cityYesThe name of the city to get the weather for

Implementation Reference

  • main.ts:43-59 (registration)
    Registration of the 'get-weather' tool using McpServer.tool, including name, description, input schema, and handler.
    server.tool(
        'get-weather',
        'Tool to get the weather of a city',
        {
            city: z.string().describe("The name of the city to get the weather for")
        },
        async ({ city }) => {
            return {
                content: [
                    {
                        type: "text",
                        text: await getWeather({ city })
                    }
                ]
            }
        }
    );
  • main.ts:49-59 (handler)
    The MCP tool handler function that invokes the getWeather helper and returns formatted text content.
        async ({ city }) => {
            return {
                content: [
                    {
                        type: "text",
                        text: await getWeather({ city })
                    }
                ]
            }
        }
    );
  • main.ts:46-48 (schema)
    Zod input schema defining the 'city' parameter as a string.
    {
        city: z.string().describe("The name of the city to get the weather for")
    },
  • Helper function implementing the core weather fetching logic using Open-Meteo APIs for geocoding and forecast data.
    export default async ({ city }) => {
        try {
            const response = await fetch(`https://geocoding-api.open-meteo.com/v1/search?name=${city}&count=10&language=en&format=json`);
            const data = await response.json();
            if (!data.results || data.results.length === 0) {
                return `No results found for city: ${city}`;
            }
            let firstResult = data.results[0];
            const { latitude, longitude } = firstResult;
            //return `Coordinates for ${city}: Latitude: ${latitude}, Longitude: ${longitude}`;
            const weatherResponse = await fetch(`https://api.open-meteo.com/v1/forecast?latitude=${latitude}&longitude=${longitude}&hourly=temperature_2m,precipitation,apparent_temperature,relative_humidity_2m&forecast_days=1`);
            if (!weatherResponse.ok) {
                return `Error fetching weather data: ${weatherResponse.statusText}`;
            }
            return `Weather data for ${city}:\n` +
                `Latitude: ${latitude}, Longitude: ${longitude}\n` +
                `Weather: ${JSON.stringify(await weatherResponse.json(), null, 2)}`;
    
            const weatherData = await weatherResponse.json();
    
            return JSON.stringify(weatherData, null, 2);
        } catch (error) {
            return `Error fetching weather 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. It only states the basic action ('get the weather') without disclosing behavioral traits like error handling, data freshness, rate limits, or authentication needs. This leaves significant gaps 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.

Conciseness4/5

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

The description is a single, efficient sentence with no wasted words, making it appropriately sized and front-loaded. However, it could be more structured (e.g., by including key details) without sacrificing conciseness.

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 simplicity (1 parameter, no output schema, no annotations), the description is incomplete. It lacks details on what weather data is returned (e.g., temperature, conditions), potential errors, or usage context, making it inadequate for full understanding.

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% coverage, clearly documenting the 'city' parameter. The description adds no meaning beyond the schema (e.g., format examples or constraints), so it meets the baseline of 3 where the schema does the heavy lifting.

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

Purpose3/5

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

The description states the tool's purpose ('get the weather of a city') with a clear verb ('get') and resource ('weather'), but it's vague about scope (e.g., current vs. forecast) and lacks sibling tools for differentiation. It's not tautological but lacks specificity beyond the basic function.

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 vs. alternatives, prerequisites, or context. With no sibling tools, it doesn't need to distinguish from others, but it still lacks any usage instructions (e.g., for what scenarios or inputs).

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/jacebenson/ai-mcp-servicenow'

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