Skip to main content
Glama

get_all_calendars

Retrieve all Google Calendars accessible to your account to view and manage your schedule across multiple calendars.

Instructions

Get all Google Calendars accessible to the user

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • main.py:106-137 (handler)
    Core handler logic: Authenticates with Google Calendar service via Nango, fetches all calendars using paginated API calls with optimized field selection, handles HTTP and unexpected errors.
    def get_all_calendars(connection_id: str, provider_config_key: str) -> List[Dict]:
        """Get all calendars with optimized field selection"""
        try:
            service = GoogleCalendarAuth.authenticate_google_calendar(connection_id, provider_config_key)
            
            calendars = []
            page_token = None
            
            fields = "nextPageToken,items(id,summary,description,primary,accessRole,backgroundColor,foregroundColor,timeZone)"
            
            while True:
                request_params = {'fields': fields}
                if page_token:
                    request_params['pageToken'] = page_token
                
                calendar_list = service.calendarList().list(**request_params).execute()
                
                page_calendars = calendar_list.get('items', [])
                calendars.extend(page_calendars)
                
                page_token = calendar_list.get('nextPageToken')
                if not page_token:
                    break
            
            return calendars
        
        except HttpError as error:
            logger.error(f'HTTP error in get_all_calendars: {error}')
            raise
        except Exception as error:
            logger.error(f'Unexpected error in get_all_calendars: {error}')
            raise
  • main.py:317-337 (registration)
    MCP tool registration via @mcp.tool() decorator. Thin wrapper that invokes core handler with hardcoded connection IDs and formats response as JSON string.
    def get_all_calendars() -> str:
        """Get all Google Calendars accessible to the user"""
        try:
            calendars = GoogleCalendarTools.get_all_calendars(NANGO_CONNECTION_ID, NANGO_INTEGRATION_ID)
            
            result = {
                "success": True,
                "calendars": calendars,
                "total_calendars": len(calendars),
                "message": f"Retrieved {len(calendars)} calendars successfully"
            }
            
            return json.dumps(result, indent=2)
        except Exception as e:
            logger.error(f"Error in get_all_calendars: {e}")
            return json.dumps({
                "success": False,
                "error": str(e),
                "message": "Failed to retrieve calendars"
            }, indent=2)
  • Tool docstring providing description used for schema/input schema in MCP/FastMCP.
    """Get all Google Calendars accessible to the user"""
  • main.py:68-97 (helper)
    Supporting authentication helper used by the handler to obtain Google Calendar service instance from Nango credentials.
    def authenticate_google_calendar(connection_id: str, provider_config_key: str):
        """Authenticate using Nango credentials and return Google Calendar service object"""
        try:
            # Get credentials from Nango
            nango_response = GoogleCalendarAuth.get_connection_credentials(connection_id, provider_config_key)
            
            # Extract credentials from Nango response
            credentials_data = nango_response.get('credentials', {})
            
            # Create Google OAuth2 credentials object
            creds = Credentials(
                token=credentials_data.get('access_token'),
                refresh_token=credentials_data.get('refresh_token'),
                token_uri='https://oauth2.googleapis.com/token',
                client_id=credentials_data.get('client_id'),
                client_secret=credentials_data.get('client_secret'),
                scopes=SCOPES
            )
            
            # Refresh token if needed
            if not creds.valid:
                if creds.expired and creds.refresh_token:
                    creds.refresh(Request())
                else:
                    raise Exception("Invalid credentials and no refresh token available")
            
            # Build and return the service
            service = build('calendar', 'v3', credentials=creds)
            return service
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 of behavioral disclosure. It states the action but doesn't describe traits like whether this is a read-only operation, potential rate limits, authentication requirements, or the format of returned data. 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.

Conciseness5/5

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

The description is a single, efficient sentence that directly states the tool's purpose without any wasted words. It is appropriately sized and front-loaded, making it easy for an agent to parse quickly.

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?

Given the tool's simplicity (0 parameters, no output schema, no annotations), the description is minimally adequate. It states what the tool does but lacks details on behavioral traits and usage context, which are important for completeness even in simple cases. It meets the basic requirement 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?

The input schema has 0 parameters with 100% coverage, so there are no parameters to document. The description doesn't need to add parameter semantics, and it correctly avoids mentioning any. A baseline of 4 is appropriate as it doesn't mislead or omit necessary parameter info.

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 the verb ('Get') and resource ('all Google Calendars accessible to the user'), making the purpose unambiguous. It doesn't explicitly differentiate from sibling tools like 'get_calendar_events' or 'get_today_events', which focus on events rather than calendars, so it misses full sibling distinction.

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 versus alternatives. It doesn't mention prerequisites, such as authentication needs, or compare it to other calendar-related tools in the sibling list, leaving the agent to infer usage context.

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