Skip to main content
Glama

flush_cache

Clear the Pi-hole DNS cache to resolve outdated DNS entries and restore fresh resolution.

Instructions

Flush the Pi-hole DNS cache.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The 'flush_cache' tool handler function. It calls client.post('/action/flush/cache') to flush the Pi-hole DNS cache.
    async def flush_cache() -> dict:
        """Flush the Pi-hole DNS cache."""
        return await client.post("/action/flush/cache")
  • The 'register' function in maintenance.py registers all tools (including flush_cache) via @mcp.tool() decorators. flush_cache is registered at line 14.
    def register(mcp: FastMCP, client: PiholeClient) -> int:
        @mcp.tool()
        async def update_gravity() -> dict:
            """Refresh Pi-hole gravity (adlist database). Takes a minute or more to complete."""
            return await client.post("/action/gravity")
    
        @mcp.tool()
        async def flush_cache() -> dict:
            """Flush the Pi-hole DNS cache."""
            return await client.post("/action/flush/cache")
    
        @mcp.tool()
        async def flush_logs() -> dict:
            """Clear the Pi-hole query log."""
            return await client.post("/action/flush/logs")
    
        @mcp.tool()
        async def get_tail_log(
            lines: int = 100,
            log: Literal["dnsmasq", "ftl", "webserver"] = "dnsmasq",
        ) -> dict:
            """Get the tail of a Pi-hole log file. log must be one of 'dnsmasq', 'ftl', 'webserver'."""
            return await client.get(f"/logs/{log}", params={"lines": lines})
    
        return 4
  • The register_all() function that calls maintenance.register() to register the flush_cache tool on the FastMCP server.
    def register_all(mcp: FastMCP, client: PiholeClient) -> int:
        """Register every tool module against the FastMCP instance. Returns tool count."""
        count = 0
        for module in (stats, queries, blocking, domains, local_dns, maintenance):
            count += module.register(mcp, client)
        return count
  • The PiholeClient.post() helper method used by flush_cache to make the HTTP POST request to the Pi-hole API.
    async def post(self, path: str, *, json: Any | None = None) -> Any:
        return await self.request("POST", path, json=json)
Behavior2/5

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

No annotations are provided, so the description must disclose behavior. It only states the action without explaining what flushing entails (e.g., destructive to cache, impact on performance, or if it requires admin privileges).

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?

The description is a single concise sentence with no unnecessary words. It is front-loaded and efficient.

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

Completeness3/5

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

Given the simplicity (no parameters, output schema exists), the description is minimally adequate. However, it lacks any contextual hints about when to invoke it or what the output represents, leaving some uncertainty.

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?

The input schema has no parameters, so the description does not need to add parameter info. With zero parameters, the baseline is 4, and the description is adequate.

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 action (flush) and the resource (Pi-hole DNS cache). It is distinct from sibling tools like flush_logs and enable_blocking, so an agent can easily identify its purpose.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool vs alternatives, such as after updating gravity or when troubleshooting cache issues. The description fails to specify prerequisites or side effects.

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/chris2ao/pihole-mcp'

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