Skip to main content
Glama
heizaheiza

Charles MCP Server

by heizaheiza

analyze_recorded_traffic

Analyze saved network traffic recordings to identify patterns, filter by criteria like host or status, and generate structured summaries for debugging and monitoring.

Instructions

Analyze a saved recording snapshot with compact summaries. Returns structured TrafficSummary items with matched_fields and match_reasons. Use get_traffic_entry_detail to drill down into a specific entry_id afterwards.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
recording_pathNo
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

Implementation Reference

  • The core logic for analyze_recorded_traffic, which handles orchestration of history snapshots and building the query result.
    async def analyze_recorded_traffic(
        self,
        *,
        recording_path: str | None,
        query: TrafficQuery,
    ) -> TrafficQueryResult:
        try:
            prepared = await self.prepare_capture(
                source="history",
                query=query,
                recording_path=recording_path,
                advance=False,
            )
        except FileNotFoundError:
            return TrafficQueryResult(
                source="history",
                items=[],
                total_items=0,
                scanned_count=0,
                matched_count=0,
                filtered_out_count=0,
                filtered_out_by_class={},
                warnings=["no_saved_recordings"],
            )
        return self.build_query_result(prepared=prepared, query=query, include_items=True)
  • The tool registration and function handler for analyze_recorded_traffic within the MCP tool definitions.
    async def analyze_recorded_traffic(
        ctx: ToolContext,
        recording_path: Optional[str] = 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 a saved recording snapshot with compact summaries.
        Returns structured TrafficSummary items with matched_fields and match_reasons.
        Use get_traffic_entry_detail to drill down into a specific entry_id afterwards."""

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