Skip to main content
Glama

adb_tunnel_open

Open a managed host-to-device or device-to-host tunnel, auto-selecting a free host port for forward connections and returning an ID for later cleanup.

Instructions

Open a managed tunnel between host and device. Higher-level convenience wrapper over adb_forward / adb_reverse: auto-picks a free host port when one isn't specified (forward only), returns an opaque tunnel ID for later close, and registers cleanup so the tunnel is removed on server exit. Direction 'forward' = host port forwards TO device service; 'reverse' = device port forwards TO host service.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "direction": "<direction>",
      "deviceSpec": "<deviceSpec>"
    },
    "name": "adb_tunnel_open"
  }
}

Input Schema

NameRequiredDescriptionDefault
deviceNoDevice serial
hostSpecNoHost-side spec, e.g., 'tcp:8080'. For 'forward' direction: omit to auto-pick a free host port. For 'reverse' direction: required (can't auto-pick device-side ports without an extra probe call).
directionYes'forward' (host → device) or 'reverse' (device → host)
deviceSpecYesDevice-side spec, e.g., 'tcp:3000' or 'localabstract:app_socket'

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.1.6
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
  2. Addedv1.1.3

TDQS

A4.1/5.0
Behavior4/5

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

With no annotations supplied, the description carries the full burden and does well: it discloses auto-selection of a free host port (forward only), that a tunnel ID is returned for later close via adb_tunnel_close, and that cleanup is registered on server exit. Gaps remain around failure modes such as occupied ports or invalid specs, which matter for a mutation tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the core action, then supporting behavior, then direction semantics; no filler sentences. The final direction explanation is somewhat redundant with the enum description but is short and clarifying rather than wasteful.

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?

No output schema exists, and the description compensates by explaining that an opaque tunnel ID is returned and how the tunnel is torn down. Combined with the 100% schema coverage, an agent has what it needs to call this correctly; only error-path behavior is unstated.

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 schema already documents all four parameters, including direction and the hostSpec auto-pick rule. The description restates the forward/reverse direction semantics and the auto-port rule, which reinforces but adds little new meaning beyond the 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?

States a specific verb and resource (open a managed tunnel between host and device) and explicitly positions itself as a higher-level wrapper over adb_forward / adb_reverse, which are present in the sibling list. An agent can distinguish it from the lower-level siblings without opening any schema.

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?

The wrapper relationship to adb_forward / adb_reverse plus the listed benefits (auto port pick, opaque tunnel ID, cleanup on server exit) make it clear when this is the preferable choice. It stops short of stating explicit exclusions, e.g. when to prefer the raw adb_forward/adb_reverse calls instead.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools