get_stats
Retrieve summary statistics from Pi-hole including total queries, blocked queries, percentage blocked, unique domains, and clients.
Instructions
Get summary statistics (total queries, blocked queries, blocking percentage, unique domains, clients).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/pihole_mcp/tools/stats.py:8-10 (handler)The `get_stats` tool handler: an async function registered via @mcp.tool() that fetches summary statistics from the Pi-hole API at /stats/summary.
async def get_stats() -> dict: """Get summary statistics (total queries, blocked queries, blocking percentage, unique domains, clients).""" return await client.get("/stats/summary") - src/pihole_mcp/tools/stats.py:6-10 (registration)The `register` function in stats.py uses @mcp.tool() decorator to register `get_stats` as an MCP tool. This module is invoked by tools/__init__.py's register_all function.
def register(mcp: FastMCP, client: PiholeClient) -> int: @mcp.tool() async def get_stats() -> dict: """Get summary statistics (total queries, blocked queries, blocking percentage, unique domains, clients).""" return await client.get("/stats/summary") - src/pihole_mcp/tools/__init__.py:14-18 (registration)The `register_all` function iterates over tool modules (including stats) and calls their `register` method to wire up all tools on the FastMCP instance.
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) - src/pihole_mcp/client.py:100-101 (helper)The `get` method on PiholeClient, which `get_stats` calls via `client.get('/stats/summary')`, delegates to the `request` method with method='GET'.
async def get(self, path: str, *, params: dict[str, Any] | None = None) -> Any: return await self.request("GET", path, params=params)