Tool: generate_rules
Generates one or more YARA-L (YL2) rules based on the provided Threat Detection Opportunity (TDO).
Creates draft detection rules and initial metadata (name, description, MITRE ATT&CK mapping) from a structured threat description. This tool is essential for closing coverage gaps when an emerging threat is identified but not adequately detected by existing rules.
Workflow Integration:
- This tool is typically called AFTER
generate_threat_detection_opportunityand if a subsequent coverage analysis identifies a gap. - The resulting rules can be validated against synthetic UDM events if provided in the request.
- Generated rules are intended to be reviewed by a detection engineer before deployment.
Use Cases:
- Generate a new YARA-L rule for a provided Threat Detection Opportunity (TDO).
- Create detection logic for a specific TTP (Tactics, Techniques, and Procedures) identified in threat intelligence.
Example: Rule: rule suspicious_powershell_execution { meta: description = "Detects suspicious powershell execution with encoded command line arguments" mitre_attack_tactic = "Execution" mitre_attack_technique = "Command and Scripting Interpreter: PowerShell" events: $e.metadata.event_type = "PROCESS_LAUNCH" $e.target.process.command_line = /powershell.*(-e|-enc|-encodedcommand).*/i condition: $e }
Example Usage:
-
generate_rules(projectId='my-project', customerId='my-customer', region='us', threatDetectionOpportunity=my_tdo)
The following sample demonstrate how to use curl
to invoke the generate_rules
MCP tool.
| Curl Request |
|---|
curl --location 'https://chronicle.googleapis.com/mcp' \ --header 'content-type: application/json' \ --header 'accept: application/json, text/event-stream' \ --data '{ "method": "tools/call", "params": { "name": "generate_rules", "arguments": { // provide these details according to the tool' s MCP specification } } , "jsonrpc" : "2.0" , "id" : 1 } ' |
Input Schema
Request message for GenerateRulesRequest.
GenerateRulesRequest
| JSON representation |
|---|
{ "projectId" : string , "customerId" : string , "region" : string , // Union field |
projectId
string
Required. Google Cloud project ID.
customerId
string
Required. Chronicle customer ID.
region
string
Required. Chronicle region (e.g., "us", "europe").
rule_gen_source
. The originating artifacts that should be used to generate a rule. rule_gen_source
can be only one of the following:threatDetectionOpportunity
object (
ThreatDetectionOpportunity
)
The structured threat description (TDO) used as the basis for rule generation.
ThreatDetectionOpportunity
| JSON representation |
|---|
{ "summary" : string , "mitreInfo" : { object ( |
| Fields | |
|---|---|
summary
|
Concise, one sentence summary. |
mitreInfo
|
MITRE ATT&CK details for the Threat Detection Opportunity. |
supportingEvidence[]
|
Free-form text of supporting evidence for the Threat Detection Opportunity extracted from the threat. |
observables
|
Detection opportunity observables - hostnames, IP's, etc. |
logTypes[]
|
Resource names of log types associated with the Threat Detection Opportunity. |
MitreInfo
| JSON representation |
|---|
{ "tactics" : [ string ] , "techniques" : [ string ] , "platform" : string , "procedure" : string , "detectionStrategy" : string } |
| Fields | |
|---|---|
tactics[]
|
Optional. MITRE ATT&CK tactics. |
techniques[]
|
Optional. MITRE ATT&CK techniques. |
platform
|
Platform the technique is associated with. |
procedure
|
MITRE ATT&CK procedure. |
detectionStrategy
|
Detection strategy for the Threat Detection Opportunity. |
ObservableCollection
| JSON representation |
|---|
{ "atomics" : { object ( |
| Fields | |
|---|---|
atomics
|
Context-free IOCs. |
procedures
|
Context-dependent tactics, techniques, and procedures. |
AtomicIndicatorCollection
| JSON representation |
|---|
{ "hashes" : [ string ] , "domains" : [ string ] , "urls" : [ string ] , "ipAddresses" : [ string ] , "emails" : [ string ] , "ports" : [ integer ] } |
| Fields | |
|---|---|
hashes[]
|
File hashes associated with the threat. |
domains[]
|
Domains associated with the threat. |
urls[]
|
URLs associated with the threat. |
ipAddresses[]
|
IP addresses associated with the threat. |
emails[]
|
Email addresses associated with the threat. |
ports[]
|
Ports associated with the threat. |
ProcedureCollection
| JSON representation |
|---|
{ "files" : [ string ] , "registryKeys" : [ string ] , "processes" : [ string ] , "parentProcesses" : [ string ] , "userAccounts" : [ string ] } |
| Fields | |
|---|---|
files[]
|
Files associated with the threat. |
registryKeys[]
|
Registry keys associated with the threat. |
processes[]
|
Processes associated with the threat. |
parentProcesses[]
|
Parent process names associated with the threat. |
userAccounts[]
|
User accounts associated with the threat. |
Output Schema
Response message for GenerateRulesRequest.
GenerateRulesResponse
| JSON representation |
|---|
{
"generatedRules"
:
[
{
object (
|
| Fields | |
|---|---|
generatedRules[]
|
The generated Rules. |
GeneratedRule
| JSON representation |
|---|
{ "ruleText" : string , "feedbackId" : string } |
| Fields | |
|---|---|
ruleText
|
The core rule text for the generated Rule. |
feedbackId
|
The UUID of the feedback report. |
Tool Annotations
Destructive Hint: ❌ | Idempotent Hint: ❌ | Read Only Hint: ✅ | Open World Hint: ❌

