Skip to main content
Glama
heizaheiza

Charles MCP Server

query_live_capture_entries

Analyze live network traffic captures with structured filtering to inspect HTTP requests and responses. Filter by host, path, method, status, headers, or content to identify specific entries for debugging.

Instructions

Analyze the active live capture with structured summary-first filtering. This is the RECOMMENDED tool for inspecting live traffic. Does NOT advance the cursor — safe to call repeatedly with different filters. Default cursor=0 scans all captured data from the beginning. Use get_traffic_entry_detail to drill down into a specific entry_id.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
capture_idYes
cursorNo
presetNoapi_focus
host_containsNo
path_containsNo
method_inNo
status_inNo
resource_class_inNo
min_priority_scoreNo
request_header_nameNo
request_header_value_containsNo
response_header_nameNo
response_header_value_containsNo
request_content_typeNo
response_content_typeNo
request_body_containsNo
response_body_containsNo
request_json_queryNo
response_json_queryNo
include_body_previewNo
max_itemsNo
max_preview_charsNo
max_headers_per_sideNo
scan_limitNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
itemsNo
sourceYes
warningsNo
truncatedNo
next_cursorNo
total_itemsNo
matched_countNo
scanned_countNo
filtered_out_countNo
filtered_out_by_classNo

Implementation Reference

  • The handler function for the `query_live_capture_entries` tool, which builds a traffic query and delegates analysis to the traffic_query_service.
    async def query_live_capture_entries(
        ctx: ToolContext,
        capture_id: str,
        cursor: Optional[int] = None,
        preset: TrafficPreset = "api_focus",
        host_contains: Optional[str] = None,
        path_contains: Optional[str] = None,
        method_in: Optional[list[str]] = None,
        status_in: Optional[list[int]] = None,
        resource_class_in: Optional[list[str]] = None,
        min_priority_score: Optional[int] = None,
        request_header_name: Optional[str] = None,
        request_header_value_contains: Optional[str] = None,
        response_header_name: Optional[str] = None,
        response_header_value_contains: Optional[str] = None,
        request_content_type: Optional[str] = None,
        response_content_type: Optional[str] = None,
        request_body_contains: Optional[str] = None,
        response_body_contains: Optional[str] = None,
        request_json_query: Optional[str] = None,
        response_json_query: Optional[str] = None,
        include_body_preview: bool = True,
        max_items: int = 10,
        max_preview_chars: int = 128,
        max_headers_per_side: int = 6,
        scan_limit: int = 500,
    ) -> TrafficQueryResult:
        """Analyze the active live capture with structured summary-first filtering.
        This is the RECOMMENDED tool for inspecting live traffic.
        Does NOT advance the cursor — safe to call repeatedly with different filters.
        Default cursor=0 scans all captured data from the beginning.
        Use get_traffic_entry_detail to drill down into a specific entry_id."""
        deps = get_tool_dependencies(ctx)
        query = build_traffic_query(
            preset=preset,
            host_contains=host_contains,
            path_contains=path_contains,
            method_in=method_in,
            status_in=status_in,
            resource_class_in=resource_class_in,
            min_priority_score=min_priority_score,
            request_header_name=request_header_name,
            request_header_value_contains=request_header_value_contains,
            response_header_name=response_header_name,
            response_header_value_contains=response_header_value_contains,
            request_content_type=request_content_type,
            response_content_type=response_content_type,
            request_body_contains=request_body_contains,
            response_body_contains=response_body_contains,
            request_json_query=request_json_query,
            response_json_query=response_json_query,
            include_body_preview=include_body_preview,
            max_items=max_items,
            max_preview_chars=max_preview_chars,
            max_headers_per_side=max_headers_per_side,
            scan_limit=scan_limit,
        )
        return await deps.traffic_query_service.analyze_live_capture(
            capture_id=capture_id,
            query=query,
            cursor=cursor,
        )
  • The tool is registered using the @mcp.tool() decorator within register_live_tools in charles_mcp/tools/live.py.
    @mcp.tool()
    async def stop_live_capture(
        ctx: ToolContext,
        capture_id: str,
        persist: bool = True,
    ) -> StopLiveCaptureResult:
        """Stop an active live capture and optionally persist the filtered snapshot.
        Only status='stopped' means the capture is fully closed."""
        deps = get_tool_dependencies(ctx)
        try:
            return await deps.live_service.stop(capture_id, persist=persist)
        except Exception as exc:
            raise ValueError(str(exc)) from exc
    
    @mcp.tool()
    async def query_live_capture_entries(
        ctx: ToolContext,
        capture_id: str,
        cursor: Optional[int] = None,
        preset: TrafficPreset = "api_focus",
        host_contains: Optional[str] = None,
        path_contains: Optional[str] = None,
        method_in: Optional[list[str]] = None,
        status_in: Optional[list[int]] = None,
        resource_class_in: Optional[list[str]] = None,
        min_priority_score: Optional[int] = None,
        request_header_name: Optional[str] = None,
        request_header_value_contains: Optional[str] = None,
        response_header_name: Optional[str] = None,
        response_header_value_contains: Optional[str] = None,
        request_content_type: Optional[str] = None,
        response_content_type: Optional[str] = None,
        request_body_contains: Optional[str] = None,
        response_body_contains: Optional[str] = None,
        request_json_query: Optional[str] = None,
        response_json_query: Optional[str] = None,
        include_body_preview: bool = True,
        max_items: int = 10,
        max_preview_chars: int = 128,
        max_headers_per_side: int = 6,
        scan_limit: int = 500,
    ) -> TrafficQueryResult:
        """Analyze the active live capture with structured summary-first filtering.
        This is the RECOMMENDED tool for inspecting live traffic.
        Does NOT advance the cursor — safe to call repeatedly with different filters.
        Default cursor=0 scans all captured data from the beginning.
        Use get_traffic_entry_detail to drill down into a specific entry_id."""
        deps = get_tool_dependencies(ctx)
        query = build_traffic_query(
            preset=preset,
            host_contains=host_contains,
            path_contains=path_contains,
            method_in=method_in,
            status_in=status_in,
            resource_class_in=resource_class_in,
            min_priority_score=min_priority_score,
            request_header_name=request_header_name,
            request_header_value_contains=request_header_value_contains,
            response_header_name=response_header_name,
            response_header_value_contains=response_header_value_contains,
            request_content_type=request_content_type,
            response_content_type=response_content_type,
            request_body_contains=request_body_contains,
            response_body_contains=response_body_contains,
            request_json_query=request_json_query,
            response_json_query=response_json_query,
            include_body_preview=include_body_preview,
            max_items=max_items,
            max_preview_chars=max_preview_chars,
            max_headers_per_side=max_headers_per_side,
            scan_limit=scan_limit,
        )
        return await deps.traffic_query_service.analyze_live_capture(
            capture_id=capture_id,
            query=query,
            cursor=cursor,
        )
