Skip to main content
Glama
dstreefkerk

ms-sentinel-mcp-server

by dstreefkerk

sentinel_ml_analytics_setting_get

Retrieve specific machine learning analytics settings from Microsoft Sentinel by name to configure threat detection rules.

Instructions

Get a specific Sentinel ML analytics setting by name.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
kwargsYes

Implementation Reference

  • The SentinelMLAnalyticsSettingGetTool class defines the tool, including its name, description, and the async run method that implements the core logic for retrieving a specific Sentinel ML analytics setting by name using the Azure SecurityInsights client. It enriches the response with properties and referenced analytic rules.
    class SentinelMLAnalyticsSettingGetTool(MCPToolBase):
        """
        Tool for retrieving a specific Sentinel ML analytics setting by name.
        """
    
        name = "sentinel_ml_analytics_setting_get"
        description = "Get a specific Sentinel ML analytics setting by name."
    
        async def run(self, ctx: Context, **kwargs):
            """
            Get a specific ML analytics setting by name.
            Parameters:
                setting_name (str, required): The name of the ML analytics setting.
            Returns MCP-compliant dict with 'setting', 'valid', 'errors', and 'error'.
            """
            logger = self.logger
            # Extract parameters using the base class method
            setting_name = self._extract_param(kwargs, "setting_name")
            result = {"setting": {}, "valid": False, "errors": []}
            if not setting_name:
                error_msg = "Missing required parameter: setting_name"
                logger.error(error_msg)
                result["error"] = error_msg
                result["errors"].append(error_msg)
                return result
            workspace_name, resource_group, subscription_id = self.get_azure_context(ctx)
            if not (workspace_name and resource_group and subscription_id):
                error_msg = (
                    "Missing required Azure context (workspace_name, resource_group, "
                    "subscription_id)."
                )
                logger.error(error_msg)
                result["error"] = error_msg
                result["errors"].append(error_msg)
                return result
            try:
                client = self.get_securityinsight_client(subscription_id)
                s = client.security_ml_analytics_settings.get(
                    resource_group, workspace_name, setting_name
                )
                s_dict = s.as_dict() if hasattr(s, "as_dict") else dict(s)
                enriched = {
                    "id": s_dict.get("id"),
                    "name": s_dict.get("name"),
                    "kind": s_dict.get("kind"),
                    "etag": s_dict.get("etag"),
                    "type": s_dict.get("type"),
                    "description": s_dict.get("description"),
                    "display_name": s_dict.get("display_name"),
                    "enabled": s_dict.get("enabled"),
                    "last_modified_utc": s_dict.get("last_modified_utc"),
                    "required_data_connectors": s_dict.get("required_data_connectors"),
                    "tactics": s_dict.get("tactics"),
                    "techniques": s_dict.get("techniques"),
                    "anomaly_version": s_dict.get("anomaly_version"),
                    "customizable_observations": s_dict.get("customizable_observations"),
                    "frequency": s_dict.get("frequency"),
                    "settings_status": s_dict.get("settings_status"),
                    "is_default_settings": s_dict.get("is_default_settings"),
                    "anomaly_settings_version": s_dict.get("anomaly_settings_version"),
                    "settings_definition_id": s_dict.get("settings_definition_id"),
                    "properties": None,
                    "referenced_by_analytic_rules": [],
                }
                # Parse 'properties' if present
                props = getattr(s, "properties", None)
                if props is not None:
                    if hasattr(props, "as_dict"):
                        enriched["properties"] = props.as_dict()
                    elif isinstance(props, dict):
                        enriched["properties"] = props
                    else:
                        enriched["properties"] = {"raw": str(props)}
                # Attempt to find analytic rules that reference this ML setting
                analytic_rules = []
                for rule in client.alert_rules.list(resource_group, workspace_name):
                    rule_dict = rule.as_dict() if hasattr(rule, "as_dict") else dict(rule)
                    found_ref = False
                    for val in rule_dict.values():
                        if isinstance(val, str) and (
                            enriched["name"] in val or enriched["id"] in val
                        ):
                            found_ref = True
                        elif isinstance(val, dict):
                            if any(
                                enriched["name"] in str(v) or enriched["id"] in str(v)
                                for v in val.values()
                            ):
                                found_ref = True
                        elif isinstance(val, list):
                            if any(
                                enriched["name"] in str(v) or enriched["id"] in str(v)
                                for v in val
                            ):
                                found_ref = True
                    if found_ref:
                        analytic_rules.append(
                            {
                                "rule_name": rule_dict.get(
                                    "display_name", rule_dict.get("name")
                                ),
                                "rule_id": rule_dict.get("id"),
                                "rule_kind": rule_dict.get("kind"),
                            }
                        )
                enriched["referenced_by_analytic_rules"] = analytic_rules
                result["setting"] = enriched
                result["valid"] = True
            except Exception as ex:
                error_msg = f"Error retrieving ML analytics setting: {ex}"
                logger.exception(error_msg)
                result["error"] = error_msg
                result["errors"].append(error_msg)
            return result
  • The register_tools function registers the SentinelMLAnalyticsSettingGetTool (line 578) along with other workspace tools to the MCP server.
    def register_tools(mcp):
        """Register all Sentinel workspace-related tools with the MCP server instance."""
        SentinelWorkspaceGetTool.register(mcp)
        SentinelSourceControlsListTool.register(mcp)
        SentinelSourceControlGetTool.register(mcp)
        SentinelMetadataListTool.register(mcp)
        SentinelMetadataGetTool.register(mcp)
        SentinelMLAnalyticsSettingsListTool.register(mcp)
        SentinelMLAnalyticsSettingGetTool.register(mcp)
  • Docstring in the run method defines the input schema (setting_name: str required) and output format.
    async def run(self, ctx: Context, **kwargs):
        """
        Get a specific ML analytics setting by name.
        Parameters:
            setting_name (str, required): The name of the ML analytics setting.
        Returns MCP-compliant dict with 'setting', 'valid', 'errors', and 'error'.
        """
Behavior2/5

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

With no annotations provided, the description lacks behavioral details. It doesn't specify if this is a read-only operation, what permissions are required, error handling, or the response format. The description only states the action without behavioral context.

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, clear sentence with no wasted words. It's front-loaded and efficiently conveys the core action, making it easy to parse.

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?

For a tool with no annotations, 0% schema coverage, and no output schema, the description is insufficient. It doesn't cover parameter details, behavioral traits, or usage context, leaving significant gaps for an AI agent to understand and invoke the tool correctly.

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

Parameters2/5

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

Schema description coverage is 0%, and the description mentions 'by name' but doesn't explain the 'kwargs' parameter's format or usage. It adds minimal semantics beyond the schema, failing to compensate for the coverage gap.

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 verb ('Get') and resource ('a specific Sentinel ML analytics setting'), making the purpose evident. However, it doesn't differentiate from its sibling 'sentinel_ml_analytics_settings_list', which retrieves multiple settings instead of one by name.

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?

No guidance is provided on when to use this tool versus alternatives. It doesn't mention the sibling 'sentinel_ml_analytics_settings_list' for listing all settings or prerequisites like authentication needs.

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