extract_session_variable
Extract tokens or dynamic values from captured traffic with regex, save as session variables, and auto-substitute in replay_flow.
Instructions
Extract a value from a captured flow and save it as a named session variable.
PREREQUISITE: Get flow_id from get_traffic_summary or search_traffic.
Saved variables are automatically substituted in replay_flow: Any {{varname}} in the URL, headers, or body of a replayed request is replaced with the saved value.
TYPICAL AUTH WORKFLOW:
search_traffic(query="/login") → find the login response flow_id
extract_session_variable(flow_id, regex='token":"([^"]+)', name="jwt", source="response_body")
replay_flow(another_flow_id) → {{jwt}} in Authorization header is auto-replaced
Args: flow_id: The flow to extract from regex: Regex with exactly ONE capture group — the captured group becomes the saved value. Example: 'Bearer ([\w.-]+)' captures the token part only. name: Variable name to save as. Used as {{name}} in replay_flow. source: Where to extract from (default: "response_body"): - "response_body" — response body text - "response_header" — response headers (raw text) - "request_header" — request headers (raw text) - "request_body" — request body text
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| regex | Yes | ||
| source | No | response_body | |
| flow_id | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |