Skip to main content
Glama

MySQL Hub MCP Server

by CHOIJun-0613
agent.py1.56 kB
import datetime from zoneinfo import ZoneInfo from google.adk.agents import Agent def get_weather(city: str) -> dict: """Get the current weather in a city.""" if city.lower() == "new york": return { "status": "success", "report": "The weather in New York is sunny with 25°C." } return { "status": "error", "error_message": f"Weather for '{city}' unavailable." } def get_current_time(city: str) -> dict: """Get the current time in a city.""" city_timezones = { "new york": "America/New_York", "london": "Europe/London", "tokyo": "Asia/Tokyo", "paris": "Europe/Paris" } if city.lower() in city_timezones: try: tz = ZoneInfo(city_timezones[city.lower()]) now = datetime.datetime.now(tz) return { "status": "success", "report": f"The current time in {city} is {now.strftime('%Y-%m-%d %H:%M:%S %Z')}" } except Exception: pass return { "status": "error", "error_message": f"Time information for '{city}' unavailable." } # Define the agent with the name "root_agent" (required by ADK) root_agent = Agent( name="weather_time_agent", model="gemini-1.5-flash", # Use your preferred Gemini model description="Agent that provides weather and time information for cities.", instruction="You help users with time and weather information for various cities.", tools=[get_weather, get_current_time], )

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/CHOIJun-0613/mysql-hub-mcp'

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