Skip to main content
Glama
wagonbomb

Megaraptor MCP

by wagonbomb

collect_artifact

Schedule forensic artifact collection from Velociraptor endpoints for digital investigation and threat hunting workflows.

Instructions

Schedule artifact collection on a Velociraptor client.

Args: client_id: The client ID (e.g., 'C.1234567890abcdef') artifacts: List of artifact names to collect parameters: Optional dict of parameters for the artifacts. Format: {"ArtifactName": {"param1": "value1"}} timeout: Query timeout in seconds (default 600) urgent: If True, prioritize this collection (default False)

Returns: Flow ID for tracking the collection.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
client_idYes
artifactsYes
parametersNo
timeoutNo
urgentNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The `collect_artifact` handler is defined here using the `@mcp.tool()` decorator, validating inputs and initiating a collection flow on the Velociraptor server.
    @mcp.tool()
    async def collect_artifact(
        client_id: str,
        artifacts: list[str],
        parameters: Optional[dict[str, Any]] = None,
        timeout: int = 600,
        urgent: bool = False,
    ) -> list[TextContent]:
        """Schedule artifact collection on a Velociraptor client.
    
        Args:
            client_id: The client ID (e.g., 'C.1234567890abcdef')
            artifacts: List of artifact names to collect
            parameters: Optional dict of parameters for the artifacts.
                       Format: {"ArtifactName": {"param1": "value1"}}
            timeout: Query timeout in seconds (default 600)
            urgent: If True, prioritize this collection (default False)
    
        Returns:
            Flow ID for tracking the collection.
        """
        try:
            # Validate inputs
            client_id = validate_client_id(client_id)
    
            if not artifacts:
                return [TextContent(
                    type="text",
                    text=json.dumps({
                        "error": "artifacts parameter is required and cannot be empty",
                        "hint": "Use list_artifacts tool to find available artifacts"
                    })
                )]
    
            if timeout < 1:
                return [TextContent(
                    type="text",
                    text=json.dumps({
                        "error": f"timeout must be at least 1 second, got {timeout}",
                        "hint": "Specify a positive timeout value in seconds"
                    })
                )]
    
            client = get_client()
    
            # Build the artifacts list
            artifacts_str = ", ".join(f"'{a}'" for a in artifacts)
    
            # Build the spec parameter if parameters are provided
            spec_part = ""
            if parameters:
                spec_json = json.dumps(parameters)
                spec_part = f", spec={spec_json}"
    
            urgent_part = ", urgent=true" if urgent else ""
    
            vql = f"""
            SELECT collect_client(
                client_id='{client_id}',
                artifacts=[{artifacts_str}],
                timeout={timeout}
                {spec_part}
                {urgent_part}
            ) AS collection
            FROM scope()
            """
    
            results = client.query(vql)
    
            if not results:
                return [TextContent(
                    type="text",
                    text=json.dumps({
                        "error": "Failed to start collection",
                        "hint": "Verify client_id exists and is online"
                    })
                )]
    
            collection = results[0].get("collection", {})
    
            return [TextContent(
                type="text",
                text=json.dumps({
                    "status": "collection_started",
                    "client_id": client_id,
                    "artifacts": artifacts,
                    "flow_id": collection.get("flow_id", ""),
                    "request": collection.get("request", {}),
                }, indent=2, default=str)
            )]
    
        except ValueError as e:
            # Validation errors
            return [TextContent(
                type="text",
                text=json.dumps({
                    "error": str(e),
                    "hint": "Check your client_id and other parameters"
                })
            )]
    
        except grpc.RpcError as e:
            # gRPC errors
            error_info = map_grpc_error(e, f"collecting artifact on client {client_id}")
            return [TextContent(
                type="text",
                text=json.dumps(error_info, indent=2)
            )]
    
        except Exception:
            # Generic errors - don't expose internals
            return [TextContent(
                type="text",
                text=json.dumps({
                    "error": "Failed to schedule artifact collection",
                    "hint": "Check Velociraptor server connection and try again"
                })
            )]
Behavior3/5

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

With no annotations provided, the description carries the full disclosure burden. It successfully indicates the async nature ('Schedule,' 'Flow ID for tracking') and timeout behavior, but fails to mention safety characteristics (read-only vs. destructive), required permissions, error conditions, or resource impact on the target client.

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 docstring-style format with explicit 'Args:' and 'Returns:' sections creates clear information hierarchy. Every line provides value—either the core purpose, parameter details with examples, or return value specification. No redundant or filler text present.

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

Completeness4/5

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

Given zero schema coverage and no annotations, the description adequately covers all input parameters and the return value (Flow ID). However, it lacks operational context regarding error handling, cancellation behavior (relevant given cancel_flow sibling), or permission requirements that would be necessary for a complete safety profile.

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

Parameters5/5

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

Schema description coverage is 0%, requiring the description to compensate fully. It comprehensively documents all 5 parameters: client_id includes format examples ('C.1234567890abcdef'), artifacts explains expected content, parameters provides nested format specification, and both timeout/urgent explain semantics and defaults.

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

Purpose5/5

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

The description opens with 'Schedule artifact collection on a Velociraptor client,' providing a specific verb (Schedule), resource (artifact collection), and scope (single Velociraptor client). This clearly distinguishes it from siblings like create_hunt (mass deployment) and run_vql (ad-hoc queries).

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 explicit guidance on when to use this tool versus alternatives like create_hunt for multi-client collection, nor when to set urgent=True. It describes the mechanics but lacks 'when-to-use' versus 'when-not-to-use' guidance.

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