Skip to main content
Glama

ping

Test host reachability and measure round-trip times to diagnose network connectivity issues.

Instructions

Ping a host and return reachability and round-trip times.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hostYes
countNo
timeoutNo

Implementation Reference

  • The ping tool handler: decorated with @mcp.tool(), executes the system ping command via subprocess, returning reachability status and output.
    @mcp.tool()
    def ping(host: str, count: int = 4, timeout: int = 5) -> dict:
        """Ping a host and return reachability and round-trip times."""
        try:
            result = subprocess.run(
                ["ping", "-c", str(count), "-W", str(timeout), host],
                capture_output=True,
                text=True,
                timeout=timeout * count + 5,
            )
            return {
                "host": host,
                "reachable": result.returncode == 0,
                "output": result.stdout,
            }
        except Exception as e:
            return {"error": str(e), "tool": "ping", "host": host}
  • Registration: The @mcp.tool() decorator on the ping function registers it as an MCP tool.
    @mcp.tool()
  • Input schema: The function signature defines typed parameters (host: str, count: int, timeout: int) with defaults.
    def ping(host: str, count: int = 4, timeout: int = 5) -> dict:
  • Error handling: returns a dict with error info and tool name for any exception during ping execution.
    return {"error": str(e), "tool": "ping", "host": host}
Behavior2/5

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

No annotations are present, and the description does not disclose behavioral traits such as network permissions, rate limits, or whether the tool might cause side effects. It only states the output, missing important context for safe usage.

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

Conciseness3/5

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

The description is a single sentence, which is concise. However, it is too sparse; a few more sentences could improve completeness without sacrificing conciseness.

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

Completeness2/5

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

Given the tool's simplicity and the lack of output schema, the description partially covers the return values but omits important context like default behavior (e.g., count=4, timeout=5) and any prerequisites.

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

Parameters1/5

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

With 0% schema description coverage, the description should clarify parameter meanings. It does not explain the 'host' format, the semantic of 'count' (number of pings), or the unit of 'timeout'. This omission leaves the agent guessing.

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 ('Ping a host') and the return value ('reachability and round-trip times'). It distinguishes itself from sibling tools like cert_check and dns_lookup, which serve different purposes.

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 guidance is provided on when to use this tool over alternatives. For instance, it does not explain when to prefer ping over traceroute or port_check for network diagnostics.

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/aaronckj/mcp-nettools'

If you have feedback or need assistance with the MCP directory API, please join our Discord server