Skip to main content
Glama

get_history

Retrieves a time-series activity graph with timestamps and counts of allowed, blocked, and other queries per time bucket for monitoring DNS filtering activity.

Instructions

Time-series activity graph: timestamps, allowed/blocked/other counts per bucket.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'get_history' tool. Calls the Pi-hole API's /history endpoint to return time-series activity data.
    @mcp.tool()
    async def get_history() -> dict:
        """Time-series activity graph: timestamps, allowed/blocked/other counts per bucket."""
        return await client.get("/history")
  • The 'register' function in stats.py that registers get_history (and other stats tools) onto the FastMCP instance via @mcp.tool() decorator.
    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")
    
        @mcp.tool()
        async def get_top_blocked(count: int = 10) -> dict:
            """Get top blocked domains by query count."""
            return await client.get("/stats/top_domains", params={"blocked": "true", "count": count})
    
        @mcp.tool()
        async def get_top_permitted(count: int = 10) -> dict:
            """Get top allowed (permitted) domains by query count."""
            return await client.get("/stats/top_domains", params={"blocked": "false", "count": count})
    
        @mcp.tool()
        async def get_top_clients(count: int = 10, blocked: bool = False) -> dict:
            """Get top clients by query count. Set blocked=true for top clients by blocked query count."""
            params: dict = {"count": count}
            if blocked:
                params["blocked"] = "true"
            return await client.get("/stats/top_clients", params=params)
    
        @mcp.tool()
        async def get_query_types() -> dict:
            """Breakdown of DNS query types (A, AAAA, PTR, SRV, etc)."""
            return await client.get("/stats/query_types")
    
        @mcp.tool()
        async def get_forward_destinations() -> dict:
            """Upstream DNS server stats (which forwarders served how many queries)."""
            return await client.get("/stats/upstreams")
    
        @mcp.tool()
        async def get_recent_blocked(count: int = 10) -> dict:
            """Recently blocked domains."""
            return await client.get("/stats/recent_blocked", params={"count": count})
    
        @mcp.tool()
        async def get_history() -> dict:
            """Time-series activity graph: timestamps, allowed/blocked/other counts per bucket."""
            return await client.get("/history")
    
        return 8
  • The register_all function that calls module.register (including stats.register) to register all tools.
    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
Behavior3/5

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

No annotations provided, so the description must convey behavioral traits. It states the output but does not disclose whether the tool is read-only, requires permissions, or any other behavior. For a simple read operation, this is minimally adequate but lacks depth.

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, front-loaded sentence that efficiently communicates the tool's output. Every word contributes to meaning, no redundancy.

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

Completeness4/5

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

The description covers the output (time-series, timestamps, counts) but lacks specifics like bucket granularity or whether counts are absolute or percentages. Given an output schema exists, it is reasonably complete but could be more precise.

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 tool has zero parameters, and the schema coverage is 100%. The description adds no parameter details, but since there are none, this is appropriate. Baseline for 0 params is 4.

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 tool provides a time-series activity graph with timestamps and counts per bucket (allowed, blocked, other). This is specific and distinguishes it from siblings like get_query_log or get_stats.

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

Usage Guidelines3/5

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

No guidance on when to use this tool versus alternatives. The description only explains what it returns, not the context or conditions for use. With many sibling tools, some usage hints would be beneficial.

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