screenshot
Take a screenshot of the current page to record visual state for QA verification.
Instructions
Take a screenshot of the current page.
Args: name: Name for the screenshot file (without extension)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | screenshot |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- argus/mcp_server.py:427-437 (handler)The MCP tool handler function for 'screenshot'. It requires an active session, captures the current step, calls _auto_screenshot, and returns the saved path.
@mcp.tool() async def screenshot(name: str = "screenshot") -> str: """Take a screenshot of the current page. Args: name: Name for the screenshot file (without extension) """ s = _require_session() last_step = s.steps[-1] if s.steps else "Initial state" path = await _auto_screenshot(s, name, last_step) return f"Screenshot saved: {path}" - argus/mcp_server.py:152-162 (helper)Helper function _auto_screenshot that increments the counter, constructs a safe filename, calls the browser's screenshot method, and records the Screenshot in the session.
async def _auto_screenshot(s: Session, name: str, step: str) -> str: """Take a screenshot and register it in the session.""" s._screenshot_counter += 1 safe_name = f"{s._screenshot_counter:03d}_{name}" path = str(Path(_output_dir()) / "screenshots" / f"{safe_name}.png") await s.browser.screenshot(path) url = s.browser._page.url if s.browser._page else "" s.screenshots.append(Screenshot( path=path, name=safe_name, step=step, url=url, )) return path - argus/browser.py:371-374 (helper)The BrowserDriver.screenshot method which uses Playwright to capture a full-page screenshot to disk, creating parent directories as needed.
async def screenshot(self, path: str) -> str: Path(path).parent.mkdir(parents=True, exist_ok=True) await self._page.screenshot(path=path, full_page=False) return path - argus/models.py:109-115 (schema)The Screenshot dataclass model that stores metadata about each captured screenshot (path, name, step, url, timestamp).
class Screenshot: path: str name: str step: str url: str timestamp: datetime = field(default_factory=datetime.now) - argus/mcp_server.py:34-35 (registration)The MCP server registration (FastMCP instance). The screenshot tool is registered via the @mcp.tool() decorator on line 427.
mcp = FastMCP( "argus",