clear_cache
Clear the persistent device cache to resolve issues with changed or corrupted devices. Run scan_network afterward to rebuild the cache.
Instructions
Clear the persistent device cache.
Removes the cache file and clears in-memory cache. Useful when devices have changed or cache is corrupted. Run scan_network after clearing to rebuild the cache.
Returns
Dictionary containing:
- success: Whether cache was cleared successfully
- message: Descriptive messageInput Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/wemo_mcp_server/server.py:606-643 (handler)The `clear_cache` tool clears both the persistent device cache (via `_cache_manager`) and the in-memory `_device_cache` dictionary.
@mcp.tool() async def clear_cache() -> dict[str, Any]: """Clear the persistent device cache. Removes the cache file and clears in-memory cache. Useful when devices have changed or cache is corrupted. Run scan_network after clearing to rebuild the cache. Returns ------- Dictionary containing: - success: Whether cache was cleared successfully - message: Descriptive message """ try: # Clear persistent cache cache_cleared = _cache_manager.clear() # Clear in-memory cache _device_cache.clear() if cache_cleared: return { "success": True, "message": "Cache cleared successfully. Run scan_network to rebuild cache.", "timestamp": time.time(), } return { "success": False, "error": "Failed to clear cache file", "timestamp": time.time(), } except Exception as e: logger.error(f"Error clearing cache: {e}", exc_info=True) return build_error_response(e, "Clear cache")