Skip to main content
Glama

network/connections

Read-onlyIdempotent

List TCP and UDP sockets with owning processes, filter by state or port, and return text or JSON for connection troubleshooting.

Instructions

Lists TCP and UDP sockets in every state with their owning processes, like ss -tuanp, read natively from /proc/net (no ss needed). Read-only; unix and raw sockets are not included. state (case-insensitive, _ and - interchangeable) filters by LISTEN (includes unconnected UDP), ESTABLISHED, TIME_WAIT, CLOSE_WAIT, SYN_SENT, ... or the groups connected/synchronized; an invalid state is an error listing the valid names. port matches the local OR peer port. The owning process (pid, fd) is shown only for sockets whose /proc/PID/fd you can read; other users' processes need privileged: true (needs a grant). Text output has ss -tuanp columns; output_format: json returns an array of objects (netid, state, recv_q, send_q, local_address, local_port, peer_address, peer_port, uid, inode, processes), [] when empty. For the ARP cache use network/arp, for interfaces and IPs the network://interfaces resource, for process details processes/list.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
portNoMatch sockets whose local or peer port equals this
stateNoFilter by TCP state, case-insensitive (LISTEN/listening, ESTABLISHED, TIME_WAIT, CLOSE_WAIT, SYN_SENT, ...). Omit to list all sockets - active connections and listening ports.
privilegedNoRun as root to see PIDs of other users. Needs a grant for this tool in mcp-sudo.yaml, otherwise refused
output_formatNoUse json for structured output (yaml, table and wide return the same JSON); default is text

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv0.4.1
    • changedInput schema / properties / output_format / description
      Previous value: -"Desired output format (e.g. json, yaml, table, wide). Defaults to text"New value: +"Use json for structured output (yaml, table and wide return the same JSON); default is text"
    • changedInput schema / properties / port / description
      Previous value: -"Filter by port"New value: +"Match sockets whose local or peer port equals this"
    • changedInput schema / properties / privileged / description
      Previous value: -"Run as root to see PIDs of other users"New value: +"Run as root to see PIDs of other users. Needs a grant for this tool in mcp-sudo.yaml, otherwise refused"
  2. First observed

TDQS

A4.7/5.0
Behavior4/5

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

Annotations already declare readOnly/idempotent/non-destructive, but the description adds substantial undisclosed context: data sourced from /proc/net, unix/raw sockets excluded, other users' PIDs require `privileged: true` plus a grant, and an invalid state raises an error listing valid names. It stops short of describing ordering or performance characteristics on large hosts, keeping it just below the top.

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-loads the core purpose and is free of filler sentences, but it is a dense single block of parenthetical-heavy clauses (state list, privilege caveat, output fields, sibling routing), which costs some scannability.

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

Completeness5/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 still documents return shape: text mirrors `ss -tuanp` columns and JSON returns an array of objects with netid, state, recv_q, send_q, addresses, uid, inode and processes, plus `[]` when empty. Combined with the privilege and error behavior notes, nothing an agent needs is missing.

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

Parameters5/5

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

Schema coverage is already 100%, so the baseline would be 3, but the description goes well beyond the schema: state is case-insensitive with `_`/`-` interchangeable, valid enumerations and the connected/synchronized groups are listed, and `port` is clarified as matching local OR peer port.

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?

Opens with a specific verb+resource ('Lists TCP and UDP sockets in every state with their owning processes') and anchors it to a familiar tool via 'like `ss -tuanp`, read natively from /proc/net'. It also explicitly scopes out unix and raw sockets, so an agent can immediately distinguish it from network/arp and the other network siblings.

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

Usage Guidelines5/5

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

Names concrete alternatives with conditions: 'For the ARP cache use `network/arp`, for interfaces and IPs the `network://interfaces` resource, for process details `processes/list`.' Usage is triggered implicitly by the state/port filters and the privileged note, leaving little to inference.

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