Skip to main content
Glama

list_session_usage

Retrieve a paginated list of browser session usage records with optional filters by user, session, time range, or status.

Instructions

Retrieve a paginated list of Tetra browser session usage records for the authenticated user, with optional filtering by user, session, time range, and status.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sub_user_idNoFilter results to only include sessions belonging to a specific sub-user under the authenticated account.
session_idNoFilter results to a specific browser session by its unique session identifier.
start_afterNoReturn only sessions that started after this timestamp, specified in ISO 8601 date-time format.
end_beforeNoReturn only sessions that ended before this timestamp, specified in ISO 8601 date-time format.
statusNoFilter sessions by their current lifecycle status; use 'running' for active sessions or 'ended' for completed sessions.
limitNoMaximum number of session records to return per page; must be between 1 and 1000.
pageNoPage number to retrieve for paginated results; must be 1 or greater.

Implementation Reference

  • The main handler function for the list_session_usage MCP tool. It accepts optional filter parameters (sub_user_id, session_id, start_after, end_before, status, limit, page), constructs a validated request model, and sends a GET request to /v1/tetra/usage with query parameters. Registered via @mcp.tool() decorator.
    @mcp.tool()
    async def list_session_usage(
        sub_user_id: str | None = Field(None, description="Filter results to only include sessions belonging to a specific sub-user under the authenticated account."),
        session_id: str | None = Field(None, description="Filter results to a specific browser session by its unique session identifier."),
        start_after: str | None = Field(None, description="Return only sessions that started after this timestamp, specified in ISO 8601 date-time format."),
        end_before: str | None = Field(None, description="Return only sessions that ended before this timestamp, specified in ISO 8601 date-time format."),
        status: Literal["running", "ended"] | None = Field(None, description="Filter sessions by their current lifecycle status; use 'running' for active sessions or 'ended' for completed sessions."),
        limit: int | None = Field(None, description="Maximum number of session records to return per page; must be between 1 and 1000.", ge=1, le=1000),
        page: int | None = Field(None, description="Page number to retrieve for paginated results; must be 1 or greater.", ge=1),
    ) -> dict[str, Any] | ToolResult:
        """Retrieve a paginated list of Tetra browser session usage records for the authenticated user, with optional filtering by user, session, time range, and status."""
    
        # Construct request model with validation
        try:
            _request = _models.ListSessionUsageV1TetraUsageGetRequest(
                query=_models.ListSessionUsageV1TetraUsageGetRequestQuery(sub_user_id=sub_user_id, session_id=session_id, start_after=start_after, end_before=end_before, status=status, limit=limit, page=page)
            )
        except pydantic.ValidationError as _validation_err:
            logging.error(f"Parameter validation failed for list_session_usage: {_validation_err}")
            raise ValueError(f"Invalid parameters: {_validation_err.errors()}") from _validation_err
    
        # Extract parameters for API call
        _http_path = "/v1/tetra/usage"
        _http_query = _request.query.model_dump(by_alias=True, exclude_none=True) if _request.query else {}
        _http_headers = {}
    
        # Inject per-operation authentication
        _auth = await _get_auth_for_operation("list_session_usage")
        _http_headers.update(_auth.get("headers", {}))
    
        _request_id = str(uuid.uuid4())
        _log_tool_invocation("list_session_usage", "GET", _http_path, _request_id)
    
        # Execute request (returns normalized dict and status code)
        _response_data, _ = await _execute_tool_request(
            tool_name="list_session_usage",
            method="GET",
            path=_http_path,
            request_id=_request_id,
            params=_http_query,
            headers=_http_headers,
        )
    
        return _response_data
  • Pydantic schema models for list_session_usage request validation. ListSessionUsageV1TetraUsageGetRequestQuery defines the 7 optional query filter parameters (sub_user_id, session_id, start_after, end_before, status, limit, page). ListSessionUsageV1TetraUsageGetRequest wraps the query.
    # Operation: list_session_usage
    class ListSessionUsageV1TetraUsageGetRequestQuery(StrictModel):
        sub_user_id: str | None = Field(default=None, description="Filter results to only include sessions belonging to a specific sub-user under the authenticated account.")
        session_id: str | None = Field(default=None, description="Filter results to a specific browser session by its unique session identifier.")
        start_after: str | None = Field(default=None, description="Return only sessions that started after this timestamp, specified in ISO 8601 date-time format.", json_schema_extra={'format': 'date-time'})
        end_before: str | None = Field(default=None, description="Return only sessions that ended before this timestamp, specified in ISO 8601 date-time format.", json_schema_extra={'format': 'date-time'})
        status: Literal["running", "ended"] | None = Field(default=None, description="Filter sessions by their current lifecycle status; use 'running' for active sessions or 'ended' for completed sessions.")
        limit: int | None = Field(default=None, description="Maximum number of session records to return per page; must be between 1 and 1000.", ge=1, le=1000)
        page: int | None = Field(default=None, description="Page number to retrieve for paginated results; must be 1 or greater.", ge=1)
    class ListSessionUsageV1TetraUsageGetRequest(StrictModel):
        """Retrieve a paginated list of Tetra browser session usage records for the authenticated user, with optional filtering by user, session, time range, and status."""
        query: ListSessionUsageV1TetraUsageGetRequestQuery | None = None
  • Tool registration via the @mcp.tool() decorator from FastMCP on the list_session_usage async function.
    # Tags: AgentQL Tetra (Remote Chrome Browser)
    @mcp.tool()
  • Auth registration mapping dict that maps the list_session_usage operation to require APIKeyHeader authentication.
    OPERATION_AUTH_MAP: dict[str, list[list[str]]] = {
        "query_webpage_data": [["APIKeyHeader"]],
        "get_usage": [["APIKeyHeader"]],
        "create_browser_session": [["APIKeyHeader"]],
        "list_session_usage": [["APIKeyHeader"]]
    }
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It correctly identifies a paginated read operation with optional filtering, but lacks details on pagination behavior (e.g., default limit, total count) or any rate limits. Adequate but not comprehensive.

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 a single sentence with no redundancy. It front-loads the key action and resource, and efficiently lists the optional filters.

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

Completeness2/5

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

With no output schema, the description should explain what each session usage record contains, but it does not. It also omits pagination details like how to iterate or interpret paginated responses. The tool is adequately described for its input, but incomplete for expected output.

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

Parameters3/5

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

Schema description coverage is 100%, so the baseline is 3. The description adds little beyond the schema, simply summarizing the filter categories (user, session, time range, status) that are already in the parameter descriptions.

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 retrieves a paginated list of session usage records for the authenticated user, with optional filters. It distinguishes from siblings like create_browser_session (creates sessions) and query_webpage_data (queries page data).

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 mentions the tool is for the authenticated user and lists optional filters, but does not explicitly state when to use it over alternatives or provide when-not scenarios. The context signals help, but more explicit guidance is missing.

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/mcparmory/registry'

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