Skip to main content
Glama
googleSandy

Google Threat Intelligence MCP Server

by googleSandy

get_entities_related_to_an_ip_address

Analyze IP addresses to identify related threats, including malware, campaigns, threat actors, vulnerabilities, and associated files, using Google's threat intelligence data.

Instructions

Retrieve entities related to the the given IP Address.

The following table shows a summary of available relationships for IP Address objects.

Relationship

Description

Return type

associations

IP's associated objects (reports, campaigns, IoC collections, malware families, software toolkits, vulnerabilities, threat-actors), without filtering by the associated object type.

collection

campaigns

Campaigns associated to the IP address.

collection

collections

IoC Collections associated to the IP address.

collection

comments

Comments for the IP address.

comment

communicating_files

Files that communicate with the IP address.

file

downloaded_files

Files downloaded from the IP address.

file

graphs

Graphs including the IP address.

graph

historical_ssl_certificates

SSL certificates associated with the IP.

ssl-cert

historical_whois

WHOIS information for the IP address.

whois

malware_families

Malware families associated to the IP address.

collection

memory_pattern_parents

Files having an IP as string on memory during sandbox execution.

file

referrer_files

Files containing the IP address.

file

related_comments

Community posted comments in the IP's related objects.

comment

related_reports

Reports that are directly and indirectly related to the IP.

collection

related_threat_actors

Threat actors related to the IP address.

collection

reports

Reports directly associated to the IP.

collection

resolutions

IP address' resolutions

resolution

software_toolkits

Software and Toolkits associated to the IP address.

collection

urls

URLs related to the IP address.

url

user_votes

IP's votes made by current signed-in user.

vote

votes

IP's votes.

vote

vulnerabilities

Vulnerabilities associated to the IP address.

collection

