Skip to main content
Glama

get_info

Fetch structured data from any URL via HTTP GET requests to retrieve JSON information for analysis and processing.

Instructions

Fetches information from the specified URL using an HTTP GET request. Args: url (str): The URL to send the GET request to. Returns: Dict[str, Any]: The JSON response parsed into a dictionary if the request is successful. Returns an empty dictionary if the request fails or an exception occurs. Error Handling: Logs an error message and stack trace if a requests.RequestException is raised during the HTTP request.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYes

Implementation Reference

  • The core handler function for the MCP tool 'get_info'. It performs an HTTP GET request to the provided URL, parses the JSON response, and handles errors by logging and returning an error dictionary.
    def get_info(self, url: str) -> Dict[str, Any]: """ Fetches information from the specified URL using an HTTP GET request. Args: url (str): The URL to send the GET request to. Returns: Dict[str, Any]: The JSON response parsed into a dictionary if the request is successful. Returns an empty dictionary if the request fails or an exception occurs. Error Handling: Logs an error message and stack trace if a requests.RequestException is raised during the HTTP request. """ try: response = requests.get(url, timeout=TIMEOUT) response.raise_for_status() return response.json() except requests.RequestException as e: logging.error(f"Error fetching IP info: {e}") logging.debug(e) traceback.print_exc() return {"error": str(e)}
  • The registration logic that dynamically discovers and registers all public methods (non-starting with '_') from IPIntegration instance as MCP tools, including 'get_info', by calling mcp.add_tool(method). This is invoked at line 107 for 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)
  • Usage of get_info as a helper in get_ipv4_info tool to fetch IPv4 data from ipinfo.io
    def get_ipv4_info(self) -> Dict[str, Any]: """ Get information about an IPv4 address. :return: A dictionary containing the IPv4 information. """ try: ipv4 = self.get_info(self.ipv4_api_url) if not ipv4: logging.error("No IPv4 information found.") return {} return ipv4 except requests.RequestException as e: logging.error(f"Error fetching IPv4 info: {e}") logging.debug(e) traceback.print_exc() return {"error": str(e)}
  • Usage of get_info as a helper in get_ipv6_info tool to fetch IPv6 data from v6.ipinfo.io, with IPv6 family override.
    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)}"}
  • Calls register_tools on the IPIntegration instance (self.ip), which triggers registration of 'get_info' and other public methods as MCP tools.
    def _register_tools(self): self.register_tools(self.gi) self.register_tools(self.ip)

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