get_cached_files
Retrieve all cached design files from the Penpot MCP Server to access previously loaded content for analysis and workflow automation.
Instructions
List all files currently stored in the cache.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- penpot_mcp/server/mcp_server.py:395-398 (handler)The handler function for the 'get_cached_files' tool. It returns the list of all cached files by calling MemoryCache.get_all_cached_files().@self.mcp.tool() def get_cached_files() -> dict: """List all files currently stored in the cache.""" return self.file_cache.get_all_cached_files()
- penpot_mcp/utils/cache.py:61-84 (helper)The MemoryCache.get_all_cached_files() helper method that retrieves all non-expired cached Penpot files, cleaning up expired entries.def get_all_cached_files(self) -> Dict[str, Dict[str, Any]]: """ Get all valid cached files. Returns: Dictionary mapping file IDs to their cached data """ result = {} current_time = time.time() # Create a list of expired keys to remove expired_keys = [] for file_id, cache_data in self._cache.items(): if current_time - cache_data['timestamp'] <= self.ttl_seconds: result[file_id] = cache_data['data'] else: expired_keys.append(file_id) # Remove expired entries for key in expired_keys: del self._cache[key] return result
- penpot_mcp/server/mcp_server.py:395-395 (registration)The @self.mcp.tool() decorator that registers the get_cached_files function as an MCP tool. This is called conditionally if config.RESOURCES_AS_TOOLS is True.@self.mcp.tool()