Args: ip_address (required): IP Addres to analyse. relationship_name (required): Relationship name. descriptors_only (required): Bool. Must be True when the target object type is one of file, domain, url, ip_address or collection. limit: Limit the number of entities to retrieve. 10 by default. Returns: List of entities related to the IP Address.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ip_addressYes
relationship_nameYes
descriptors_onlyYes
limitNo
api_keyNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Main handler function get_entities_related_to_an_ip_address that retrieves entities related to an IP address. Validates the relationship_name parameter against IP_RELATIONSHIPS, calls the VirusTotal API via fetch_object_relationships, and sanitizes the response.
    @server.tool()
    async def get_entities_related_to_an_ip_address(
        ip_address: str, relationship_name: str, descriptors_only: bool, ctx: Context, limit: int = 10, api_key: str = None
    ) -> list[dict[str, typing.Any]]:
      """Retrieve entities related to the the given IP Address.
    
        The following table shows a summary of available relationships for IP Address objects.
    
        | Relationship                | Description                                            | Return type  |
        | --------------------------- | ------------------------------------------------------ | ------------ |
        | associations                | IP's associated objects (reports, campaigns, IoC collections, malware families, software toolkits, vulnerabilities, threat-actors), without filtering by the associated object type. | collection |
        | campaigns                   | Campaigns associated to the IP address.                | collection   |
        | collections                 | IoC Collections associated to the IP address.          | collection   |
        | comments                    | Comments for the IP address.                           | comment      |
        | communicating_files         | Files that communicate with the IP address.            | file         |
        | downloaded_files            | Files downloaded from the IP address.                  | file         |
        | graphs                      | Graphs including the IP address.                       | graph        |
        | historical_ssl_certificates | SSL certificates associated with the IP.               | ssl-cert     |
        | historical_whois            | WHOIS information for the IP address.                  | whois        |
        | malware_families            | Malware families associated to the IP address.         | collection   |
        | memory_pattern_parents      | Files having an IP as string on memory during sandbox execution. | file |
        | referrer_files              | Files containing the IP address.                       | file         |
        | related_comments            | Community posted comments in the IP's related objects. | comment      |
        | related_reports             | Reports that are directly and indirectly related to the IP. | collection |
        | related_threat_actors       | Threat actors related to the IP address.               | collection   |
        | reports                     | Reports directly associated to the IP.                 | collection   |
        | resolutions                 | IP address' resolutions                                | resolution   |
        | software_toolkits           | Software and Toolkits associated to the IP address.    | collection   |
        | urls                        | URLs related to the IP address.                        | url          |
        | user_votes                  | IP's votes made by current signed-in user.             | vote         |
        | votes                       | IP's votes.                                            | vote         |
        | vulnerabilities             | Vulnerabilities associated to the IP address.          | collection   |
    
        Args:
          ip_address (required): IP Addres to analyse.
          relationship_name (required): Relationship name.
          descriptors_only (required): Bool. Must be True when the target object type is one of file, domain, url, ip_address or collection.
          limit: Limit the number of entities to retrieve. 10 by default.
        Returns:
          List of entities related to the IP Address.
      """
      if not relationship_name in IP_RELATIONSHIPS:
        return {
           "error": f"Relationship {relationship_name} does not exist. "
                    f"Available relationships are: {','.join(IP_RELATIONSHIPS)}"
        }
    
      async with vt_client(ctx) as client:
        res = await utils.fetch_object_relationships(
            client, 
            "ip_addresses",
            ip_address,
            relationships=[relationship_name],
            descriptors_only=descriptors_only,
            limit=limit)
      return utils.sanitize_response(res.get(relationship_name, []))
  • IP_RELATIONSHIPS constant defining all valid relationship names that can be queried for IP addresses. This serves as validation schema for the relationship_name parameter.
    IP_RELATIONSHIPS = [
        "associations",
        "campaigns",
        "collections",
        "comments",
        "communicating_files",
        "downloaded_files",
        "graphs",
        "historical_ssl_certificates",
        "historical_whois",
        "malware_families",
        "memory_pattern_parents",
        "referrer_files",
        "related_comments",
        "related_reports",
        "related_threat_actors",
        "reports",
        "resolutions",
        "software_toolkits",
        "urls",
        "user_votes",
        "votes",
        "vulnerabilities",
    ]
  • fetch_object_relationships helper function that fetches relationship descriptors from VirusTotal objects. Creates async tasks to fetch multiple relationships concurrently and aggregates the results.
    async def fetch_object_relationships(
        vt_client: vt.Client,
        resource_collection_type: str,
        resource_id: str,
        relationships: typing.List[str],
        params: dict[str, typing.Any] | None = None,
        descriptors_only: bool = True,
        limit: int = 10):
      """Fetches the given relationships descriptors from the given object."""
      rel_futures = {}
      # If true, returns descriptors instead of full objects.
      descriptors = '/relationship' if descriptors_only else ''
      async with asyncio.TaskGroup() as tg:
        for rel_name in relationships:
          rel_futures[rel_name] = tg.create_task(
              consume_vt_iterator(
                  vt_client,
                  f"/{resource_collection_type}/{resource_id}"
                  f"{descriptors}/{rel_name}", params=params, limit=limit))
    
      data = {}
      for name, items in rel_futures.items():
        data[name] = []
        for obj in items.result():
          obj_dict = obj.to_dict()
          if 'aggregations' in obj_dict['attributes']:
            del obj_dict['attributes']['aggregations']
          data[name].append(obj_dict)
    
      return data
  • sanitize_response helper function that recursively removes empty dictionaries and lists from API responses to clean up the output.
    def sanitize_response(data: typing.Any) -> typing.Any:
      """Removes empty dictionaries and lists recursively from a response."""
      if isinstance(data, dict):
        sanitized_dict = {}
        for key, value in data.items():
          sanitized_value = sanitize_response(value)
          if sanitized_value is not None:
            sanitized_dict[key] = sanitized_value
        return sanitized_dict
      elif isinstance(data, list):
        sanitized_list = []
        for item in data:
          sanitized_item = sanitize_response(item)
          if sanitized_item is not None:
            sanitized_list.append(sanitized_item)
        return sanitized_list
      elif isinstance(data, str):
        return data if data else None
      else:
        return data
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes the tool's behavior: it retrieves a list of entities based on a relationship type, includes a detailed table of available relationships with return types, explains the 'descriptors_only' parameter's condition, and specifies a default limit. However, it lacks details on error handling, rate limits, or authentication needs (though api_key is in the schema), leaving some gaps.

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 appropriately front-loaded with the core purpose, but it includes a lengthy table (23 rows) that, while informative, may be excessive. The Args and Returns sections are clear, but overall structure could be more streamlined by summarizing the table or moving it to documentation. Some redundancy exists (e.g., 'Retrieve entities related to the the given IP Address' has a typo).

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

Completeness4/5

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

Given the tool's complexity (5 parameters, 0% schema coverage, no annotations, but has an output schema), the description is largely complete. It explains the purpose, parameters, relationships, and return value. The output schema exists, so the description doesn't need to detail return values. However, it misses some contextual details like error cases or authentication requirements, slightly reducing completeness.

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

Parameters5/5

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

Schema description coverage is 0%, so the description must compensate fully. It adds significant meaning beyond the schema: it explains 'ip_address' as 'IP Address to analyse', 'relationship_name' with a comprehensive table of options and descriptions, 'descriptors_only' with a specific condition (True for certain object types), and 'limit' with its default value. This covers all parameters thoroughly, providing essential context missing from the schema.

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: 'Retrieve entities related to the given IP Address.' It specifies the verb ('retrieve'), resource ('entities'), and scope ('related to an IP address'), distinguishing it from sibling tools like get_ip_address_report (which likely returns a report rather than relationships) and other get_entities_related_to_* tools (which target different resource types like domains or files).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage through the table of relationships (e.g., use 'campaigns' to get campaigns, 'comments' for comments), but it does not explicitly state when to use this tool versus alternatives. For instance, it doesn't compare with get_ip_address_report or other sibling tools, nor does it provide prerequisites or exclusions. The guidance is contextual but not explicit about tool selection.

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/googleSandy/gti-mcp-standalone'

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