get_page_info
Retrieve the current page's URL, title, and viewport size for browser state inspection.
Instructions
Get current page URL, title, and viewport size.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The handler function for the get_page_info tool. Gets the active page, retrieves URL, title, and viewport dimensions.
@mcp.tool() async def get_page_info() -> dict: """Get current page URL, title, and viewport size.""" try: page = await browser_manager.get_active_page() viewport = page.viewport_size or {} return { "url": page.url, "title": await page.title(), "viewport_width": viewport.get("width"), "viewport_height": viewport.get("height"), } except Exception as e: return {"error": str(e)} - src/camoufox_reverse_mcp/server.py:15-15 (registration)Registration via import in server.py: the navigation module (containing get_page_info) is imported so that the @mcp.tool() decorator registers it with the FastMCP server.
from .tools import navigation # noqa: E402, F401 — browser control + page interaction - Helper method in BrowserManager used by get_page_info to retrieve the active Playwright page.
async def get_active_page(self) -> Page: """Get the currently active page, launching the browser if needed.""" await self._ensure_browser() if self.active_page_name and self.active_page_name in self.pages: return self.pages[self.active_page_name] raise RuntimeError("No active page available. Call launch_browser first.") - src/camoufox_reverse_mcp/tools/navigation.py:356-357 (registration)The @mcp.tool() decorator registers get_page_info as an MCP tool with the FastMCP server.
@mcp.tool() async def get_page_info() -> dict: