Exclude noisy fields from collection and file behavior responses - #275
Open
avadhsonagara wants to merge 1 commit into
Open
Exclude noisy fields from collection and file behavior responses#275avadhsonagara wants to merge 1 commit into
avadhsonagara wants to merge 1 commit into
Conversation
Also fixes a rule_types comparison bug and loosens its type to Optional[List[str]].
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
avadhsonagara
marked this pull request as ready for review
July 14, 2026 10:28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Several GTI MCP tools return large, noisy response payloads that bloat context and crowd out the fields that actually matter for analysis. This PR trims known-noisy/verbose fields from four tool responses — either via the VirusTotal API's
exclude_attributesparam (cheaper, filtered server-side) or a newutils.remove_fieldshelper for endpoints where that param isn't supported or doesn't reach nested sub-fields.Also included: a
rule_type/rule_typescomparison bug fix inget_collection_rules, and loosening itsrule_typesparam toOptional[List[str]]so an explicitnullvalidates correctly over the MCP protocol.Changes
Excluded fields by tool
get_entities_related_to_a_file(relationshipbehaviours)memory_dumps,processes_terminated,registry_keys_opened,files_written,files_deleted,files_opened,files_dropped,processes_tree,processes_created,signature_matchesget_file_behavior_summaryfiles_opened,modules_loaded,mutexes_created,mutexes_opened,processes_terminated,processes_tree,registry_keys_opened,tags,text_highlighted,registry_keys_deleted,signature_matches,files_written,memory_dumps,http_conversations,files_deleted,files_copied,files_dropped,ids_alerts,registry_keys_set,processes_created,command_executions,ip_traffic,attack_techniques,memory_pattern_urls,memory_pattern_domains,processes_injectedget_collections_commonalitiesattributes.aggregations.files.{itw_urls, execution_parents, compressed_parents, pcap_parents, dropped_files_sha256, email_parents, tags, main_icon_dhash, main_icon_raw_md5, vhash, imphash, behash, tlshhash, attributions, crowdsourced_ids_results, crowdsourced_yara_results, embedded_domains, embedded_ips, mutexes_created, mutexes_opened, registry_keys_deleted, registry_keys_opened, registry_keys_set, file_types, crowdsourced_sigma_results, debug_codeview_guids, debug_codeview_names, debug_timestamps, dropped_files_path, exiftool_authors, exiftool_create_dates, exiftool_creators, exiftool_last_printed, exiftool_producers, exiftool_subjects, exiftool_titles, filecondis_dhash, netassembly_mvid, office_application_names, office_authors, office_creation_datetimes, office_last_saved, pe_info_imports, pe_info_exports, pe_info_section_md5, pe_info_section_names, sandbox_verdicts, memory_pattern_urls, embedded_urls, parent_contacted_domains}search_vulnerabilitiescpes,vendor_fix_references,sources,version_history,field_sources,tags_details,alt_names_detailsSupporting changes
utils.py: addedremove_fields(data, field_paths)— removes dotted-path fields (e.g.attributes.aggregations.files.tags) from a response dict in place, for endpoints where the API'sexclude_attributescan't reach nested sub-fields or isn't supported at all.collections.py:_search_threats_by_collection_typenow accepts an optionalextra_excluded_attrslist, used bysearch_vulnerabilitiesto layerVULNERABILITY_EXCLUDED_ATTRSon top of the sharedCOLLECTION_EXCLUDED_ATTRS.collections.py: fixedget_collection_rulesfiltering the wrong loop variable (rule_type not in rule_type→rule_type not in rule_types), and widenedrule_typestoOptional[List[str]].Test plan
get_entities_related_to_a_filesendsexclude_attributes=FILE_BEHAVIOUR_EXCLUDED_ATTRSfor thebehavioursrelationship.get_file_behavior_summarystripsFILE_BEHAVIOR_SUMMARY_EXCLUDED_ATTRSfrom the response.get_collections_commonalitiesfixture/expected output to reflect stripped fields.get_collections_commonalitieserror path when the API response has nodatakey.search_vulnerabilitiessends the combinedexclude_attributeslist.get_collection_ruleswith an invalidrelationship_nameand with explicitrule_types: null.pytest server/gti/tests/test_tools.py) locally before merge.