Skip to main content
Glama

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:

  1. search_traffic(query="/login") → find the login response flow_id

  2. extract_session_variable(flow_id, regex='token":"([^"]+)', name="jwt", source="response_body")

  3. 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

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
regexYes
sourceNoresponse_body
flow_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

With no annotations, the description carries the burden of behavioral disclosure. It explains that saved variables are automatically substituted in replay_flow, the regex must have exactly one capture group, and source options are enumerated. It does not mention variable overwrite behavior but covers essential side effects.

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?

The description is well-structured with sections for description, prerequisite, substitution behavior, workflow, and args. It is detailed but every sentence adds value, and the numbered workflow makes it easy to follow.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 4-parameter tool with no annotations, the description covers purpose, prerequisites, parameter semantics, integration with replay_flow, and a complete workflow. An output schema exists, so return value details are not necessary. Missing error scenarios are the only minor gap but do not detract from completeness.

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

Parameters5/5

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

Schema description coverage is 0%, so the description compensates fully. Each parameter is explained: flow_id, regex (with capture group rule and example), name (as {{name}}), and source (with four valid values and a default). This adds significant meaning beyond the raw schema.

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?

The description clearly states 'Extract a value from a captured flow and save it as a named session variable' with a specific verb and resource. It distinguishes from siblings by explaining the auto-substitution in replay_flow, which is a unique capability.

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

Usage Guidelines4/5

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

Provides a clear prerequisite (flow_id from get_traffic_summary or search_traffic) and a typical auth workflow that illustrates exactly when to use this tool in sequence with search_traffic and replay_flow. It does not explicitly name alternatives but gives strong usage context.

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/BobongKu/nodriver-proxy-mcp'

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