Skip to main content
Glama
joesecurity

JoeSandboxMCP

Official
by joesecurity

get_pcap_file

Download network traffic capture (PCAP) files from Joe Sandbox analysis to examine DNS requests, HTTP traffic, and TCP/UDP communications recorded during sandbox execution.

Instructions

Retrieve the network traffic capture (PCAP) file from a sandbox analysis.

This tool downloads the full packet capture generated during execution of the submitted sample. The PCAP file contains all recorded network traffic for the specified sandbox run, including DNS requests, HTTP traffic, and raw TCP/UDP communications.

The PCAP is saved locally with the name `{webid}-{run}.pcap`. If a custom `save_path` is provided, the file is written to that directory. If the path is invalid or inaccessible, the file is saved to a fallback directory named `pcap/`.

Args:
    webid (required): The submission ID of the analysis.
    run (optional, default = 0): Index of the sandbox run to retrieve.
    save_path (optional): Custom directory to save the PCAP file. If invalid, a fallback location is used.

Returns:
    A dictionary containing:
    - output_file: Absolute path to the downloaded PCAP file.
    - note: Message indicating whether the fallback directory was used.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
webidYes
runNo
save_pathNo

Implementation Reference

  • The main handler function for the 'get_pcap_file' MCP tool. It is decorated with @mcp.tool() for registration and delegates the core logic to download_pcap_file from core.py.
    @mcp.tool()
    async def get_pcap_file(webid: str, run: int = 0, save_path: Optional[str] = None) -> Dict[str, Any]:
        """
        Retrieve the network traffic capture (PCAP) file from a sandbox analysis.
    
        This tool downloads the full packet capture generated during execution of the submitted sample. The PCAP file contains all recorded network traffic for the specified sandbox run, including DNS requests, HTTP traffic, and raw TCP/UDP communications.
    
        The PCAP is saved locally with the name `{webid}-{run}.pcap`. If a custom `save_path` is provided, the file is written to that directory. If the path is invalid or inaccessible, the file is saved to a fallback directory named `pcap/`.
    
        Args:
            webid (required): The submission ID of the analysis.
            run (optional, default = 0): Index of the sandbox run to retrieve.
            save_path (optional): Custom directory to save the PCAP file. If invalid, a fallback location is used.
    
        Returns:
            A dictionary containing:
            - output_file: Absolute path to the downloaded PCAP file.
            - note: Message indicating whether the fallback directory was used.
        """
        try:
            return await download_pcap_file(webid, run, save_path)
        except Exception as e:
            return {
                "error": f"Failed to download pcap file for submission ID '{webid}' run {run}."
                         f"Reason: {str(e)}"
            }
  • The supporting utility function that implements the actual PCAP file download from the Joe Sandbox API, handles fallback types, directory creation, and file saving.
    async def download_pcap_file(webid: str, run: Optional[int] = 0, save_path: Optional[str] = None) -> Dict[str, Any]:
        jbx_client = get_client()
        try:
            _, data = jbx_client.analysis_download(webid=webid, run=run, type='pcapunified')
        except Exception as e:
            _, data = jbx_client.analysis_download(webid=webid, type='pcap')
    
        filename = f"{webid}-{run}.pcap"
        default_output_dir = os.path.join("pcap")
        output_dir = default_output_dir
        used_default_path = False
    
        if save_path:
            try:
                os.makedirs(save_path, exist_ok=True)
                output_dir = save_path
            except (OSError, FileNotFoundError):
                os.makedirs(default_output_dir, exist_ok=True)
                used_default_path = True
        else:
            os.makedirs(default_output_dir, exist_ok=True)
    
        full_path = os.path.abspath(os.path.join(output_dir, filename))
    
        with open(full_path, "wb") as f:
            f.write(data)
    
        note = (
            "User-provided save_path was invalid. Default directory was used."
            if used_default_path else
            "PCAP download completed successfully."
        )
    
        return {
            "output_file": full_path,
            "note": note
        }
  • jbxmcp/tools.py:1-17 (registration)
    The __all__ export list in tools.py includes 'get_pcap_file', indicating it is part of the public API.
    __all__ = [
        'submit_analysis_job',
        'search_analysis',
        'get_analysis_info',
        'get_ai_summaries',
        'get_dropped_info',
        'get_domain_info',
        'get_ip_info',
        'get_url_info',
        'get_signature_info',
        'get_unpacked_files',
        'get_pcap_file',
        'get_list_of_recent_analyses',
        'get_process_info',
        'get_memory_dumps'
    ]
Behavior4/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. It effectively describes key behaviors: the tool downloads and saves a file locally, specifies the naming convention (`{webid}-{run}.pcap`), explains fallback directory logic if save_path is invalid, and outlines the return structure. It covers mutation (file creation) and error handling, though it doesn't mention permissions, rate limits, or file size considerations.

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 well-structured and front-loaded: the first sentence states the core purpose, followed by elaboration on the PCAP content, file handling details, and clear parameter/return sections. Every sentence adds value without redundancy, making it efficient and easy to parse for an AI agent.

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 the tool's moderate complexity (3 parameters, file download operation) and lack of annotations or output schema, the description does an excellent job covering purpose, behavior, parameters, and returns. It explains the local file save process and fallback logic. A slight gap exists in not detailing potential errors (e.g., invalid webid) or performance aspects, but it's largely complete for practical use.

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?

The schema description coverage is 0%, so the description must fully compensate. It provides detailed semantics for all three parameters: webid as the required submission ID, run as the optional sandbox run index with default value, and save_path as the optional custom directory with fallback behavior. This adds substantial meaning beyond the bare schema, clarifying usage and consequences.

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 clearly states the specific action ('Retrieve', 'downloads') and resource ('network traffic capture (PCAP) file from a sandbox analysis'), distinguishing it from sibling tools like get_analysis_info or get_memory_dumps which retrieve different analysis artifacts. It explicitly mentions the content of the PCAP file (DNS requests, HTTP traffic, TCP/UDP communications), making the purpose unambiguous.

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

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use this tool: to retrieve the full packet capture from a sandbox analysis run. It implicitly suggests alternatives by mentioning the PCAP contains specific traffic types, but does not explicitly name when not to use it or which sibling tools might be better for other data (e.g., get_domain_info for domain-specific insights). The guidance is sufficient but lacks explicit exclusions.

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/joesecurity/joesandboxMCP'

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