Skip to main content
Glama
cbxss
by cbxss

is_connected

Check whether an active Frida session is alive and healthy, returning connection status, process PID, and device information.

Instructions

Check if Frida session is still alive and healthy. Returns connection status, PID, and device info.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The actual implementation of the 'is_connected' tool. Checks the active Frida session, queries the PID and module list, and returns connection status.
    def is_connected() -> dict:
        """Check if Frida session is still alive and healthy."""
        fs = registry.get_active()
        if fs is None:
            return {"connected": False, "reason": "no_session"}
    
        try:
            pid = fs.session._impl.pid
            modules = fs.api.memory_list_modules()
            module_count = len(modules) if modules else 0
            return {
                "connected": True,
                "session_id": fs.id,
                "pid": pid,
                "device": fs.device.name,
                "module_count": module_count,
            }
        except Exception as e:
            return {"connected": False, "reason": str(e)}
  • Tool registration/schema for 'is_connected'. Defines name, description, and empty inputSchema (no arguments required).
    Tool(
        name="is_connected",
        description="Check if Frida session is still alive and healthy. Returns connection status, PID, and device info.",
        inputSchema={"type": "object", "properties": {}, "required": []},
    ),
  • Dispatch/call_tool function in the MCP server. Routes 'is_connected' to device.is_connected().
    elif name == "is_connected":
        return device.is_connected()
  • Tests for is_connected function covering three scenarios: no session, valid session, and dead session.
    class TestIsConnected:
        """Tests for is_connected function"""
    
        def setup_method(self):
            _registry.close_all()
    
        def test_not_connected_when_no_session(self):
            result = is_connected()
            assert result["connected"] is False
            assert result["reason"] == "no_session"
    
        def test_connected_with_valid_session(self):
            mock_device = MagicMock()
            mock_device.name = "Test Device"
            mock_session = MagicMock()
            mock_session._impl.pid = 1234
            mock_api = MagicMock()
            mock_api.memory_list_modules.return_value = [{"name": "libc.so"}]
    
            _registry.create(mock_device, mock_session, mock_api, "com.test", 1234)
    
            result = is_connected()
            assert result["connected"] is True
            assert result["pid"] == 1234
            assert result["device"] == "Test Device"
            assert result["module_count"] == 1
    
        def test_not_connected_when_session_dead(self):
            mock_device = MagicMock()
            mock_device.name = "Test Device"
            mock_session = MagicMock()
            mock_session._impl.pid = property(lambda s: (_ for _ in ()).throw(Exception("dead")))
            mock_api = MagicMock()
            mock_api.memory_list_modules.side_effect = Exception("session dead")
    
            _registry.create(mock_device, mock_session, mock_api, "com.test", 1234)
    
            result = is_connected()
            assert result["connected"] is False
            assert "reason" in result
    
        def teardown_method(self):
            _registry.close_all()
Behavior3/5

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

No annotations are provided, so the description carries full burden. It mentions the tool returns status info but does not explicitly state it is non-destructive or require no special permissions. The behavioral traits are mostly implied.

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, 12 words, with immediate front-loading of the core purpose. Every word earns its place.

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 output schema, the description sufficiently lists return values (status, PID, device info). It could be more explicit about the format of the connection status, but overall it is complete for a health-check tool.

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?

No parameters exist, so the schema is trivial. The description adds meaning by explaining the purpose and return values, exceeding the baseline of 4 for zero-parameter tools.

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 checks if a Frida session is alive and healthy, and specifies it returns connection status, PID, and device info. This distinguishes it from sibling tools like 'connect' and 'disconnect'.

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 session health verification but does not explicitly state when to use it vs alternatives, nor does it mention prerequisites or when not to use it.

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/cbxss/frida-mcp'

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