clear_saved_cookies
Remove stored authentication cookies to reset browser session state for the KPI daily report collection system.
Instructions
清除已保存的 Cookie
Returns: 清除结果
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- server.py:301-318 (handler)The handler function decorated with @mcp.tool(), which creates a CookieManager instance and calls its clear_cookies method to clear saved cookies, returning success or failure 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 helper method in CookieManager class that deletes the cookies.json file if it exists, returning True on success.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
- server.py:301-301 (registration)The @mcp.tool() decorator registers the clear_saved_cookies function as an MCP tool.@mcp.tool()