Skip to main content
Glama
dstreefkerk

ms-sentinel-mcp-server

by dstreefkerk

sentinel_source_control_get

Retrieve details for a specific Microsoft Sentinel source control configuration using its unique ID to manage security monitoring data sources.

Instructions

Get details for a specific Sentinel source control by ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
kwargsYes

Implementation Reference

  • The SentinelSourceControlGetTool class implements the tool handler. It defines the tool name, description, and the async run method which extracts the source_control_id, retrieves the source control using the Azure Security Insights client, formats the response, and handles errors.
    class SentinelSourceControlGetTool(MCPToolBase):
        """
        Tool for retrieving details for a specific Sentinel source control by ID.
        """
    
        name = "sentinel_source_control_get"
        description = "Get details for a specific Sentinel source control by ID."
    
        async def run(self, ctx: Context, **kwargs):
            """
            Get details for a specific source control by ID.
    
            Parameters:
                source_control_id (str, required): The ID of the source control to
                    retrieve.
            Returns:
                dict: {
                    'source_control': dict,
                    'valid': bool,
                    'errors': list[str],
                    'error': str (optional, present only if an error occurs)
                }
            Output Fields:
                - source_control: Source control object (id, name, repo, etc.)
                - valid: True if successful, False otherwise
                - errors: List of error messages (empty if none)
                - error: Error message if an error occurs (optional)
            Error cases will always include an 'error' key for testability.
            """
            logger = self.logger
            # Extract parameters using the base class method
            source_control_id = self._extract_param(kwargs, "source_control_id")
            result = {
                "source_control": {},
                "valid": False,
                "errors": [],
            }
            if not source_control_id:
                error_msg = "Missing required parameter: source_control_id"
                logger.error("%s", error_msg)
                result["error"] = error_msg
                result["errors"].append(error_msg)
                return result
            workspace_name, resource_group, subscription_id = self.get_azure_context(ctx)
            try:
                client = self.get_securityinsight_client(subscription_id)
                ctrl = client.source_controls.get(
                    resource_group, workspace_name, source_control_id
                )
                result["source_control"] = {
                    "id": getattr(ctrl, "id", None),
                    "name": getattr(ctrl, "name", None),
                    "repo_type": getattr(ctrl, "repo_type", None),
                    "repo_url": getattr(ctrl, "repo_url", None),
                    "description": getattr(ctrl, "description", None),
                    "content_types": getattr(ctrl, "content_types", None),
                    "created_time_utc": str(getattr(ctrl, "created_time_utc", "")),
                    "last_modified_time_utc": str(
                        getattr(ctrl, "last_modified_time_utc", "")
                    ),
                }
                result["valid"] = True
            except Exception as ex:
                error_msg = "Error retrieving source control: %s" % ex
                logger.exception("%s", error_msg)
                result["error"] = error_msg
                result["errors"].append(error_msg)
            return result
  • Registers the SentinelSourceControlGetTool with the MCP server instance.
    SentinelSourceControlGetTool.register(mcp)

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