Skip to main content
Glama

disable_blocking

Temporarily or indefinitely disable DNS blocking to allow unfiltered access. Specify a duration in seconds for automatic re-enablement.

Instructions

Disable DNS blocking. If duration_seconds is given, re-enables after that timer; otherwise indefinite.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
duration_secondsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The 'disable_blocking' tool handler function. It is an async function registered as an MCP tool that sends a POST to /dns/blocking with {"blocking": false} and optionally includes a "timer" field if duration_seconds is provided.
    @mcp.tool()
    async def disable_blocking(duration_seconds: int | None = None) -> dict:
        """Disable DNS blocking. If duration_seconds is given, re-enables after that timer; otherwise indefinite."""
        body: dict = {"blocking": False}
        if duration_seconds is not None:
            body["timer"] = duration_seconds
        return await client.post("/dns/blocking", json=body)
  • The 'register' function that registers all blocking tools (including disable_blocking) onto the FastMCP instance via the @mcp.tool() decorator. Returns 3 (the count of blocking tools).
    def register(mcp: FastMCP, client: PiholeClient) -> int:
        @mcp.tool()
        async def get_blocking_status() -> dict:
            """Check if Pi-hole DNS blocking is enabled. Returns status and any active timer."""
            return await client.get("/dns/blocking")
    
        @mcp.tool()
        async def enable_blocking() -> dict:
            """Enable DNS blocking immediately."""
            return await client.post("/dns/blocking", json={"blocking": True})
    
        @mcp.tool()
        async def disable_blocking(duration_seconds: int | None = None) -> dict:
            """Disable DNS blocking. If duration_seconds is given, re-enables after that timer; otherwise indefinite."""
            body: dict = {"blocking": False}
            if duration_seconds is not None:
                body["timer"] = duration_seconds
            return await client.post("/dns/blocking", json=body)
    
        return 3
  • The 'register_all' function that aggregates tool registration by calling each module's register() function, including the blocking module.
    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 top-level call that triggers registration of all tools (including disable_blocking) by calling register_all().
    _tool_count = register_all(mcp, _client)
  • The PiholeClient 'request'/'post' helper methods used by the disable_blocking handler to issue the actual HTTP POST request to the Pi-hole API.
    async def request(
        self,
        method: str,
        path: str,
        *,
        params: dict[str, Any] | None = None,
        json: Any | None = None,
    ) -> Any:
        """Issue a request, auto-authenticating and retrying once on 401."""
        sid = await self._ensure_session()
        resp = await self._http.request(
            method,
            path,
            params=params,
            json=json,
            headers={"X-FTL-SID": sid},
        )
        if resp.status_code == 401:
            self._sid = None
            sid = await self._ensure_session()
            resp = await self._http.request(
                method,
                path,
                params=params,
                json=json,
                headers={"X-FTL-SID": sid},
            )
        if resp.status_code >= 400:
            try:
                body = resp.json()
            except ValueError:
                body = resp.text
            raise PiholeAPIError(resp.status_code, f"{method} {path} failed", body)
        if resp.status_code == 204 or not resp.content:
            return None
        return resp.json()
    
    async def get(self, path: str, *, params: dict[str, Any] | None = None) -> Any:
        return await self.request("GET", path, params=params)
    
    async def post(self, path: str, *, json: Any | None = None) -> Any:
        return await self.request("POST", path, json=json)
    
    async def patch(self, path: str, *, json: Any | None = None) -> Any:
        return await self.request("PATCH", path, json=json)
    
    async def delete(self, path: str) -> Any:
        return await self.request("DELETE", path)
Behavior4/5

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

With no annotations, the description carries full burden. It clearly discloses the two behaviors: indefinite disable if no duration, or temporary disable with auto-re-enable. No contradictions.

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?

Single sentence, front-loaded with the core action. No unnecessary words. Every part is meaningful.

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?

For a simple tool with one optional parameter and an output schema, the description covers all needed context: the two operational modes and the effect of the parameter.

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

Parameters5/5

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

There is only one parameter (duration_seconds) with no schema description (coverage 0%). The description explains its effect: if provided, re-enables after timer; otherwise indefinite. This adds full meaning beyond the schema.

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 ('Disable DNS blocking') and the resource, using a specific verb. It distinguishes from the sibling 'enable_blocking' and adds optional duration behavior.

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

Usage Guidelines4/5

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

The description implicitly tells when to use (to disable blocking) and explains the two modes (temporary vs indefinite). However, it does not explicitly exclude alternatives or mention when not to use.

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