Skip to main content
Glama
dstreefkerk

ms-sentinel-mcp-server

by dstreefkerk

sentinel_incident_list

List and manage security incidents in Microsoft Sentinel to monitor and respond to threats.

Instructions

List security incidents in Microsoft Sentinel

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
kwargsYes

Implementation Reference

  • The `run` method is the core handler that executes the tool logic. It extracts parameters like limit, severity, and status, queries the SecurityIncident table using KQL over the last 30 days, processes the results into a structured list of incidents, and handles errors gracefully.
    async def run(self, ctx: Context, **kwargs):
        """
        List recent security incidents in Microsoft Sentinel.
    
        Args:
            ctx (Context): MCP context object.
            **kwargs: Optional filters (limit, severity, status).
    
        Returns:
            dict: Contains 'incidents' (list), 'valid' (bool),
            'errors' (list), and optional 'message'.
        """
        logger = self.logger
    
        # Using centralized parameter extraction from MCPToolBase
        limit = self._extract_param(kwargs, "limit", 10)
        severity = self._extract_param(kwargs, "severity", None)
        status = self._extract_param(kwargs, "status", None)
    
        try:
            logs_client, workspace_id = self.get_logs_client_and_workspace(ctx)
        except Exception as e:
            logger.error("Error initializing Azure logs client: %s", e)
            return {"error": "Azure Logs client initialization failed"}
        if logs_client is None or workspace_id is None:
            return {"error": "Azure Logs client or workspace_id is not initialized"}
    
        try:
            query = """
            SecurityIncident
            | order by TimeGenerated desc
            """
            if severity:
                query += f"\n| where Severity =~ '{severity}'"
            if status:
                query += f"\n| where Status =~ '{status}'"
            query += f"\n| take {limit}"
            query += """
            | project
                IncidentNumber,
                Title,
                Severity,
                Status,
                CreatedTime=TimeGenerated,
                LastModifiedTime,
                IncidentUrl
            """
            response = await run_in_thread(
                logs_client.query_workspace,
                workspace_id=workspace_id,
                query=query,
                timespan=timedelta(days=30),
                name="get_recent_incidents",
            )
            if response and response.tables and len(response.tables[0].rows) > 0:
                incidents = []
                for row in response.tables[0].rows:
                    incident = {
                        "IncidentNumber": row[0],
                        "Title": row[1],
                        "Severity": row[2],
                        "Status": row[3],
                        "CreatedTime": row[4],
                        "LastModifiedTime": row[5],
                        "IncidentUrl": row[6] if len(row) > 6 else None,
                    }
                    incidents.append(incident)
                return {"incidents": incidents, "valid": True, "errors": []}
    
            filters = []
            if severity:
                filters.append(f"severity={severity}")
            if status:
                filters.append(f"status={status}")
            filter_text = ""
            if filters:
                filter_text = f" with filters ({', '.join(filters)})"
            logger.info("No incidents found%s in the last 30 days.", filter_text)
            return {
                "incidents": [],
                "valid": True,
                "errors": [],
                "message": f"No incidents found{filter_text} in the last 30 days.",
            }
        except Exception as e:
            logger.error("Error retrieving incidents: %s", e)
            return {
                "incidents": [],
                "valid": False,
                "errors": ["Error retrieving incidents"],
            }
  • The `register_tools` function registers the SentinelIncidentListTool (sentinel_incident_list) with the MCP server instance.
    def register_tools(mcp: FastMCP):
        """
        Register incident tools with the MCP server.
    
        Args:
            mcp (FastMCP): The MCP server instance.
        """
        SentinelIncidentListTool.register(mcp)
        SentinelIncidentDetailsTool.register(mcp)
  • The class defines the tool name 'sentinel_incident_list' and description, along with docstrings describing inputs (filters: limit, severity, status) and outputs (list of incidents).
    class SentinelIncidentListTool(MCPToolBase):
        """
        Tool for listing security incidents in Microsoft Sentinel.
    
        Returns a list of recent incidents with summary fields.
    
        Supports filtering by severity and status.
        """
    
        name = "sentinel_incident_list"
        description = "List security incidents in Microsoft Sentinel"
Behavior1/5

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

With no annotations provided, the description carries full burden for behavioral disclosure but offers none. It doesn't indicate whether this is a read-only operation, what permissions are required, if there are rate limits, pagination behavior, or what format the results take. 'List' implies a read operation but lacks critical operational 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, efficient sentence with zero wasted words. It's appropriately sized for a basic listing operation and front-loads the core purpose immediately.

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

Completeness1/5

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

Given the complexity of security incident listing (likely involving filtering, pagination, permissions), no annotations, no output schema, and 0% parameter documentation, this description is completely inadequate. It provides only the most basic purpose statement without any operational or contextual details needed for effective tool use.

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 schema has 0% description coverage for its single 'kwargs' parameter, and the tool description provides absolutely no information about what this parameter expects or how to use it. The description doesn't mention parameters at all, leaving the agent with no semantic understanding of required inputs.

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 ('List') and resource ('security incidents in Microsoft Sentinel'), providing a specific verb+resource combination. However, it doesn't differentiate from sibling tools like 'sentinel_incident_get' which retrieves a single incident, leaving some ambiguity about scope.

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_incident_get' for single incidents or 'sentinel_logs_search' for broader data queries. There's no mention of prerequisites, filtering capabilities, or comparison to similar list operations in the sibling set.

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