Skip to main content
Glama
googleSandy

Google Threat Intelligence MCP Server

by googleSandy

search_threats

Search threats in Google Threat Intelligence using a query. Filter by type (threat actor, malware, campaign, vulnerability) and sort results to find relevant intelligence.

Instructions

Search threats in the Google Threat Intelligence platform.

Threats are modeled as collections. Once you get collections from this tool, you can use get_collection_report to fetch the full reports and their relationships.

IMPORTANT CONTEXT CLUE: Pay close attention to the user's request. If their request mentions specific kinds of threats such as "threat actor", "malware family", "campaign", "report", or "vulnerability", treat this as a strong signal that you must use the collection_type filter in your query to ensure relevant results. Using this filter significantly improves search precision.

Filtering by Type: To filter your search results to a specific type of threat, include the collection_type modifier within your query string. Syntax: collection_type:"<type>" Available <type> values:

  • "threat-actor": Use when the user asks about specific actors, groups, or APTs.

  • "malware-family": Use when the user asks about malware, trojans, viruses, ransomware families.

  • "software-toolkit": Use when the user asks about legit tools usually related to malware.

  • "campaign": Use when the user asks about specific attack campaigns.

  • "report": Use when the user is looking for analysis reports.

  • "vulnerability": Use when the user asks about specific CVEs or vulnerabilities.

  • "collection": A generic type, use only if no other type fits or if the user explicitly asks for generic "collections".

You can use order_by to sort the results by: "relevance", "creation_date". You can use the sign "+" to make it order ascending, or "-" to make it descending. By default is "relevance-"

When asked for latest threats, prioritize campaigns or vulnerabilities over reports.

Args: query (required): Search query to find threats. collection_type: Filter your search results to a specific type of threat limit: Limit the number of threats to retrieve. 5 by default. order_by: Order results by the given order key. "relevance-" by default.

