Skip to main content
Glama

extract_session_variable

Extract a value from an HTTP response using a regex pattern and store it as a session variable for later replay.

Instructions

Extract a value from a flow's response body using a regex and store it as a session variable. Args: name: Variable name (referenced as $name in replay_flow) flow_id: The ID of the flow to extract from regex_pattern: The regex pattern with capture groups group_index: Which regex capture group to extract (default: 1)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
flow_idYes
regex_patternYes
group_indexNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior2/5

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

No annotations are provided, so the description must convey behavioral traits. It covers the extraction and storage mechanism but omits important details such as error handling (e.g., regex mismatch), side effects (e.g., overwriting existing variables), and whether the tool is idempotent or has prerequisites.

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 concise and well-structured, using a clear docstring format with an Args section. Every sentence adds value without unnecessary verbosity.

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

Completeness3/5

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

The description covers the tool's purpose and parameters adequately but lacks usage guidelines and behavioral details. Given that an output schema exists, return values need not be explained, but the omission of usage alternatives and error handling prevents a higher score.

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?

The description adds full parameter semantics beyond the schema's titles. Each argument (name, flow_id, regex_pattern, group_index) is explained with context, including that $name is used in replay_flow and that group_index defaults to 1. Schema description coverage is 0%, so the description compensates completely.

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 the tool's function: extracting a value from a flow's response body using regex and storing it as a session variable. This distinguishes it from siblings like set_session_variable (direct setting) and extract_from_flow (generic extraction).

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

Usage Guidelines3/5

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

The description implies usage for regex extraction from flow responses but does not provide explicit guidance on when to use this tool versus alternatives like set_session_variable or extract_from_flow. No when-not-to-use conditions are given.

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/snapspecter/mitmproxy-mcp'

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