Skip to main content
Glama

get_query_types

Retrieve a breakdown of DNS query types, including A, AAAA, PTR, and SRV, from Pi-hole statistics.

Instructions

Breakdown of DNS query types (A, AAAA, PTR, SRV, etc).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The get_query_types tool handler: an async function decorated with @mcp.tool() that calls the Pi-hole API endpoint /stats/query_types to return a breakdown of DNS query types (A, AAAA, PTR, SRV, etc).
    async def get_query_types() -> dict:
        """Breakdown of DNS query types (A, AAAA, PTR, SRV, etc)."""
        return await client.get("/stats/query_types")
  • The register() function in stats.py uses @mcp.tool() decorator to register get_query_types (and other tools) with the FastMCP server instance.
    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 orchestrates registration by calling stats.register(mcp, client), which registers get_query_types via the decorator.
    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.get() method used by get_query_types to make the HTTP GET request to the Pi-hole API.
    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)
Behavior2/5

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

No annotations are provided, so the description must disclose behavioral traits. It states only 'breakdown of DNS query types' without indicating read-only nature, side effects, or authentication requirements.

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

Conciseness4/5

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

The description is a single, concise sentence with no wasted words. However, it is very brief and could benefit from slightly more detail without losing conciseness.

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 tool has an output schema, the description need not explain return values. However, the description is minimal and does not clarify the format of the breakdown (e.g., counts, list). It is adequate but could be more helpful.

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 100% schema coverage. The description adds no parameter info, but none is needed. Baseline score applies.

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

Purpose4/5

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

The description clearly states the tool returns a breakdown of DNS query types, listing examples like A, AAAA, PTR, SRV. However, it does not differentiate from sibling tools like get_stats or get_history, which also provide DNS-related summaries.

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?

The description provides no guidance on when to use this tool versus alternatives, nor does it specify any prerequisites or contexts.

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