Skip to main content
Glama

list_events

Retrieve and display upcoming calendar events within specified time ranges and result limits using the Google Toolbox. Simplify event tracking and scheduling.

Instructions

List upcoming calendar events

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
max_resultsNo
time_maxNo
time_minNo

Implementation Reference

  • The main handler function for the 'list_events' tool, decorated with @mcp.tool. It fetches upcoming Google Calendar events within a specified time range using the Google Calendar API, formats them into a list of dictionaries, and handles authentication and errors.
    @mcp.tool(
        name="list_events",
        description="List upcoming calendar events",
    )
    async def list_events(time_min: Optional[str] = None, time_max: Optional[str] = None, max_results: int = 10) -> List[Dict[str, Any]]:
        """
        List upcoming calendar events
        
        Args:
            time_min (str, optional): Start time in ISO format (default: now)
            time_max (str, optional): End time in ISO format (default: now + 1 week)
            max_results (int, optional): Maximum number of events to return (default: 10)
        
        Returns:
            List[Dict[str, Any]]: List of calendar events
            
        """
        creds = get_google_credentials()
        if not creds:
            return "Google authentication failed."
    
        try:
            service = build('calendar', 'v3', credentials=creds)
            now_iso = datetime.datetime.now(datetime.timezone.utc).isoformat()
            time_min = time_min or now_iso
            time_max = time_max or now_iso
    
            events_result = service.events().list(
                calendarId='primary',
                timeMin=time_min,
                timeMax=time_max,
                maxResults=max_results,
                singleEvents=True,
                orderBy='startTime'
            ).execute()
            events = events_result.get('items', [])
            event_list = [
                {
                    'id': event.get('id'),
                    'summary': event.get('summary'),
                    'start': event.get('start', {}).get('dateTime') or event.get('start', {}).get('date'),
                    'end': event.get('end', {}).get('dateTime') or event.get('end', {}).get('date'),
                    'location': event.get('location'),
                    'description': event.get('description'),
                } for event in events
            ]
    
            return event_list
    
        except HttpError as error:
            logger.error(f"API 오류 발생: {error}")
            return f"Calendar API 오류: {error.resp.status} - {error.content.decode()}"
        except Exception as e:
            logger.exception("이벤트 목록 조회 중 오류:")
            return f"예상치 못한 오류 발생: {str(e)}"
  • server.py:193-207 (registration)
    A resource that lists all available tools including 'list_events', serving as a tool directory or registration list.
    @mcp.resource(
      uri='google://available-google-tools', 
      name="available-google-tools", 
      description="Returns a list of Google search categories available on this MCP server."
    )
    async def get_available_google_tools() -> List[str]:
        """Returns a list of Google search categories available on this MCP server."""
        available_google_tools = [
            "list_emails", "search_emails", "send_email", "modify_email",
            "list_events", "create_event", "update_event", "delete_event",
            "search_google", "read_gdrive_file", "search_gdrive"
        ]
        logger.info(f"Resource 'get_available_google_tools' 호출됨. 반환: {available_google_tools}")
        return available_google_tools
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool lists events but doesn't cover critical aspects like authentication requirements, rate limits, pagination behavior (implied by 'max_results' but not explained), whether it returns past events, or error conditions. This is a significant gap for a tool that interacts with calendar data.

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 with zero wasted words. It's front-loaded with the core purpose, making it easy to scan and understand quickly. Every word earns its place by conveying essential information.

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

Completeness2/5

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

Given the tool's complexity (interacting with calendar events, 3 parameters), lack of annotations, and no output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., event details, error formats), how to handle the time parameters, or behavioral traits like permissions needed. This leaves the agent under-informed for effective use.

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

Parameters2/5

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

The schema description coverage is 0%, meaning none of the three parameters ('max_results', 'time_max', 'time_min') are documented in the schema. The description adds no information about these parameters—it doesn't explain what 'upcoming' means relative to 'time_min'/'time_max', the format for time values, or the effect of 'max_results'. This fails to compensate for the lack of schema documentation.

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 'List upcoming calendar events' clearly states the verb ('List') and resource ('upcoming calendar events'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'search_google' or 'search_emails' that might also return calendar events, nor does it specify if it lists only the user's events or shared ones.

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 sibling tools like 'search_google' (which might search across Google services including Calendar) or 'update_event' (for modifying events), leaving the agent to guess based on tool names alone.

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

Related 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/jikime/py-mcp-google-toolbox'

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