Skip to main content
Glama

get_ipv6_info

Retrieve IPv6 network information from API endpoints by temporarily overriding connection settings to force IPv6 usage for network requests.

Instructions

Retrieves IPv6 information from a specified API endpoint. This method temporarily overrides the allowed_gai_family method to force the use of IPv6 when making network requests. It then attempts to fetch IPv6-related information from the configured API URL. Returns: dict: A dictionary containing IPv6 information if the request is successful. Returns an empty dictionary if no information is found or if an error occurs. Error Handling: Logs an error message and returns an empty dictionary if a requests.RequestException is raised during the fetch operation. Also logs the full traceback at the debug level for troubleshooting.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that implements the core logic of the 'get_ipv6_info' tool. It forces IPv6 resolution and fetches IP information from the configured API endpoint (default: https://v6.ipinfo.io/json), handling errors gracefully.
    def get_ipv6_info(self) -> Dict[str, Any]: """ Retrieves IPv6 information from a specified API endpoint. This method temporarily overrides the `allowed_gai_family` method to force the use of IPv6 when making network requests. It then attempts to fetch IPv6-related information from the configured API URL. Returns: dict: A dictionary containing IPv6 information if the request is successful. Returns an empty dictionary if no information is found or if an error occurs. Error Handling: Logs an error message and returns an empty dictionary if a `requests.RequestException` is raised during the fetch operation. Also logs the full traceback at the debug level for troubleshooting. """ try: urllib3_connection.allowed_gai_family = lambda: socket.AF_INET6 ipv6 = self.get_info(self.ipv6_api_url) if not ipv6: logging.error("No IPv6 information found.") return {"error": "No IPv6 information found."} return ipv6 except requests.RequestException as e: logging.error(f"Error fetching IPv6 info: {e}") logging.debug(e) traceback.print_exc() return {"error": f"Failed to fetch IPv6 information: {str(e)}"}
  • The registration code that dynamically discovers and registers all public methods of the IPIntegration instance (including 'get_ipv6_info') as MCP tools via FastMCP.add_tool().
    def _register_tools(self): self.register_tools(self.gi) self.register_tools(self.ip) def register_tools(self, methods: Any = None) -> None: for name, method in inspect.getmembers(methods): if (inspect.isfunction(method) or inspect.ismethod(method)) and not name.startswith("_"): self.mcp.add_tool(method)

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/saidsef/mcp-github-pr-issue-analyser'

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