Skip to main content
Glama
Lokii0911
by Lokii0911

browser_state

Retrieve current browser session details including session ID, URL, page title, and window information to monitor or verify browser state.

Instructions

Return session id, URL, title, and window information.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Tool 'browser_state' registered with @mcp.tool() decorator, calls browser.state via _run helper.
    @mcp.tool()
    def browser_state() -> dict[str, Any]:
        """Return session id, URL, title, and window information."""
        return _run("browser_state", browser.state)
  • The handler function browser_state() returns the result of calling browser.state, wrapped by _run for error handling.
    @mcp.tool()
    def browser_state() -> dict[str, Any]:
        """Return session id, URL, title, and window information."""
        return _run("browser_state", browser.state)
  • Pydantic model BrowserState defines the schema: session_id, current_url, title, window_handles, active_window_handle.
    class BrowserState(BaseModel):
        session_id: str | None
        current_url: str | None
        title: str | None
        window_handles: list[str]
        active_window_handle: str | None
  • BrowserManager.state() method constructs a BrowserState by reading driver's session_id, current_url, title, window_handles, and active_window_handle.
    def state(self) -> BrowserState:
        with self._lock:
            if self._driver is None:
                return BrowserState(
                    session_id=None,
                    current_url=None,
                    title=None,
                    window_handles=[],
                    active_window_handle=None,
                )
            return BrowserState(
                session_id=str(self._driver.session_id),
                current_url=self._driver.current_url,
                title=self._driver.title,
                window_handles=list(self._driver.window_handles),
                active_window_handle=self._driver.current_window_handle,
            )
Behavior2/5

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

No annotations are provided, and the description only lists return values without disclosing whether it is read-only, has side effects, or any constraints. The agent gains no behavioral insight beyond what the return values imply.

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, front-loaded sentence with no wasted words. It efficiently conveys the tool's output.

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

Completeness4/5

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

Given no parameters and an existing output schema (which explains return values), the description is sufficiently complete. However, it could benefit from clarifying what 'window information' includes.

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

Parameters4/5

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

There are zero parameters, and the baseline score for 0 parameters is 4. The description does not need to add parameter semantics.

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 explicitly states it returns session id, URL, title, and window information, making the purpose clear and specific. It distinguishes this read-only state retrieval from sibling tools that perform actions or get specific elements.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. There is no mention of context, prerequisites, or exclusions.

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/Lokii0911/SeleniumMCP'

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