Skip to main content
Glama
googleSandy

Google Threat Intelligence MCP Server

by googleSandy

get_entities_related_to_an_url

Analyze a URL to identify related security entities like malware, campaigns, threat actors, and associated files using Google Threat Intelligence data.

Instructions

Retrieve entities related to the the given URL.

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

Relationship

Description

Return type

analyses

Analyses for the URL.

analyse

associations

URL'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 URL.

collection

collections

IoC Collections associated to the URL.

collection

comments

Community posted comments about the URL.

comment

communicating_files

Files that communicate with a given URL when they're executed.

file

contacted_domains

Domains from which the URL loads some kind of resource.

domain

contacted_ips

IPs from which the URL loads some kind of resource.

ip_address

downloaded_files

Files downloaded from the URL.

file

embedded_js_files

JS files embedded in a URL.

file

graphs

Graphs including the URL.

graph

http_response_contents

HTTP response contents from the URL.

file

last_serving_ip_address

Last IP address that served the URL.

ip_address

malware_families

Malware families associated to the URL.

collection

memory_pattern_parents

Files having a domain as string on memory during sandbox execution.

file

network_location

Domain or IP for the URL.

domain or ip_address

parent_resource_urls

Returns the URLs where this URL has been loaded as resource.

url

redirecting_urls

URLs that redirected to the given URL.

url

redirects_to

URLs that this url redirects to.

url

referrer_files

Files containing the URL.

file

referrer_urls

URLs referring the URL.

url

related_collections

Returns the Collections of the parent Domains or IPs of this URL.

collection

related_comments

Community posted comments in the URL's related objects.

comment

related_reports

Reports that are directly and indirectly related to the URL.

collection

related_threat_actors

URL's related threat actors.

collection

reports

Reports directly associated to the URL.

collection

software_toolkits

Software and Toolkits associated to the URL.

collection

submissions

URL's submissions.

url

urls_related_by_tracker_id

URLs that share the same tracker ID.

url

user_votes

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

vote

votes

Votes for the URL.

vote

vulnerabilities

Vulnerabilities associated to the URL.

collection

