Skip to main content
Glama
dstreefkerk

ms-sentinel-mcp-server

by dstreefkerk

sentinel_analytics_rule_get

Retrieve details for a specific analytics rule in Microsoft Sentinel to analyze security alerts and automate threat detection.

Instructions

Get details for a specific analytics rule

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
kwargsYes

Implementation Reference

  • The SentinelAnalyticsRuleGetTool class defines the MCP tool 'sentinel_analytics_rule_get'. Its async 'run' method (lines 124-176) executes the tool logic: extracts 'rule_name' parameter and Azure context, retrieves the analytics rule using Azure SecurityInsights client's alert_rules.get, builds a summary dictionary with key fields and full rule details under '_full', handles various exceptions like ResourceNotFoundError and returns appropriate error dicts.
    class SentinelAnalyticsRuleGetTool(MCPToolBase):
        name = "sentinel_analytics_rule_get"
        description = "Get details for a specific analytics rule"
    
        async def run(self, ctx: Context, rule_name: str = None, **kwargs):
            """
            Get details for a specific analytics rule.
            Supports both MCP server and direct (test) invocation.
            Returns a dict with summary fields and full rule details, or error details.
            """
            logger = self.logger
            # Robust parameter extraction: support both direct and nested kwargs
            if rule_name is None:
                rule_name = self._extract_param(kwargs, "rule_name")
            workspace, resource_group, subscription_id = self.get_azure_context(ctx)
            if not (workspace and resource_group and subscription_id):
                logger.error("Missing Azure Sentinel context for analytics rule retrieval.")
                return {"error": "Missing Azure Sentinel context."}
            if not rule_name:
                logger.error("No rule_name provided for analytics rule retrieval.")
                return {"error": "No rule_name provided."}
            try:
                client = self.get_securityinsight_client(subscription_id)
                rule = client.alert_rules.get(
                    resource_group_name=resource_group,
                    workspace_name=workspace,
                    rule_id=rule_name,
                )
                if hasattr(rule, "as_dict"):
                    rule_dict = rule.as_dict()
                else:
                    rule_dict = dict(rule)
                display_name = rule_dict.get("display_name") or rule_dict.get("displayName")
                severity = rule_dict.get("severity")
                enabled = rule_dict.get("enabled")
                summary = {
                    "id": rule_dict.get("id"),
                    "name": rule_dict.get("name"),
                    "kind": rule_dict.get("kind"),
                    "displayName": display_name,
                    "severity": severity,
                    "enabled": enabled,
                }
                summary["_full"] = rule_dict
                return summary
            except ResourceNotFoundError as e:
                logger.error("Analytics rule not found: %s", e)
                return {"error": "Analytics rule not found", "details": str(e)}
            except HttpResponseError as e:
                logger.error("HTTP error retrieving analytics rule: %s", e)
                return {"error": "HTTP error", "details": str(e)}
            except Exception as e:
                logger.error(
                    "Unexpected error retrieving analytics rule '%s': %s", rule_name, e
                )
                return {"error": "Unexpected error", "details": str(e)}
  • The 'register_tools' function (lines 608-623) registers the SentinelAnalyticsRuleGetTool (line 616) and other analytics tools with the MCP server instance via the .register(mcp) class method inherited from MCPToolBase.
    def register_tools(mcp):
        """
        Register all analytics tools with the given MCP server instance.
    
        Args:
            mcp: The MCP server instance to register tools with.
        """
        SentinelAnalyticsRuleListTool.register(mcp)
        SentinelAnalyticsRuleGetTool.register(mcp)
        SentinelAnalyticsRuleTemplatesListTool.register(mcp)
        SentinelAnalyticsRuleTemplateGetTool.register(mcp)
        SentinelAnalyticsRulesCountByTacticTool.register(mcp)
        SentinelAnalyticsRuleTemplatesCountByTacticTool.register(mcp)
        SentinelAnalyticsRulesCountByTechniqueTool.register(mcp)
        SentinelAnalyticsRuleTemplatesCountByTechniqueTool.register(mcp)
  • Tool metadata: name 'sentinel_analytics_rule_get' and description define the tool's identity and purpose. Input schema implied by 'run' signature: rule_name: str (extracted via _extract_param for MCP compatibility). Output: dict with summary fields (id, name, kind, displayName, severity, enabled) and _full rule details.
    class SentinelAnalyticsRuleGetTool(MCPToolBase):
        name = "sentinel_analytics_rule_get"
        description = "Get details for a specific analytics rule"
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states 'Get details' which implies a read-only operation, but fails to describe any behavioral traits like authentication requirements, rate limits, error handling, or what 'details' include (e.g., rule configuration, status). This leaves significant gaps for a tool with no structured safety hints.

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 a single, efficient sentence that directly states the tool's purpose without any unnecessary words. It's appropriately sized and front-loaded, making it easy to parse quickly, which is ideal for conciseness in tool descriptions.

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

Completeness2/5

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

Given the complexity of a 'get details' operation with no annotations, 1 parameter at 0% coverage, and no output schema, the description is incomplete. It doesn't cover parameter semantics, behavioral context, or return values, making it inadequate for an agent to use the tool effectively without additional guesswork or documentation.

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

Parameters1/5

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

The input schema has 1 parameter ('kwargs') with 0% description coverage, and the tool description adds no information about parameters. It doesn't explain what 'kwargs' should contain (e.g., a rule ID or name), its format, or examples, failing to compensate for the lack of schema documentation and leaving the parameter completely undocumented.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get details') and resource ('a specific analytics rule'), making the purpose immediately understandable. However, it doesn't distinguish this tool from its sibling 'sentinel_analytics_rule_list' or other get tools in the server, missing explicit differentiation that would warrant a score of 5.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'sentinel_analytics_rule_list' for listing rules or other get tools in the server. It lacks context about prerequisites, such as needing a rule identifier, or exclusions, leaving the agent with no usage direction beyond the basic purpose.

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/dstreefkerk/ms-sentinel-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server