Behavior4/5

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

No annotations provided, so description carries full burden. It successfully discloses critical cursor behavior ('Does NOT advance the cursor — safe to call repeatedly') and default scanning behavior ('Default cursor=0 scans all captured data'). Missing details on rate limits, auth requirements, or exact return structure, though output schema exists.

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?

Five sentences, zero waste. Front-loaded with purpose, followed by recommendation, behavioral warning, parameter default, and sibling reference. Every sentence earns its place with high information density.

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?

For a 24-parameter complex filtering tool, the description covers the unique behavioral aspects (cursor immobility) and sibling relationships adequately. However, given zero schema descriptions, it lacks explanation of the filtering paradigm, preset meanings, or parameter interactions. Output schema exists, mitigating need for return value description.

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

Parameters2/5

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

With 0% schema description coverage across 24 parameters, the description fails to compensate adequately. It explains cursor behavior specifically but leaves 23 other parameters (host_contains, request_json_query, preset enums, etc.) completely undocumented. No explanation of filtering syntax or preset options provided.

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?

Description opens with specific verb 'Analyze' and resource 'active live capture' plus methodology 'structured summary-first filtering.' It clearly distinguishes from sibling get_traffic_entry_detail by specifying this is for summary analysis versus drilling down.

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

Usage Guidelines5/5

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

Explicitly states 'This is the RECOMMENDED tool for inspecting live traffic' and provides clear alternative guidance: 'Use get_traffic_entry_detail to drill down into a specific entry_id.' Also implies when-not by emphasizing cursor safety for repeated calls.

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/heizaheiza/Charles-mcp'

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