Skip to main content
Glama

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 message

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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")
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It discloses key behavioral traits: it's destructive ('Removes the cache file and clears in-memory cache'), has side effects (requires follow-up scan), and returns a success status. However, it doesn't mention potential risks (e.g., temporary performance impact) or permissions needed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the core purpose, followed by details and usage guidance in three concise sentences. The 'Returns' section is structured but necessary since there's no output schema. Every sentence adds value without redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 0 parameters, no annotations, and no output schema (context signals indicate 'Has output schema: true', but it's not provided here, so we assume it's missing), the description is complete: it explains what the tool does, when to use it, behavioral effects, and return values. It compensates well for the lack of structured data.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

There are 0 parameters, and schema description coverage is 100%, so the baseline is 4. The description doesn't need to add parameter info, and it correctly indicates no inputs are required by not mentioning any.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Clear the persistent device cache') and distinguishes it from siblings like 'get_cache_info' (which reads cache) and 'scan_network' (which rebuilds cache). It uses precise verbs ('Removes', 'clears') and identifies the resource ('device cache').

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly provides when to use ('Useful when devices have changed or cache is corrupted') and what to do after ('Run scan_network after clearing to rebuild the cache'). It distinguishes from 'scan_network' by specifying the sequence, and from 'get_cache_info' by contrasting clear vs. read operations.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/apiarya/wemo-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server