get_weather
Retrieve current weather conditions for any location by providing a city, address, or other details using Google Maps MCP Server functionality.
Instructions
Gets the current weather.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| location | Yes | The location to get weather for (city, address, etc.) |
Implementation Reference
- src/index.ts:86-95 (handler)The handler function that implements the get_weather tool logic, returning mock weather data for the given location.async function handleGetWeather(location: string) { return { content: [{ type: "text", text: `Weather in ${location}: Sunny, 75 degrees Fahrenheit.` }], isError: false }; }
- src/index.ts:22-35 (schema)Defines the tool schema including name, description, and input validation schema requiring a 'location' string.const GET_WEATHER_TOOL: Tool = { name: "get_weather", description: "Gets the current weather.", inputSchema: { type: "object", properties: { location: { type: "string", description: "The location to get weather for (city, address, etc.)" } }, required: ["location"] }, };
- src/index.ts:77-82 (registration)Registers the get_weather tool (via GET_WEATHER_TOOL) in the array of available tools returned by the listTools handler.const SIMPLE_TOOLS = [ GET_WEATHER_TOOL, ADD_POST_TOOL, GET_POSTS_TOOL, DELETE_POST_TOOL, ] as const;
- src/index.ts:181-184 (registration)Registers the dispatch from CallToolRequest for 'get_weather' to the handleGetWeather function.case "get_weather": { const { location } = request.params.arguments as { location: string }; return await handleGetWeather(location); }