clear_cache
Clear cached Office document conversions to free disk space or reset the cache for OfficeReader-MCP server.
Instructions
Clear all cached conversions.
Removes all converted markdown files and extracted images from the cache. Use this to free up disk space or reset the conversion cache.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- Core implementation of clear_cache in DocxConverter: removes all cached conversion directories using shutil.rmtree and returns count of cleared items.def clear_cache(self) -> dict: """Clear all cached conversions.""" import shutil cleared = [] for item in self.output_dir.iterdir(): if item.is_dir(): shutil.rmtree(item) cleared.append(str(item)) return { "cleared": cleared, "count": len(cleared), }
- OfficeConverter.clear_cache delegates to the DocxConverter instance's clear_cache method.def clear_cache(self) -> dict: """Clear all cached conversions.""" return self._docx_converter.clear_cache()
- src/officereader_mcp/server.py:128-138 (registration)MCP tool registration for 'clear_cache' with description and empty inputSchema (no parameters required).Tool( name="clear_cache", description="""Clear all cached conversions. Removes all converted markdown files and extracted images from the cache. Use this to free up disk space or reset the conversion cache.""", inputSchema={ "type": "object", "properties": {}, }, ),
- src/officereader_mcp/server.py:292-303 (handler)Top-level handler dispatch in call_tool: invokes converter.clear_cache() and constructs the TextContent response with success details.elif name == "clear_cache": result = converter.clear_cache() response = { "status": "success", "cache_location": str(converter.cache_dir), "cleared_count": result["count"], "cleared_directories": result["cleared"], } return [TextContent( type="text", text=f"{cache_notice}\n\nCache cleared successfully!\n\n" + json.dumps(response, ensure_ascii=False, indent=2) )]