Tool: get_rule
Get the definition and metadata of a specific Chronicle SIEM detection rule.
Retrieves the full details of a rule, including its YARA-L code, metadata, revision history, and deployment status.
Workflow Integration: - Use to inspect the logic of a rule that generated an alert. - Essential for understanding rule behavior before modifying or disabling it. - Retrieve rule text for version comparison or backup.
Use Cases: - Get the YARA-L code for a rule ID found in a SIEM alert. - Review rule metadata like author, severity, and creation date. - Check the compilation status and diagnostics of a rule.
Args: project_id (str): Google Cloud project ID (required). customer_id (str): Chronicle customer ID (required). region (str): Chronicle region (e.g., "us", "europe") (required). rule_id (str): Unique ID of the rule to retrieve. Examples: "ru_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" (latest version), "ru_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx@v_12345_67890" (specific version). view (str | None): The view to use for the rule. Defaults to "FULL". Possible values: "BASIC", "FULL", "REVISION_METADATA_ONLY", "CONFIG_ONLY", "TRENDS".
Returns: Dict[str, Any]: Raw response from the Chronicle API, typically containing the Rule object. Returns an error structure if the API call fails.
Example Usage: # Get the full definition of the latest version of a rule get_rule( project_id="my-project", customer_id="my-customer", region="us", rule_id="ru_12345678-1234-1234-1234-1234567890ab" )
# Get the basic view of a specific rule revision
get_rule(
project_id="my-project",
customer_id="my-customer",
region="us",
rule_id="ru_12345678-1234-1234-1234-1234567890ab@v_abcdef_123456",
view="BASIC"
)
The following sample demonstrate how to use curl to invoke the get_rule 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": "get_rule", "arguments": { // provide these details according to the tool's MCP specification } }, "jsonrpc": "2.0", "id": 1 }' |
Input Schema
Request message for GetRule.
GetRuleRequest
| JSON representation |
|---|
{ "projectId": string, "customerId": string, "region": string, "ruleId": string, "view": string } |
| Fields | |
|---|---|
projectId |
Project ID of the customer. |
customerId |
Customer ID of the customer. |
region |
Region of the customer. |
ruleId |
The rule to get. |
view |
The view to use. |
Output Schema
The Rule resource represents a user-created rule. NEXT TAG: 31
Rule
| JSON representation |
|---|
{ "name": string, "revisionId": string, "displayName": string, "text": string, "author": string, "severity": { object ( |
| Fields | |
|---|---|
name |
Identifier. Full resource name for the rule. Format: |
revisionId |
Output only. The revision ID of the rule. A new revision is created whenever the rule text is changed in any way. Format: |
displayName |
Output only. Display name of the rule. Populated in BASIC view and FULL view. |
text |
The YARA-L content of the rule. Populated in FULL view. |
author |
Output only. The author of the rule. Extracted from the meta section of text. Populated in BASIC view and FULL view. |
severity |
Output only. The severity of the rule as specified in the meta section of text. Populated in BASIC view and FULL view. |
metadata |
Output only. Additional metadata specified in the meta section of text. Populated in FULL view. An object containing a list of |
createTime |
Output only. The timestamp of when the rule was created. Populated in FULL view. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: |
revisionCreateTime |
Output only. The timestamp of when the rule revision was created. Populated in FULL, REVISION_METADATA_ONLY views. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: |
compilationState |
Output only. The current compilation state of the rule. Populated in FULL view. |
type |
Output only. User-facing type of the rule. Extracted from the events section of rule text. Populated in BASIC view and FULL view. |
referenceLists[] |
Output only. Resource names of the reference lists used in this rule. Populated in FULL view. |
allowedRunFrequencies[] |
Output only. The run frequencies that are allowed for the rule. Populated in BASIC view and FULL view. |
etag |
The etag for this rule. If this is provided on update, the request will succeed if and only if it matches the server-computed value, and will fail with an ABORTED error otherwise. Populated in BASIC view and FULL view. |
scope |
Resource name of the DataAccessScope bound to this rule. Populated in BASIC view and FULL view. If reference lists are used in the rule, validations will be performed against this scope to ensure that the reference lists are compatible with both the user's and the rule's scopes. The scope should be in the format: |
compilationDiagnostics[] |
Output only. A list of a rule's corresponding compilation diagnostic messages such as compilation errors and compilation warnings. Populated in FULL view. |
nearRealTimeLiveRuleEligible |
Output only. Indicate the rule can run in near real time live rule. If this is true, the rule uses the near real time live rule when the run frequency is set to LIVE. |
dataTables[] |
Output only. Resource names of the data tables used in this rule. |
inputsUsed |
Output only. The set of inputs used in the rule. For example, if the rule uses $e.principal.hostname, then the uses_udm field will be true. |
ruleOwner |
Output only. The rule owner (i.e., whether the rule is customer or Google-authored). |
tags[] |
Output only. Resource names of the tags used in this rule. Example: [ "projects/{project}/locations/{location}/instances/{instance}/ tags/google.mitre.TA000", "projects/{project}/locations/{location}/instances/{instance}/ "tags/google.CloudThreats", ] |
alertingEnabled |
Output only. Alerting status for the rule. |
liveModeEnabled |
Output only. Live Status for the rule. |
archived |
Output only. The archive state of the rule deployment. Cannot be set to true unless enabled is set to false. If set to true, alerting will automatically be set to false. If currently set to true, enabled, alerting, and run_frequency cannot be updated. |
runFrequency |
Output only. The chosen run frequencies for the rule. |
currentDayDetectionCount |
Output only. The number of matched events for the current day in UTC time. |
executionState |
Output only. The execution state of the rule. |
Severity
| JSON representation |
|---|
{ "displayName": string } |
| Fields | |
|---|---|
displayName |
The display name of the severity level. Extracted from the meta section of the rule text. |
MetadataEntry
| JSON representation |
|---|
{ "key": string, "value": string } |
| Fields | |
|---|---|
key |
|
value |
|
Timestamp
| JSON representation |
|---|
{ "seconds": string, "nanos": integer } |
| Fields | |
|---|---|
seconds |
Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be between -62135596800 and 253402300799 inclusive (which corresponds to 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z). |
nanos |
Non-negative fractions of a second at nanosecond resolution. This field is the nanosecond portion of the duration, not an alternative to seconds. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be between 0 and 999,999,999 inclusive. |
CompilationDiagnostic
| JSON representation |
|---|
{ "message": string, "position": { object ( |
| Fields | |
|---|---|
message |
Output only. The diagnostic message. |
position |
Output only. The approximate position in the rule text associated with the compilation diagnostic. Compilation Position may be empty. |
severity |
Output only. The severity of a rule's compilation diagnostic. |
uri |
Output only. Link to documentation that describes a diagnostic in more detail. |
CompilationPosition
| JSON representation |
|---|
{ "startLine": integer, "startColumn": integer, "endLine": integer, "endColumn": integer } |
| Fields | |
|---|---|
startLine |
Output only. Start line number, beginning at 1. |
startColumn |
Output only. Start column number, beginning at 1. |
endLine |
Output only. End line number, beginning at 1. |
endColumn |
Output only. End column number, beginning at 1. |
InputsUsed
| JSON representation |
|---|
{ "usesUdm": boolean, "usesEntity": boolean, "usesDetection": boolean } |
| Fields | |
|---|---|
usesUdm |
Optional. Whether the rule queries UDM events. |
usesEntity |
Optional. Whether the rule queries entity events. |
usesDetection |
Optional. Whether the rule queries detections. |
Tool Annotations
Destructive Hint: ❌ | Idempotent Hint: ✅ | Read Only Hint: ✅ | Open World Hint: ❌