proxy_by_time
Capture network traffic for a specified duration or retrieve the most recent saved traffic package for analysis and debugging.
Instructions
Capture traffic for a fixed duration or read the latest saved history package.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| record_seconds | Yes | 录制持续时长,单位为秒。绝对不是 Unix 时间戳(如 1700000000)也不是毫秒时间戳(如 1700000000000)。0 表示读取最新历史流量包。 |
Implementation Reference
- charles_mcp/tools/legacy.py:27-41 (handler)The implementation of the `proxy_by_time` tool handler, which captures traffic for a duration and returns the proxy data.
async def proxy_by_time(record_seconds: RecordSeconds, ctx: ToolContext) -> list[dict]: """Capture traffic for a fixed duration or read the latest saved history package.""" logger.info("Tool called: proxy_by_time(record_seconds=%s)", record_seconds) deps = get_tool_dependencies(ctx) error_payload = seconds_input_error( parameter="record_seconds", value=record_seconds, max_allowed=deps.config.max_stoptime, retry_example="proxy_by_time(record_seconds=30)", ) if error_payload: return error_payload return await get_proxy_data(record_seconds, ctx, deps=deps) - charles_mcp/tools/legacy.py:25-25 (registration)The `register_legacy_tools` function that contains the decorator registering `proxy_by_time` with the MCP server.
def register_legacy_tools(mcp: FastMCP) -> None: