clear_saved_cookies
Remove stored authentication cookies to reset browser session state and resolve login issues when collecting KPI daily reports.
Instructions
清除已保存的 Cookie
Returns: 清除结果
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"properties": {},
"type": "object"
}
Implementation Reference
- server.py:301-318 (handler)The tool handler function for 'clear_saved_cookies'. Decorated with @mcp.tool() for registration. Creates CookieManager and calls its clear_cookies() method, returning success or error message.@mcp.tool() async def clear_saved_cookies() -> str: """ 清除已保存的 Cookie Returns: 清除结果 """ manager = CookieManager() try: if manager.clear_cookies(): return safe_text("✓ Cookie 已清除") else: return safe_text("❌ 清除失败") except Exception as e: return safe_text(f"清除失败: {str(e)}")
- cookie_manager.py:96-110 (helper)The supporting CookieManager.clear_cookies() method that performs the actual file deletion of the saved cookies.json file.def clear_cookies(self) -> bool: """ 清除保存的 Cookie Returns: 是否清除成功 """ if os.path.exists(self.cookie_file): try: os.remove(self.cookie_file) return True except Exception as e: print(f"清除 Cookie 失败: {e}") return False return True