Skip to main content
Glama

list_local_dns

List local DNS entries, including hosts and CNAME records, to view and manage DNS configurations.

Instructions

List local DNS entries (hosts and CNAME records).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'list_local_dns' tool. Calls _current_dns_config(client) and returns hosts/cnameRecords from the Pi-hole DNS config.
    async def list_local_dns() -> dict:
        """List local DNS entries (hosts and CNAME records)."""
        dns = await _current_dns_config(client)
        return {"hosts": dns.get("hosts", []), "cnameRecords": dns.get("cnameRecords", [])}
  • Helper function _current_dns_config that fetches the current DNS configuration from the Pi-hole API, used by list_local_dns to get the data.
    async def _current_dns_config(client: PiholeClient) -> dict:
        payload = await client.get("/config/dns")
        config = payload.get("config") or {}
        dns = config.get("dns") or {}
        return dns
  • Registration of the tool via the @mcp.tool() decorator inside the register() function.
    def register(mcp: FastMCP, client: PiholeClient) -> int:
        @mcp.tool()
        async def list_local_dns() -> dict:
            """List local DNS entries (hosts and CNAME records)."""
            dns = await _current_dns_config(client)
            return {"hosts": dns.get("hosts", []), "cnameRecords": dns.get("cnameRecords", [])}
  • The register_all function that iterates over all tool modules (including local_dns) and calls their register() methods.
    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 are provided, so the description carries the full burden. 'List' implies a read-only operation, which is correct, but the description does not explicitly state it is non-destructive or mention any potential side effects. For a simple list tool, this is adequate but not thorough.

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?

A single concise sentence that immediately states the action and resource. No unnecessary words, and the structure is front-loaded with the key verb and object.

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?

Given no parameters and the existence of an output schema, the description sufficiently covers the tool's purpose. It fully explains what the tool does without needing to describe return values, as that is handled by the output schema.

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?

There are zero parameters and schema description coverage is 100%, so no additional parameter information is needed. The description adds no parameter semantics, which is fine, earning a baseline of 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 uses a specific verb ('List') and resource ('local DNS entries') and explicitly mentions types (hosts and CNAME records), clearly distinguishing it from sibling tools that add or remove records.

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 explicit guidance on when to use this tool versus alternatives like add_local_a_record or remove_local_a_record. The description implies a read operation, but does not state typical use cases (e.g., before adding/deleting entries) or mention that it lists all entries without filtering.

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