Args: url (required): URL 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 objects to retrieve. 10 by default. Returns: List of entities related to the URL.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYes
relationship_nameYes
descriptors_onlyYes
limitNo
api_keyNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Main handler function that retrieves entities related to a URL using the Google Threat Intelligence API. Validates the relationship name, converts URL to base64, fetches relationships, and sanitizes the response.
    @server.tool()
    async def get_entities_related_to_an_url(
        url: 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 URL.
    
        The following table shows a summary of available relationships for URL objects.
    
        | Relationship            | Description                                                    | Return type  |
        | ----------------------- | -------------------------------------------------------------- | ------------ | 
        | analyses                | Analyses for the URL.                                          | analyse      |
        | associations            | URL'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 URL.                               | collection   |
        | collections             | IoC Collections associated to the URL.                         | collection   |
        | comments                | Community posted comments about the URL.                       | comment      |
        | communicating_files     | Files that communicate with a given URL when they're executed. | file         |
        | contacted_domains       | Domains from which the URL loads some kind of resource.        | domain       |
        | contacted_ips           | IPs from which the URL loads some kind of resource.            | ip_address   |
        | downloaded_files        | Files downloaded from the URL.                                 | file         |
        | embedded_js_files       | JS files embedded in a URL.                                    | file         |
        | graphs                  | Graphs including the URL.                                      | graph        |
        | http_response_contents  | HTTP response contents from the URL.                           | file         |
        | last_serving_ip_address | Last IP address that served the URL.                           | ip_address   |
        | malware_families        | Malware families associated to the URL.                        | collection   |
        | memory_pattern_parents  | Files having a domain as string on memory during sandbox execution. | file    |
        | network_location        | Domain or IP for the URL.                                      | domain or ip_address |
        | parent_resource_urls    | Returns the URLs where this URL has been loaded as resource.   | url          |
        | redirecting_urls        | URLs that redirected to the given URL.                         | url          |
        | redirects_to            | URLs that this url redirects to.                               | url          |
        | referrer_files          | Files containing the URL.                                      | file         |
        | referrer_urls           | URLs referring the URL.                                        | url          |
        | related_collections     | Returns the Collections of the parent Domains or IPs of this URL. | collection  |
        | related_comments        | Community posted comments in the URL's related objects.        | comment      |
        | related_reports         | Reports that are directly and indirectly related to the URL.   | collection   |
        | related_threat_actors   | URL's related threat actors.                                   | collection   |
        | reports                 | Reports directly associated to the URL.                        | collection   |
        | software_toolkits       | Software and Toolkits associated to the URL.                   | collection   |
        | submissions             | URL's submissions.                                             | url          |
        | urls_related_by_tracker_id | URLs that share the same tracker ID.                        | url          |
        | user_votes          | URL's votes made by current signed-in user.                        | vote         |
        | votes                  | Votes for the URL.                                              | vote         |
        | vulnerabilities        | Vulnerabilities associated to the URL.                          | collection   |
    
        Args:
          url (required): URL 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 objects to retrieve. 10 by default.
        Returns:
          List of entities related to the URL.
      """
      if not relationship_name in URL_RELATIONSHIPS:
        return {
           "error": f"Relationship {relationship_name} does not exist. "
                    f"Available relationships are: {','.join(URL_RELATIONSHIPS)}"
        }
    
      url_id = url_to_base64(url)
      async with vt_client(ctx, api_key=api_key) as client:
        res = await utils.fetch_object_relationships(
            client,
            "urls", 
            url_id,
            relationships=[relationship_name],
            descriptors_only=descriptors_only,
            limit=limit)
      return utils.sanitize_response(res.get(relationship_name, []))
  • The @server.tool() decorator that registers the get_entities_related_to_an_url function as an MCP tool with the FastMCP server.
    @server.tool()
  • Helper function that converts a URL to base64 encoding without padding, as required by the Google Threat Intelligence API for URL identifiers.
    def url_to_base64(url: str) -> str:
      """Converts the URL into base64.
    
      Without padding, as required by the Google Threat Intelligence API.
      """
      b = base64.b64encode(url.encode('utf-8'))
      return b.decode('utf-8').rstrip("=")
  • Helper function that asynchronously fetches relationship data from the VirusTotal API for a given object, using TaskGroup for concurrent requests and optionally returning descriptors only.
    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
  • Helper function that recursively removes empty dictionaries, lists, and empty strings from API response data 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 full burden and does well by detailing the return types for each relationship, explaining the descriptors_only parameter's specific use case, and noting the default limit. It doesn't cover authentication needs, rate limits, or error conditions, but provides substantial behavioral context beyond basic functionality.

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 the extensive table (30+ rows) makes it lengthy. While the table is valuable for parameter semantics, it could be more concise. The Args/Returns sections are clear but add to length. Every sentence earns its place, but overall structure could be tighter.

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?

For a complex tool with 5 parameters, 0% schema coverage, no annotations, but with output schema, the description is quite complete. It covers purpose, parameters, relationships, and return types. The main gap is lack of error handling or authentication details, but given the output schema exists, return values are adequately addressed.

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?

Given 0% schema description coverage, the description compensates excellently. It explains all 5 parameters: url's purpose, relationship_name's options via the detailed table, descriptors_only's specific boolean logic and when it must be True, limit's default value and purpose, and implies api_key for authentication. This adds significant meaning beyond the bare schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/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 URL.' It specifies the verb 'retrieve' and resource 'entities related to URL,' but doesn't explicitly differentiate from sibling tools like get_entities_related_to_a_domain or get_entities_related_to_a_file, which follow the same pattern for different resource types.

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 provides implied usage through the comprehensive table of relationship types, suggesting when to use this tool for various URL-related queries. However, it lacks explicit guidance on when to choose this tool over alternatives like get_url_report or search_iocs, and doesn't mention prerequisites 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/googleSandy/gti-mcp-standalone'

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