Skip to main content
Glama

connect_app

Attach to a running Java process by PID, loading the agent if needed without restarting, so the application retains open windows and login state.

Instructions

Connect to a running Java application by pid (see list_apps). If it was started without swing2mcp, the agent is loaded into it first: no restart, and the application keeps its state (open windows, logged-in user). Works with Java 8+ processes of the same OS user.

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": {
      "pid": "<pid>"
    },
    "name": "connect_app"
  }
}

Input Schema

NameRequiredDescriptionDefault
pidYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.1/5.0
Behavior4/5

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

With no annotations, the description must carry the full behavioral burden, and it mostly does: it discloses that the agent is injected into a non-instrumented process, that no restart is required, and that application state (open windows, logged-in user) is preserved. It omits failure modes, whether the connection persists or must be re-established, and any permission or timing caveats.

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?

Two sentences, front-loaded with the action and the identifier, followed by the non-obvious side effect and the process constraints. No filler or restatement of the tool name.

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?

For a one-parameter connect operation with no output schema, the description covers the essential unknowns: where the pid comes from, that injection happens automatically, that state survives, and the Java version and OS-user limits. Only error behavior and session longevity are left unstated.

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?

The schema documents nothing (0% coverage), only 'pid: integer'. The description compensates by explaining that the pid identifies a running Java application and by directing the agent to list_apps to obtain one. It still does not say what an invalid, stale, or self-owned pid looks like.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a clear verb and resource ('Connect to a running Java application by pid') and points to list_apps for discovery. The contrast with launch_app is implicit in 'running' and 'no restart', but it is never named explicitly, so it does not fully earn the sibling-differentiation mark.

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?

It tells the agent where the required pid comes from ('see list_apps') and states the operational envelope ('Java 8+ processes of the same OS user'). It does not spell out when not to use it, such as when the app was launched via launch_app, or how to proceed when the pid is invalid.

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