get_network_request
Retrieve complete details of a captured network request, including request/response headers and body. Use with request ID from list_network_requests.
Instructions
Get full details of a specific captured network request.
Args: request_id: The ID of the request (from list_network_requests). include_body: Include response body (default False). include_headers: Include request/response headers (default True). max_body_size: Max chars of body when include_body=True. Pass -1 for unlimited.
Returns: dict with request and response details.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| request_id | Yes | ||
| include_body | No | ||
| include_headers | No | ||
| max_body_size | No |
Implementation Reference
- The tool handler function that retrieves full details of a specific captured network request by ID, with options to include/exclude body and headers, and truncation of large bodies.
@mcp.tool() async def get_network_request( request_id: int, include_body: bool = False, include_headers: bool = True, max_body_size: int = 5000, ) -> dict: """Get full details of a specific captured network request. Args: request_id: The ID of the request (from list_network_requests). include_body: Include response body (default False). include_headers: Include request/response headers (default True). max_body_size: Max chars of body when include_body=True. Pass -1 for unlimited. Returns: dict with request and response details. """ try: for r in browser_manager._network_requests: if r["id"] == request_id: result = dict(r) if not include_body: body = result.pop("response_body", None) result["response_body_available"] = body is not None if body: result["response_body_size"] = len(body) else: body = result.get("response_body") if body is not None and max_body_size >= 0 and len(body) > max_body_size: result["response_body"] = body[:max_body_size] result["response_body_truncated"] = True result["response_body_original_size"] = len(body) result["response_body_size_returned"] = max_body_size elif body is not None: result["response_body_truncated"] = False result["response_body_original_size"] = len(body) result["response_body_size_returned"] = len(body) if not include_headers: result.pop("request_headers", None) result.pop("response_headers", None) return result return {"error": f"Request ID {request_id} not found"} except Exception as e: return {"error": str(e)} - src/camoufox_reverse_mcp/tools/network.py:104-104 (registration)Registration of the tool via the @mcp.tool() decorator from FastMCP, which makes it available as an MCP tool.
@mcp.tool() - src/camoufox_reverse_mcp/server.py:19-20 (registration)The network tools module (including get_network_request) is imported and registered in the MCP server via server.py.
from .tools import network # noqa: E402, F401 — network_capture + list/get requests from .tools import storage # noqa: E402, F401 — cookies() + get_storage + export/import state - BrowserManager holds _network_requests deque (data source) that get_network_request iterates over to find the matching request ID.
self._network_requests: deque[dict] = deque(maxlen=MAX_LOG_SIZE) self._request_id_counter = 0