Skip to main content
Glama

get_calendar_events

Retrieve scheduled events from Google Calendar by specifying date ranges, calendar selection, and result limits to view upcoming meetings and appointments.

Instructions

Get events from a specific Google Calendar

Args: calendar_id: Calendar ID (default: primary) time_min: Lower bound for event start time (ISO format) time_max: Upper bound for event start time (ISO format) max_results: Maximum number of events to return (default: 10)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
calendar_idNoprimary
time_minNo
time_maxNo
max_resultsNo

Implementation Reference

  • main.py:338-367 (handler)
    MCP tool handler for 'get_calendar_events'. Registers the tool and handles input parameters, delegates to GoogleCalendarTools.get_calendar_events, serializes result to JSON.
    @mcp.tool()
    def get_calendar_events(
        calendar_id: str = "primary",
        time_min: Optional[str] = None,
        time_max: Optional[str] = None,
        max_results: int = 10
    ) -> str:
        """
        Get events from a specific Google Calendar
        
        Args:
            calendar_id: Calendar ID (default: primary)
            time_min: Lower bound for event start time (ISO format)
            time_max: Upper bound for event start time (ISO format)
            max_results: Maximum number of events to return (default: 10)
        """
        try:
            result = GoogleCalendarTools.get_calendar_events(
                NANGO_CONNECTION_ID, NANGO_INTEGRATION_ID, calendar_id, time_min, time_max, max_results
            )
            
            return json.dumps(result, indent=2)
        except Exception as e:
            logger.error(f"Error in get_calendar_events: {e}")
            return json.dumps({
                "success": False,
                "error": str(e),
                "message": "Failed to retrieve calendar events"
            }, indent=2)
  • Core helper function in GoogleCalendarTools class that implements the actual Google Calendar API logic for fetching, formatting events, and error handling.
    @staticmethod
    def get_calendar_events(connection_id: str, provider_config_key: str, calendar_id: str = "primary", 
                           time_min: Optional[str] = None, time_max: Optional[str] = None,
                           max_results: int = 10) -> Dict:
        """Get events from Google Calendar with flexible filtering"""
        try:
            service = GoogleCalendarAuth.authenticate_google_calendar(connection_id, provider_config_key)
            
            params = {
                'calendarId': calendar_id,
                'maxResults': max_results,
                'singleEvents': True,
                'orderBy': 'startTime'
            }
            
            if time_min:
                params['timeMin'] = time_min
            if time_max:
                params['timeMax'] = time_max
            
            events_result = service.events().list(**params).execute()
            events = events_result.get('items', [])
            
            # Format events for better usability
            formatted_events = []
            for event in events:
                formatted_event = {
                    'id': event.get('id'),
                    'summary': event.get('summary', 'No Title'),
                    'description': event.get('description', ''),
                    'start': event.get('start', {}),
                    'end': event.get('end', {}),
                    'location': event.get('location', ''),
                    'status': event.get('status', ''),
                    'created': event.get('created'),
                    'updated': event.get('updated'),
                    'html_link': event.get('htmlLink'),
                    'calendar_id': calendar_id
                }
                formatted_events.append(formatted_event)
            
            return {
                "success": True,
                "events": formatted_events,
                "total_events": len(formatted_events),
                "calendar_id": calendar_id,
                "message": f"Retrieved {len(formatted_events)} events successfully"
            }
            
        except HttpError as error:
            logger.error(f'HTTP error in get_calendar_events: {error}')
            return {
                "success": False,
                "message": f"HTTP error occurred: {error}",
                "error": f"http_error_{error.resp.status if hasattr(error, 'resp') else 'unknown'}",
                "calendar_id": calendar_id
            }
        except Exception as error:
            logger.error(f'Unexpected error in get_calendar_events: {error}')
            return {
                "success": False,
                "message": f"Unexpected error occurred: {str(error)}",
                "error": "unexpected_error",
                "calendar_id": calendar_id
            }
  • Input schema defined by function parameters and docstring in the MCP tool handler.
    def get_calendar_events(
        calendar_id: str = "primary",
        time_min: Optional[str] = None,
        time_max: Optional[str] = None,
        max_results: int = 10
    ) -> str:
        """
        Get events from a specific Google Calendar
        
        Args:
            calendar_id: Calendar ID (default: primary)
            time_min: Lower bound for event start time (ISO format)
            time_max: Upper bound for event start time (ISO format)
            max_results: Maximum number of events to return (default: 10)
        """
  • main.py:338-338 (registration)
    Registration of the 'get_calendar_events' tool using FastMCP @mcp.tool() decorator.
    @mcp.tool()
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but provides minimal behavioral context. It mentions default values and ISO format requirements, but doesn't disclose important behaviors like authentication needs, rate limits, error handling, pagination, or what happens when time_min/time_max are null. For a read operation with zero annotation coverage, this leaves significant gaps.

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?

Well-structured with a clear purpose statement followed by parameter explanations. The Args section is organized but could be more front-loaded with critical usage information. No wasted sentences, though additional context would improve completeness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 4-parameter read tool with no annotations and no output schema, the description covers basic parameter semantics but lacks important context: no output format description, no authentication/error handling disclosure, and insufficient differentiation from sibling tools. It's minimally adequate but has clear gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description compensates well by explaining all 4 parameters: calendar_id (with default), time_min/time_max (ISO format requirements), and max_results (with default). It adds meaningful context beyond the bare schema titles, though it could provide more detail about calendar_id format or time range behavior.

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 'Get events from a specific Google Calendar' which specifies the verb (get), resource (events), and target (Google Calendar). It distinguishes from siblings like 'get_all_calendars' (which lists calendars) and 'get_today_events'/'get_upcoming_events' (which have implicit time ranges), but doesn't explicitly contrast with them.

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?

No guidance on when to use this tool versus alternatives like 'get_today_events' or 'get_upcoming_events'. The description mentions filtering by time range and calendar, but doesn't explain when this granular control is preferable over the simpler sibling tools.

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/Shameerpc5029/google-calendar-mcp'

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