open_URL_with_authorization
Open Moodle-protected URLs in an authorized browser window after automatic login to access course materials and resources.
Instructions
Open a URL in a new authorized browser window after Moodle login (show to user).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | Target URL to open after Moodle login |
Implementation Reference
- main.py:161-183 (handler)The main handler function that executes the tool logic by creating a headed browser client, opening the specified URL after ensuring Moodle login, and returning success status with page details.def tool_open_URL_with_authorization(url: str) -> Dict[str, Any]: try: muster_client_with_head = MUSTerClientWithHead() driver = muster_client_with_head.openUrl(url) if driver: current_url = driver.current_url page_title = driver.title return { "success": True, "message": "URL opened successfully with Moodle authorization", "opened_url": url, "current_url": current_url, "page_title": page_title, "note": "A new browser window is now open and logged in. It will remain open until manually closed.", } else: return {"error": "Failed to open URL - driver not initialized"} except Exception as e: return {"error": f"Failed to open URL with authorization: {str(e)}"}
- main.py:68-81 (schema)The tool schema definition including name, description, and input schema (requires 'url' string). Part of the tools list returned by list_muster_tools().Tool( name="open_URL_with_authorization", description="Open a URL in a new authorized browser window after Moodle login (show to user).", inputSchema={ "type": "object", "properties": { "url": { "type": "string", "description": "Target URL to open after Moodle login", } }, "required": ["url"], }, ),
- main.py:215-216 (registration)Tool dispatch/registration in the @server.call_tool() handler, mapping the tool name to its handler function.if name == "open_URL_with_authorization": return _wrap_json(tool_open_URL_with_authorization(args["url"]))
- MUSTerClient.py:112-118 (helper)Core helper method in MUSTerClientWithHead class that ensures login and navigates to the URL using Selenium WebDriver, returning the driver instance.def openUrl(self, url: str): if not self.logged_in: if not self.login(): raise Exception("Failed to login to Moodle") self.driver.get(url) return self.driver