Skip to main content
Glama

get_upcoming_events

Find upcoming music events in a specific city within a date range. Filter results by keyword to discover concerts and shows.

Instructions

Get upcoming music events for a city.

Args: city: City in which to search for events. start_dttm_str: Start date/time in ISO 8601 format (YYYY-MM-DDTHH:MM:SSZ). Example: 2025-02-08T00:00:00Z end_dttm_str: Start date/time in ISO 8601 format (YYYY-MM-DDTHH:MM:SSZ). Example: 2025-02-10T00:00:00Z keyword: Any optional keywords to help filter search results.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cityYes
start_dttm_strYes
end_dttm_strYes
keywordNo

Implementation Reference

  • The main handler function for the 'get_upcoming_events' tool, registered via @mcp.tool() decorator. It fetches events using EventsApiClient and formats them with format_events.
    @mcp.tool()
    async def get_upcoming_events(city: str, start_dttm_str: str, end_dttm_str: str, keyword: str | None = None) -> str:
        """
        Get upcoming music events for a city.
        
        Args:
            city: City in which to search for events.
            start_dttm_str: Start date/time in ISO 8601 format (YYYY-MM-DDTHH:MM:SSZ). Example: 2025-02-08T00:00:00Z
            end_dttm_str: Start date/time in ISO 8601 format (YYYY-MM-DDTHH:MM:SSZ). Example: 2025-02-10T00:00:00Z
            keyword: Any optional keywords to help filter search results.
        """
    
        data = await EventsApiClient().fetch_events(city=city, start_dttm_str=start_dttm_str, end_dttm_str=end_dttm_str, keyword=keyword)
    
        return format_events(data)
  • Helper method in EventsApiClient that performs the actual API call to Ticketmaster to fetch upcoming events based on parameters.
    async def fetch_events(
        self,
        city: str,
        start_dttm_str: str,
        end_dttm_str: str,
        classification_name: str = "Music",
        keyword: str | None = None,
    ) -> dict | None:
        async with httpx.AsyncClient() as client:
            try:
                params = {
                    "apikey": self.api_key,
                    "city": city,
                    "startDateTime": start_dttm_str,
                    "endDateTime": end_dttm_str,
                    "classificationName": classification_name,
                    "size": 100,
                }
                if keyword:
                    params["keyword"] = keyword
                response = await client.get(
                    f"{self.base_url}/events.json",
                    params=params,
                    timeout=30.0,
                )
                response.raise_for_status()
                return response.json()
            except Exception:
                return None
  • Helper function that formats the raw events data from the API into a human-readable string with details for each event.
    def format_events(response_dict: dict) -> str:
        if not response_dict:
            return "No events found!"
    
        return "\n\n".join(
            [
                f"""
    Name: {event.get("name")}
    Link: {event.get("url")}
    Event Datetime: {event.get("dates")["start"]["dateTime"]}
    Genres: {", ".join(set(c["genre"]["name"] for c in event.get("classifications")))}
    Info: {event.get("info")}
    Venue: {event.get("_embedded")["venues"][0]["name"]}
    """
                for event in response_dict["_embedded"]["events"]
            ]
        )
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/mmmaaatttttt/mcp-live-events'

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