Skip to main content
Glama

get_pending_events

Retrieve upcoming events and deadlines from Moodle calendar to track academic schedules and manage course requirements.

Instructions

Get upcoming events and deadlines from Moodle calendar.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • main.py:143-151 (handler)
    MCP tool handler that invokes the client method and formats events as list of dicts with error handling.
    def tool_get_pending_events() -> List[Dict[str, str]]:
        try:
            events = muster_client.get_pending_events()
            return [
                {"name": event.name, "course": event.course, "due_date": event.due_date, "url": event.url}
                for event in events
            ]
        except Exception as e:
            return [{"error": f"Failed to get pending events: {str(e)}"}]
  • Core implementation in MUSTerClient: authenticates, navigates to Moodle upcoming events, parses each event container with Selenium selectors, extracts details into Event dataclass instances.
    def get_pending_events(self) -> List[Event]:
        """Get all pending events and assignment deadlines with detailed information."""
        
        self._ensure_driver()
        self.heartBeat()
        if not self.logged_in:
            if not self.login():
                raise Exception("Login required to get events.")
    
        events = []
        try:
            # Navigate to upcoming events page
            self.driver.get(f"{MOODLE_URL}/calendar/view.php?view=upcoming")
    
            # Wait for events to load
            WebDriverWait(self.driver, 10).until(
                EC.presence_of_element_located((By.CSS_SELECTOR, "[data-type='event']"))
            )
    
            # Find all event containers
            event_elements = self.driver.find_elements(By.CSS_SELECTOR, "[data-type='event']")
    
            for element in event_elements:
                try:
                    # Extract event name from header
                    event_name = ""
                    try:
                        event_name = element.find_element(By.CSS_SELECTOR, "h3.name").text.strip()
                    except Exception:
                        # Fallback to data attribute
                        event_name = element.get_attribute("data-event-title") or ""
    
                    if not event_name:
                        continue
    
                    # Extract due date/time
                    due_date = ""
                    try:
                        # Find the row containing the "When" icon
                        date_row = element.find_element(By.XPATH, ".//div[@class='row'][.//i[@title='When']]")
                        date_col = date_row.find_element(By.CSS_SELECTOR, ".col-11")
                        due_date = date_col.text.strip()
                    except Exception:
                        pass
    
                    # Extract event type
                    event_type = ""
                    try:
                        # Find the row containing the "Event type" icon
                        type_row = element.find_element(By.XPATH, ".//div[@class='row mt-1'][.//i[@title='Event type']]")
                        type_col = type_row.find_element(By.CSS_SELECTOR, ".col-11")
                        event_type = type_col.text.strip()
                    except Exception:
                        # Fallback to data attribute
                        event_type = element.get_attribute("data-event-eventtype") or "unknown"
    
                    # Extract course name and URL
                    course_name = ""
                    course_url = ""
                    try:
                        # Find the row containing the "Course" icon
                        course_row = element.find_element(By.XPATH, ".//div[@class='row mt-1'][.//i[@title='Course']]")
                        course_link = course_row.find_element(By.CSS_SELECTOR, ".col-11 a")
                        course_name = course_link.text.strip()
                        course_url = course_link.get_attribute("href") or ""
                    except Exception:
                        pass
    
                    # Extract description (if available)
                    description = ""
                    try:
                        desc_element = element.find_element(By.CSS_SELECTOR, ".description-content")
                        description = desc_element.text.strip()
                    except Exception:
                        pass
    
                    # Extract activity URL
                    activity_url = ""
                    try:
                        activity_link = element.find_element(By.CSS_SELECTOR, ".card-footer a.card-link")
                        activity_url = activity_link.get_attribute("href") or ""
                    except Exception:
                        pass
    
                    # Create Event object
                    event = Event(
                        name=event_name,
                        due_date=due_date,
                        event_type=event_type,
                        course=course_name,
                        course_url=course_url,
                        url=activity_url,
                        description=description
                    )
                    events.append(event)
    
                except Exception as e:
                    print(f"Error parsing individual event: {e}")
                    continue
    
        except TimeoutException:
            print("Timeout while waiting for events to load")
        except Exception as e:
            print(f"Error retrieving pending events: {e}")
    
        self.heartBeat()
        return events
  • main.py:45-48 (registration)
    Tool registration in list_muster_tools(): defines name, description, and empty input schema (no parameters).
    Tool(
        name="get_pending_events",
        description="Get upcoming events and deadlines from Moodle calendar.",
        inputSchema={"type": "object", "properties": {}, "required": []},
  • Output data structure defining fields for each pending event returned by the handler.
    class Event:
        name: str
        due_date: str
        event_type: str
        course: str
        course_url: str
        url: str = ""
        description: str = ""
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 what the tool does but lacks details on traits like whether it's read-only, requires authentication, has rate limits, or what the output format might be. This is inadequate for a tool with zero 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 front-loads the core purpose with zero wasted words. It's appropriately sized for a simple tool with no parameters, 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.

Completeness2/5

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

Given the lack of annotations and output schema, the description is incomplete. It doesn't explain what the return values might be (e.g., event details, deadlines), behavioral aspects like authentication needs, or how it differs from sibling tools. For a tool with no structured data support, this leaves significant 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 tool has 0 parameters, and schema description coverage is 100%, so there's no need for parameter details in the description. The baseline for this scenario is 4, as the description doesn't need to compensate for any parameter gaps, and it correctly implies no inputs are required.

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 action ('Get') and resource ('upcoming events and deadlines from Moodle calendar'), making the purpose immediately understandable. It doesn't differentiate from sibling tools like 'get_class_schedule' or 'get_course_content', which might also involve calendar data, so it doesn't reach the highest score for 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 like 'get_class_schedule' or 'get_course_content', which might overlap in functionality. There's no mention of prerequisites, context, or exclusions, leaving the agent with minimal usage direction.

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/Cosmostima/MUSTer_MCP'

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