Skip to main content
Glama
dstreefkerk

ms-sentinel-mcp-server

by dstreefkerk

sentinel_metadata_get

Retrieve specific Microsoft Sentinel metadata details by ID to access security information and configuration data for analysis.

Instructions

Get details for specific Sentinel metadata by ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
kwargsYes

Implementation Reference

  • The run method implements the core handler logic for the 'sentinel_metadata_get' tool. It extracts the metadata_id parameter, retrieves the metadata from the Azure Sentinel client, serializes it using a helper function, and returns a structured result including validation status and any errors.
    async def run(self, ctx: Context, **kwargs):
        """
        Get details for specific metadata by ID.
    
        Parameters:
            metadata_id (str, required): The ID of the metadata object to retrieve.
        Returns:
            dict: {
                'metadata': dict,
                'valid': bool,
                'errors': list[str],
                'error': str (optional, present only if an error occurs)
            }
        Output Fields:
            - metadata: Metadata object (id, name, kind, 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
        # Accept both 'metadata_id' and 'id' as input keys using the base class method
        metadata_id = self._extract_param(kwargs, "metadata_id") or self._extract_param(
            kwargs, "id"
        )
        logger.debug("SentinelMetadataGetTool metadata_id: %r", metadata_id)
        # If a full ARM resource ID is provided, extract the short name (last segment)
        if metadata_id and "/" in metadata_id:
            metadata_id = metadata_id.rstrip("/").split("/")[-1]
        result = {
            "metadata": {},
            "valid": False,
            "errors": [],
        }
        if not metadata_id:
            error_msg = (
                "Missing required parameter: metadata_id or id. Provide either "
                "the short name or the full ARM resource 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)
            meta = client.metadata.get(resource_group, workspace_name, metadata_id)
    
            def _serialize_model(obj):
                if hasattr(obj, "as_dict"):
                    return obj.as_dict()
                elif hasattr(obj, "__dict__"):
                    # fallback, filter out private attributes
                    return {
                        k: v for k, v in obj.__dict__.items() if not k.startswith("_")
                    }
                elif obj is None:
                    return None
                else:
                    return str(obj)
    
            result["metadata"] = {
                "id": getattr(meta, "id", None),
                "name": getattr(meta, "name", None),
                "kind": getattr(meta, "kind", None),
                "content_id": getattr(meta, "content_id", None),
                "version": getattr(meta, "version", None),
                "parent_id": getattr(meta, "parent_id", None),
                "author": _serialize_model(getattr(meta, "author", None)),
                "source": _serialize_model(getattr(meta, "source", None)),
                "support": _serialize_model(getattr(meta, "support", None)),
                "categories": getattr(meta, "categories", None),
                "dependencies": getattr(meta, "dependencies", None),
                "created": str(getattr(meta, "created", "")),
                "last_modified": str(getattr(meta, "last_modified", "")),
            }
            result["valid"] = True
        except Exception as ex:
            error_msg = f"Error retrieving metadata: {ex}"
            logger.exception(error_msg)
            result["error"] = error_msg
            result["errors"].append(error_msg)
        return result
  • The register_tools function registers the SentinelMetadataGetTool (which provides the 'sentinel_metadata_get' tool) with the MCP server instance via the class's register method.
    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)
  • Tool name, description, input parameters (metadata_id), and output schema/format are defined here in the class and run method docstring.
    name = "sentinel_metadata_get"
    description = "Get details for specific Sentinel metadata by ID."
    
    async def run(self, ctx: Context, **kwargs):
        """
        Get details for specific metadata by ID.
    
        Parameters:
            metadata_id (str, required): The ID of the metadata object to retrieve.
        Returns:
            dict: {
                'metadata': dict,
                'valid': bool,
                'errors': list[str],
                'error': str (optional, present only if an error occurs)
            }
        Output Fields:
            - metadata: Metadata object (id, name, kind, 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.
        """
Behavior1/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 only states 'Get details' without explaining what 'details' include, whether it's a read-only operation, if it requires authentication, rate limits, error handling, or the response format. This leaves critical behavioral traits unspecified for a tool with one parameter.

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 function without unnecessary words. It's appropriately sized for a simple 'get' operation and front-loaded with the core action, though it lacks depth due to under-specification rather than conciseness issues.

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 (a 'get' operation with one parameter), lack of annotations, 0% schema description coverage, and no output schema, the description is incomplete. It doesn't explain what 'details' are returned, how to use the parameter, or behavioral aspects, making it inadequate for effective tool selection and invocation.

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 provides no information about parameters. It doesn't explain what 'kwargs' should contain (e.g., the ID format, expected string structure) or add any meaning beyond the bare schema. With low schema coverage, the description fails to compensate.

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

Purpose3/5

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

The description states the action ('Get details') and resource ('specific Sentinel metadata by ID'), which provides a basic purpose. However, it's vague about what 'details' include and doesn't distinguish from siblings like 'sentinel_metadata_list' (which likely lists metadata without details) or 'sentinel_incident_get' (which gets incident details). The purpose is clear but lacks specificity and sibling differentiation.

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 prerequisites (e.g., needing a valid ID), exclusions, or compare to siblings like 'sentinel_metadata_list' for listing metadata or other 'get' tools for different resource types. The description only states what it does, not when to use it.

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