Skip to main content
Glama
wagonbomb

Megaraptor MCP

by wagonbomb

check_agent_deployment

Verify which agents have successfully enrolled with a specific deployment in the Velociraptor platform, allowing you to monitor endpoint enrollment status and filter results by client hostname or labels.

Instructions

Verify agent enrollment status for a deployment.

Checks which agents have successfully enrolled with the server.

Args: deployment_id: The deployment to check client_search: Optional search filter for client hostname/ID labels: Filter by client labels

Returns: List of enrolled clients and their status.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deployment_idYes
client_searchNo
labelsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The 'check_agent_deployment' function implements agent enrollment verification using a VQL query to the Velociraptor client API. It categorizes clients by their last seen time as either online or offline.
    async def check_agent_deployment(
        deployment_id: str,
        client_search: Optional[str] = None,
        labels: Optional[list[str]] = None,
    ) -> list[TextContent]:
        """Verify agent enrollment status for a deployment.
    
        Checks which agents have successfully enrolled with the server.
    
        Args:
            deployment_id: The deployment to check
            client_search: Optional search filter for client hostname/ID
            labels: Filter by client labels
    
        Returns:
            List of enrolled clients and their status.
        """
        try:
            from ..client import get_client
    
            client = get_client()
    
            # Build VQL query
            conditions = []
            if client_search:
                conditions.append(f"os_info.hostname =~ '{client_search}' OR client_id =~ '{client_search}'")
            if labels:
                label_conditions = " OR ".join(f"'{l}' in labels" for l in labels)
                conditions.append(f"({label_conditions})")
    
            where_clause = f" WHERE {' AND '.join(conditions)}" if conditions else ""
            vql = f"""
            SELECT client_id, os_info.hostname AS hostname, os_info.system AS os,
                   labels, last_seen_at, first_seen_at
            FROM clients()
            {where_clause}
            ORDER BY last_seen_at DESC
            LIMIT 100
            """
    
            results = client.query(vql)
    
            # Categorize by status
            now = datetime.now(timezone.utc)
            online = []
            offline = []
    
            for r in results:
                last_seen = r.get("last_seen_at", 0)
                if isinstance(last_seen, (int, float)):
                    last_seen_dt = datetime.fromtimestamp(last_seen / 1000000, tz=timezone.utc)
                    minutes_ago = (now - last_seen_dt).total_seconds() / 60
                    r["minutes_since_seen"] = round(minutes_ago, 1)
                    if minutes_ago < 10:
                        online.append(r)
                    else:
                        offline.append(r)
                else:
                    offline.append(r)
    
            return [TextContent(
                type="text",
                text=json.dumps({
                    "deployment_id": deployment_id,
                    "total_clients": len(results),
                    "online": len(online),
                    "offline": len(offline),
                    "online_clients": online,
                    "offline_clients": offline,
                }, indent=2, default=str)
            )]
    
        except ImportError as e:
            return [TextContent(
                type="text",
                text=json.dumps({
                    "error": f"Missing dependency: {str(e)}",
                    "hint": "Install required packages with: pip install megaraptor-mcp[deployment]"
                }, indent=2)
            )]
    
        except Exception:
            # Generic errors - don't expose internals
            return [TextContent(
                type="text",
                text=json.dumps({
                    "error": "Operation failed",
                    "hint": "Check deployment configuration and try again"
                }, indent=2)
            )]
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses the return value ('List of enrolled clients and their status'), but fails to explicitly state this is a read-only operation, lacks error handling details (e.g., behavior if deployment_id doesn't exist), and omits any performance or rate-limiting considerations.

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?

Uses a structured Python-docstring format (Args/Returns) that efficiently organizes information. Front-loaded with the core purpose in the first sentence. No redundant text, though the 'Args:' and 'Returns:' labels consume space that could be narrative prose.

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

Completeness3/5

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

Adequate for a three-parameter read operation with an output schema (which excuses detailed return documentation). However, given zero annotations, the description should have explicitly confirmed the read-only nature and basic error conditions. Missing explanation of label filter logic (AND vs OR) keeps it from scoring higher.

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

Parameters4/5

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

Excellent compensation for 0% schema description coverage. The Args section clearly documents all three parameters: 'deployment_id' (scope), 'client_search' (optional filter with target fields), and 'labels' (filtering mechanism). While terse, it provides essential semantic meaning entirely missing from the schema titles.

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 tool verifies agent enrollment status using specific verbs ('Verify', 'Checks'). It effectively distinguishes from deployment-oriented siblings like 'deploy_agents_ssh' and 'destroy_deployment' by focusing on enrollment verification, though it doesn't explicitly differentiate from 'get_deployment_status' or 'validate_deployment'.

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 provided on when to use this tool versus alternatives like 'get_deployment_status' or 'validate_deployment'. No prerequisites mentioned (e.g., requiring an existing deployment), and no exclusion criteria or failure modes described.

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/wagonbomb/megaraptor-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server