cache_info
View cache statistics or clear the cache. Returns JSON with stats or clear result.
Instructions
Shows cache statistics or clears the cache Args: clear: True - clears the cache, False - shows statistics.
Returns: JSON with cache stats or clear result.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| clear | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- tools/cache_tool.py:3-17 (handler)The async function that implements the cache_info tool logic. Accepts a 'clear' boolean parameter. If clear=True, clears the cache and returns removed_entries count. Otherwise returns cache stats as JSON.
async def cache_info(clear: bool = False) -> str: """ Shows cache statistics or clears the cache Args: clear: True - clears the cache, False - shows statistics. Returns: JSON with cache stats or clear result. """ if clear: removed = cache.clear() return json.dumps({"cleared": True, "removed_entries": removed}, ensure_ascii=True, indent=2) return json.dumps(cache.stats(), ensure_ascii=True, indent=2) - tools/cache_tool.py:3-17 (schema)The function signature defines the input schema: a single optional boolean parameter 'clear' (default False). Return type is str (JSON).
async def cache_info(clear: bool = False) -> str: """ Shows cache statistics or clears the cache Args: clear: True - clears the cache, False - shows statistics. Returns: JSON with cache stats or clear result. """ if clear: removed = cache.clear() return json.dumps({"cleared": True, "removed_entries": removed}, ensure_ascii=True, indent=2) return json.dumps(cache.stats(), ensure_ascii=True, indent=2) - tools/__init__.py:6-6 (helper)cache_info is re-exported from tools package via tools/__init__.py on line 6.
from .cache_tool import cache_info