clear_cache
Clear cached documentation data to ensure fresh, up-to-date information is retrieved from official sources.
Instructions
Clear the documentation cache to force fresh fetches.
Returns:
Status message about cache clearing
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The MCP tool handler function for 'clear_cache'. It clears the SimpleCache instance if caching is enabled and returns a status message with the number of entries cleared.@mcp.tool() async def clear_cache(): """ Clear the documentation cache to force fresh fetches. Returns: Status message about cache clearing """ if cache: entries_cleared = await cache.clear() return f"Cache cleared. Removed {entries_cleared} cached entries." else: return "Caching is not enabled."
- The 'clear' method of the SimpleCache class, invoked by the clear_cache tool handler to remove all cached entries and persist the empty state if persistence is enabled.async def clear(self) -> int: async with self._lock: removed = len(self.cache) self.cache.clear() await self._persist_locked()
- src/documentation_search_enhanced/main.py:775-775 (registration)The @mcp.tool() decorator registers the clear_cache function as an MCP tool.@mcp.tool()