Skip to main content
Glama
dstreefkerk

ms-sentinel-mcp-server

by dstreefkerk

sentinel_watchlist_get

Retrieve a specific watchlist from Microsoft Sentinel to monitor and analyze security threats using defined criteria and configurations.

Instructions

Get a specific Sentinel watchlist

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
kwargsYes

Implementation Reference

  • The main execution handler for the sentinel_watchlist_get tool. It extracts the watchlist_alias parameter, initializes the SecurityInsights client, retrieves the watchlist using client.watchlists.get, and constructs a details dictionary from the watchlist properties.
    async def run(self, ctx: Context, **kwargs):
        logger = self.logger
    
        # Extract parameters using the centralized parameter extraction from MCPToolBase
        watchlist_alias = self._extract_param(kwargs, "watchlist_alias")
        if not watchlist_alias:
            return {"error": "watchlist_alias parameter is required"}
    
        # Get Azure context
        workspace_name, resource_group, subscription_id = self.get_azure_context(ctx)
    
        # Get security insights client
        client = None
        try:
            client = self.get_securityinsight_client(subscription_id)
        except Exception as e:
            logger.error("Error initializing Azure SecurityInsights client: %s", e)
            return {
                "error": (
                    "Azure SecurityInsights client initialization failed: %s" % str(e)
                )
            }
    
        if client is None:
            return {"error": "Azure SecurityInsights client is not initialized"}
    
        try:
            # Get the specific watchlist
            watchlist = await run_in_thread(
                client.watchlists.get,
                resource_group_name=resource_group,
                workspace_name=workspace_name,
                watchlist_alias=watchlist_alias,
            )
    
            # Log the watchlist object to understand its structure
            logger.debug("Watchlist object: %s", watchlist)
    
            # Create a basic info dictionary with guaranteed attributes
            watchlist_details = {
                "id": watchlist.id if hasattr(watchlist, "id") else None,
                "name": watchlist.name if hasattr(watchlist, "name") else None,
            }
    
            # Try to access properties directly from the watchlist object first
            try:
                # Check for direct properties on the watchlist object
                if hasattr(watchlist, "watchlist_alias"):
                    watchlist_details["alias"] = watchlist.watchlist_alias
                if hasattr(watchlist, "display_name"):
                    watchlist_details["displayName"] = watchlist.display_name
                if hasattr(watchlist, "description"):
                    watchlist_details["description"] = watchlist.description
                if hasattr(watchlist, "provider"):
                    watchlist_details["provider"] = watchlist.provider
                if hasattr(watchlist, "source"):
                    watchlist_details["source"] = watchlist.source
                if hasattr(watchlist, "items_search_key"):
                    watchlist_details["itemsSearchKey"] = watchlist.items_search_key
                if hasattr(watchlist, "created_time_utc"):
                    watchlist_details["created"] = watchlist.created_time_utc
                if hasattr(watchlist, "updated_time_utc"):
                    watchlist_details["updated"] = watchlist.updated_time_utc
                if hasattr(watchlist, "items_count"):
                    watchlist_details["itemsCount"] = watchlist.items_count
    
                # If we couldn't find any direct properties, try the nested properties approach
                if len(watchlist_details) <= 2 and hasattr(watchlist, "properties"):
                    props = watchlist.properties
                    if hasattr(props, "watchlist_alias"):
                        watchlist_details["alias"] = props.watchlist_alias
                    if hasattr(props, "display_name"):
                        watchlist_details["displayName"] = props.display_name
                    if hasattr(props, "description"):
                        watchlist_details["description"] = props.description
                    if hasattr(props, "provider"):
                        watchlist_details["provider"] = props.provider
                    if hasattr(props, "source"):
                        watchlist_details["source"] = props.source
                    if hasattr(props, "items_search_key"):
                        watchlist_details["itemsSearchKey"] = props.items_search_key
                    if hasattr(props, "created_time_utc"):
                        watchlist_details["created"] = props.created_time_utc
                    if hasattr(props, "updated_time_utc"):
                        watchlist_details["updated"] = props.updated_time_utc
                    if hasattr(props, "items_count"):
                        watchlist_details["itemsCount"] = props.items_count
            except Exception as prop_error:
                # Log the property access error but continue with basic details
                logger.error("Error accessing watchlist properties: %s", prop_error)
    
            return {"watchlist": watchlist_details, "valid": True}
        except Exception as e:
            logger.error(
                "Error retrieving watchlist details for alias %s: %s",
                watchlist_alias,
                e,
            )
            return {
                "error": "Error retrieving watchlist details for alias %s: %s"
                % (watchlist_alias, e)
            }
  • Tool name and description defining the tool's identity and purpose. Input expects 'watchlist_alias' parameter.
    name = "sentinel_watchlist_get"
    description = "Get a specific Sentinel watchlist"
  • Registration of the SentinelWatchlistGetTool class with the FastMCP server instance.
    SentinelWatchlistGetTool.register(mcp)
  • Class definition inheriting from MCPToolBase, which provides the tool structure including the run method.
    class SentinelWatchlistGetTool(MCPToolBase):
        """
        Tool for retrieving a specific Microsoft Sentinel watchlist by alias.
        """
Behavior1/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure but offers no details. It doesn't indicate if this is a read-only operation, requires authentication, has rate limits, returns structured data, or involves side effects. The vague 'Get' provides no transparency into how the tool behaves or what to expect from its execution.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, straightforward sentence with no wasted words, making it highly concise. However, it's under-specified rather than optimally structured—it lacks front-loaded critical details but isn't verbose. This efficiency in length, despite content gaps, justifies a score above average for conciseness.

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 tool's complexity (retrieving a specific resource), lack of annotations, 0% schema coverage, no output schema, and many sibling tools, the description is severely incomplete. It doesn't clarify what 'specific' means, how to identify the watchlist, what data is returned, or how it differs from related tools. This inadequacy fails to provide the context 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 input schema has 1 parameter ('kwargs') with 0% description coverage, meaning the schema provides no semantic information. The description adds no parameter details—it doesn't explain what 'kwargs' should contain (e.g., a watchlist ID, name, or filter criteria) or how to format it. This fails to compensate for the schema's lack of coverage, leaving parameters entirely undocumented.

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

Purpose2/5

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

The description 'Get a specific Sentinel watchlist' restates the tool name with minimal elaboration. It uses a verb ('Get') and resource ('Sentinel watchlist'), but lacks specificity about what 'get' entails (e.g., retrieve metadata, fetch details) and doesn't distinguish it from siblings like 'sentinel_watchlists_list' or 'sentinel_watchlist_item_get'. This is a tautological expansion of the name, earning a low score.

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

Usage Guidelines1/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 siblings like 'sentinel_watchlists_list' for listing all watchlists or 'sentinel_watchlist_item_get' for items within a watchlist, nor does it specify prerequisites or contexts for retrieval. This absence of usage instructions makes it misleading for an agent trying to select the right tool.

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