Returns: List of collections, aka threats. They are full collection objects, you do not need to retrieve themusing the get_collection_reporttool. You may need to extend with relationships usingget_entities_related_to_a_collection` tool.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
collection_typeNo
limitNo
order_byNorelevance-
api_keyNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the 'search_threats' MCP tool. It is decorated with @server.tool(), accepts a query, optional collection_type filter, limit, order_by, and api_key. It builds a filter string (optionally prepending 'collection_type:<type>' if provided) and calls utils.consume_vt_iterator to query the '/collections' endpoint of the VirusTotal/Google Threat Intelligence API.
    @server.tool()
    async def search_threats(
        ctx: Context,
        query: str,
        collection_type: str = None,
        limit: int = 5,
        order_by: str = "relevance-",
        api_key: str = None,
    ) -> typing.List[typing.Dict[str, typing.Any]]:
      """Search threats in the Google Threat Intelligence platform.
    
      Threats are modeled as collections. Once you get collections from this tool, you can use `get_collection_report` to fetch the full reports and their relationships.
    
      **IMPORTANT CONTEXT CLUE:** Pay close attention to the user's request. If their request mentions specific *kinds* of threats such as "threat actor", "malware family", "campaign", "report", or "vulnerability", treat this as a strong signal that you **must** use the `collection_type` filter in your `query` to ensure relevant results. Using this filter significantly improves search precision.
    
      **Filtering by Type:**
      To filter your search results to a specific *type* of threat, include the `collection_type` modifier *within your query string*.
      Syntax: `collection_type:"<type>"`
      Available `<type>` values:
        - "threat-actor": Use when the user asks about specific actors, groups, or APTs.
        - "malware-family": Use when the user asks about malware, trojans, viruses, ransomware families.
        - "software-toolkit": Use when the user asks about legit tools usually related to malware.
        - "campaign": Use when the user asks about specific attack campaigns.
        - "report": Use when the user is looking for analysis reports.
        - "vulnerability": Use when the user asks about specific CVEs or vulnerabilities.
        - "collection": A generic type, use only if no other type fits or if the user explicitly asks for generic "collections".
    
      You can use order_by to sort the results by: "relevance", "creation_date". You can use the sign "+" to make it order ascending, or "-" to make it descending. By default is "relevance-"
    
      When asked for latest threats, prioritize campaigns or vulnerabilities over reports.
    
      Args:
        query (required): Search query to find threats.
        collection_type: Filter your search results to a specific *type* of threat
        limit: Limit the number of threats to retrieve. 5 by default.
        order_by: Order results by the given order key. "relevance-" by default.
    
      Returns:
        List of collections, aka threats. They are full collection objects, you do not need to retrieve them`using the `get_collection_report` tool. You may need to extend with relationships using `get_entities_related_to_a_collection` tool.
      """
      filter = ""
      if collection_type:
        if collection_type not in COLLECTION_TYPES:
          raise ValueError(
              f"unknown collection_type. Available are {','.join(COLLECTION_TYPES)}")
        filter += f"collection_type:{collection_type} "
      if query:
        filter += query
      
      async with vt_client(ctx, api_key=api_key) as client:
        res = await utils.consume_vt_iterator(
            client,
            "/collections",
            params={
                "filter": filter,
                "order": order_by,
                "relationships": COLLECTION_KEY_RELATIONSHIPS,
                "exclude_attributes": COLLECTION_EXCLUDED_ATTRS,
            },
            limit=limit,
        )
      return utils.sanitize_response([o.to_dict() for o in res])
  • Schema definitions used by search_threats: COLLECTION_RELATIONSHIPS (list of valid relationship names), COLLECTION_KEY_RELATIONSHIPS (just 'associations'), COLLECTION_EXCLUDED_ATTRS ('aggregations'), and COLLECTION_TYPES (set of valid collection types like 'threat-actor', 'malware-family', 'campaign', 'report', 'software-toolkit', 'vulnerability', 'collection').
    COLLECTION_RELATIONSHIPS = [
        "associations",
        "attack_techniques",
        "domains",
        "files",
        "ip_addresses",
        "urls",
        "threat_actors",
        "malware_families",
        "software_toolkits",
        "campaigns",
        "vulnerabilities",
        "reports",
        "suspected_threat_actors",
        "hunting_rulesets",
    ]
    
    COLLECTION_KEY_RELATIONSHIPS = [
        "associations",
    ]
    COLLECTION_EXCLUDED_ATTRS = ",".join(["aggregations"])
    
    COLLECTION_TYPES = {
        "threat-actor",
        "malware-family",
        "campaign",
        "report",
        "software-toolkit",
        "vulnerability",
        "collection",
    }
  • A helper async function _search_threats_by_collection_type that searches threats filtered by a specific collection_type. Called by other specialized search tools (e.g., search_campaigns, search_threat_actors) but not directly by search_threats itself.
    async def _search_threats_by_collection_type(
        query: str,
        collection_type: str,
        ctx: Context,
        limit: int = 10,
        order_by: str = "relevance-",
        api_key: str = None,
    ) -> typing.List[typing.Dict[str, typing.Any]]:
      """Search a given threat type in the Google Threat Intelligence platform,
    
      Args:
        query (required): Search query to find threats. If you want any threat, just pass an empty string.
        collection_type (required): Collection type. One of: "threat-actor", "malware-family", "campaign", "report", "vulnerability", "collection".
        limit: Limit the number of threats to retrieve. 10 by default.
        order_by: Order results by the given order key. "relevance-" by default.
    
      Returns:
        List of collections, aka threats.
      """
      if collection_type not in COLLECTION_TYPES:
          raise ValueError(
              f"wrong collection_type. Available collection_type are: {','.join(COLLECTION_TYPES)} ")
    
      async with vt_client(ctx, api_key=api_key) as client:
        res = await utils.consume_vt_iterator(
            client,
            "/collections",
            params={
                "filter": f"collection_type:{collection_type} {query}",
                "order": order_by,
                "relationships": COLLECTION_KEY_RELATIONSHIPS,
                "exclude_attributes": COLLECTION_EXCLUDED_ATTRS,
            },
            limit=limit,
        )
      return utils.sanitize_response([o.to_dict() for o in res])
  • The consume_vt_iterator helper used by search_threats to iterate through paginated API results from the VirusTotal client.
    async def consume_vt_iterator(
        vt_client: vt.Client, endpoint: str, params: dict | None = None, limit: int = 10):
      """Consumes a vt.Iterator iterator and return the list of objects."""
      res = []
      async for obj in vt_client.iterator(endpoint, params=params, limit=limit):
        res.append(obj)
      return res
  • The @server.tool() decorator on the search_threats function registers it as an MCP tool with the FastMCP server instance. The tools module is imported by gti_mcp/server.py via 'from gti_mcp.tools import *'.
    @server.tool()
Behavior4/5

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

No annotations provided, so description carries full burden. It discloses that threats are collections, return objects are full collection objects, and explains default ordering and limit behavior. Does not mention destructive actions, but search is inherently read-only. Could hint at pagination or API key usage, but still adds substantial value beyond schema.

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

Conciseness4/5

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

Well-structured with headings, lists, and bold text for key points. Slightly verbose in places (e.g., repeated order_by explanation in args vs. block). Could trim redundant phrasing, but overall front-loaded and efficient.

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

Completeness5/5

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

Given 5 parameters, no annotations, and high complexity, the description is complete: explains all parameters (except api_key minimally), provides filtering guidance, ordering, and links to related tools. It mentions output schema exists (returns full collection objects). Only missing api_key details, but that is common and acceptable.

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 coverage is 0%, giving no parameter descriptions. The description compensates by explaining query, collection_type with available values and usage context, limit default, order_by syntax (including +/-), and mentions api_key (though not detailed). This fully compensates for the lack of schema documentation.

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 it searches threats in the Google Threat Intelligence platform, models threats as collections, and distinguishes it from sibling tools like search_campaigns or search_malware_families by emphasizing the generic threat search with optional collection_type filtering.

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

Usage Guidelines5/5

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

Provides explicit guidance on when to use collection_type based on user request, mentions sibling tools (get_collection_report, get_entities_related_to_a_collection), explains ordering syntax, and gives priority recommendations for 'latest threats' (campaigns/vulnerabilities over reports).

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