Skip to main content
Glama
googleSandy

Google Threat Intelligence MCP Server

by googleSandy

get_file_behavior_report

Get a detailed behavior report for a file by using its behavior identifier, which includes the file hash and sandbox name.

Instructions

Retrieve the file behaviour report of the given file behaviour identifier.

You can get all the file behaviour of a given a file by calling get_entities_related_to_a_file as the file hash and the behaviours as relationship name.

The file behaviour ID is composed using the following pattern: "{file hash}_{sandbox name}".

Args: file_behaviour_id (required): File behaviour ID. Returns: The file behaviour report.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_behaviour_idYes
api_keyNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The `get_file_behavior_report` tool handler function. It uses the `@server.tool()` decorator for registration, fetches a file behaviour report from VirusTotal/GTI API using `utils.fetch_object` with multiple relationships (contacted_domains, contacted_ips, contacted_urls, dropped_files, embedded_domains, embedded_ips, embedded_urls, associations), and sanitizes the response.
    @server.tool()
    async def get_file_behavior_report(
        file_behaviour_id: str, ctx: Context, api_key: str = None
    ) -> typing.Dict[str, typing.Any]:
      """Retrieve the file behaviour report of the given file behaviour identifier.
    
      You can get all the file behaviour of a given a file by calling `get_entities_related_to_a_file` as the file hash and the `behaviours` as relationship name.
    
      The file behaviour ID is composed using the following pattern: "{file hash}_{sandbox name}".
    
      Args:
        file_behaviour_id (required): File behaviour ID.
      Returns:
        The file behaviour report.
      """
      async with vt_client(ctx, api_key=api_key) as client:
        res = await utils.fetch_object(
            client,
            "file_behaviours",
            "file_behaviour",
            file_behaviour_id,
            relationships=[
                "contacted_domains",
                "contacted_ips",
                "contacted_urls",
                "dropped_files",
                "embedded_domains",
                "embedded_ips",
                "embedded_urls",
                "associations",
            ],
        )
      return utils.sanitize_response(res)
  • Function signature acts as the input schema: `file_behaviour_id: str` (required), `ctx: Context`, and optional `api_key: str`. Return type is `Dict[str, Any]`.
    async def get_file_behavior_report(
        file_behaviour_id: str, ctx: Context, api_key: str = None
    ) -> typing.Dict[str, typing.Any]:
  • The tool is registered via the `@server.tool()` decorator from `gti_mcp/server.py` (FastMCP instance). The `server` variable is imported at line 23, and all tools in `files.py` are loaded via `from gti_mcp.tools import *` at line 73 of server.py, which triggers `from .files import *` in gti_mcp/tools/__init__.py.
    @server.tool()
  • The `fetch_object` helper function, called by the handler to fetch the file behaviour report from the GTI API. It handles the API call, error handling, and response formatting.
    async def fetch_object(
        vt_client: vt.Client,
        resource_collection_type: str,
        resource_type: str,
        resource_id: str,
        attributes: list[str] | None = None,
        relationships: list[str] | None = None,
        params: dict[str, typing.Any] | None = None):
      """Fetches objects from Google Threat Intelligence API."""
      logging.info(
          f"Fetching comprehensive {resource_collection_type} "
          f"report for id: {resource_id}")
      
      params = {k: v for k, v in params.items()} if params else {}
    
      # Retrieve a selection of object attributes and/or relationships.
      if attributes:
        params["attributes"] = ",".join(attributes)
      if relationships:
        params["relationships"] = ",".join(relationships)
    
      try:
        obj = await vt_client.get_object_async(
            f"/{resource_collection_type}/{resource_id}", params=params)
    
        if obj.error:
          logging.error(
              f"Error fetching main {resource_type} report for {resource_id}: {obj.error}"
          )
          return {
              "error": f"Failed to get main {resource_type} report: {obj.error}",
              # "details": report.get("details"),
          }
      except vt.error.APIError as e:
        logging.warning(
            f"VirusTotal API Error fetching {resource_type} {resource_id}: {e.code} - {e.message}"
        )
        return {
            "error": f"VirusTotal API Error: {e.code} - {e.message}",
            "details": f"The requested {resource_type} '{resource_id}' could not be found or there was an issue with the API request."
        }
      except Exception as e:
        logging.exception(
            f"Unexpected error fetching {resource_type} {resource_id}: {e}"
        )
        return {"error": "An unexpected internal error occurred."}
    
      # Build response.
      obj_dict = obj.to_dict()
      obj_dict['id'] = obj.id
      if 'aggregations' in obj_dict['attributes']:
        del obj_dict['attributes']['aggregations']
    
      logging.info(
          f"Successfully generated concise threat summary for id: {resource_id}")
      return obj_dict
  • The `sanitize_response` helper function, called by the handler to clean up the response by removing empty dicts/lists recursively.
    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
Behavior2/5

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

No annotations are provided, so the description bears the full burden. It only states the action and return value but does not disclose behavioral traits like read-only nature, permissions, or rate limits. Essential context is missing.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and front-loaded with the main action. It includes useful cross-references and no unnecessary text. Every sentence adds value.

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 has an output schema (though not detailed) and the description covers the input derivation and ID format, it provides adequate context for an agent to use it correctly, except for the omitted api_key parameter.

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

Parameters3/5

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

Schema coverage is 0%, so the description must compensate. It describes the file_behaviour_id parameter and its format, but the optional api_key parameter is not mentioned. Partial coverage of parameters reduces effectiveness.

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 retrieves the file behavior report for a given identifier. It explains how to obtain the identifier via another tool and provides the ID pattern. This differentiates it from siblings like get_file_behavior_summary.

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

Usage Guidelines4/5

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

The description provides explicit guidance on how to get the file behavior ID (via get_entities_related_to_a_file) and the ID format. It does not give when-not-to-use or compare with other siblings, but the context is clear.

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