Skip to main content
Glama
seayniclabs

Keel

by seayniclabs

get_public_ip

Retrieve the public IP address of the current machine. Useful for network diagnostics and connectivity checks.

Instructions

Get the public IP address of this machine.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The tool handler that fetches the public IP from httpbin.org/ip and returns it as {"public_ip": ...} or {"error": ...} on failure.
    async def get_public_ip() -> dict:
        """Get the public IP address of this machine."""
        try:
            async with httpx.AsyncClient(timeout=10.0) as client:
                response = await client.get("https://httpbin.org/ip")
                data = response.json()
                return {"public_ip": data.get("origin", "unknown")}
        except Exception as exc:
            return {"error": str(exc)}
  • No explicit schema – input takes no arguments, output is a free-form dict (either {"public_ip": str} or {"error": str}).
    @mcp.tool()
    async def get_public_ip() -> dict:
  • Registered as an MCP tool via the @mcp.tool() decorator on line 504.
    @mcp.tool()
    async def get_public_ip() -> dict:
  • Mocked unit test for get_public_ip success case.
    async def test_get_public_ip_mocked():
        """get_public_ip should return the IP from httpbin without hitting the network."""
        from unittest.mock import MagicMock
    
        mock_response = MagicMock()
        mock_response.json.return_value = {"origin": "203.0.113.42"}
    
        mock_client_instance = AsyncMock()
        mock_client_instance.get = AsyncMock(return_value=mock_response)
        mock_client_instance.__aenter__ = AsyncMock(return_value=mock_client_instance)
        mock_client_instance.__aexit__ = AsyncMock(return_value=False)
    
        with patch("sounding.server.httpx.AsyncClient", return_value=mock_client_instance):
            result = await get_public_ip()
    
        assert result == {"public_ip": "203.0.113.42"}
        mock_client_instance.get.assert_awaited_once_with("https://httpbin.org/ip")
  • Mocked unit test for get_public_ip error/exception case.
    async def test_get_public_ip_mocked_error():
        """get_public_ip should return an error dict on failure."""
        mock_client_instance = AsyncMock()
        mock_client_instance.get = AsyncMock(side_effect=httpx.ConnectError("Connection refused"))
        mock_client_instance.__aenter__ = AsyncMock(return_value=mock_client_instance)
        mock_client_instance.__aexit__ = AsyncMock(return_value=False)
    
        with patch("sounding.server.httpx.AsyncClient", return_value=mock_client_instance):
            result = await get_public_ip()
    
        assert "error" in result
Behavior2/5

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

No annotations are provided, so the description carries full burden. It only states the action, but does not disclose behavior such as network dependency, format of the IP (IPv4 vs IPv6), or error handling.

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 sentence, concise and front-loaded with the purpose. No extra words, but could be slightly more structured.

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?

For a simple tool with no output schema, the description should at least hint at the return format. It does not, making it slightly incomplete for an AI agent to know what to expect.

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 schema coverage is 100% (no params to describe). Baseline is 4, and the description adds no parameter info, which is appropriate given the tool's simplicity.

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's purpose: 'Get the public IP address of this machine.' It specifies the verb 'get' and the resource 'public IP address', and distinguishes itself from sibling tools like dns_lookup or ping.

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 usage guidance is provided. The description does not indicate when to use this tool versus alternatives or mention any context or exclusions.

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/seayniclabs/sounding'

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