Skip to main content
Glama

berth_check

Check for port conflicts between configured development servers and currently listening ports before running dev commands. Scans project configs and host ports to identify collisions.

Instructions

Scan a project for port conflicts between ports declared in common dev-server config sources (.env files, package.json scripts, docker-compose.yml, devcontainer.json, Procfile, Makefile, framework defaults, and a project-local .berthrc) and ports currently listening on the host.

When to use: before running npm run dev, docker compose up, or any other dev-server command — especially after switching branches in a monorepo where multiple services may want the same port. Safe to call repeatedly; read-only and side-effect free.

Side effects: enumerates listening TCP ports on the host via platform-appropriate commands (lsof on macOS/Linux, netstat on Windows) and inspects running Docker containers for published ports. Reads only the config files listed above; never opens, closes, or binds any ports. No network I/O beyond local loopback checks.

Returns: plain-text (or JSON) report listing each configured port, whether it is free or in use, and — for occupied ports — the PID and process name of the holder. Exit 1 when a conflict is detected, 0 otherwise.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathNoAbsolute or relative path to the project root to scan. Defaults to the current working directory.
formatNoResponse format: "terminal" for human-readable ANSI-colored output, "json" for machine-parseable structured data, "markdown" for rendered tables (where supported). Defaults to "terminal".
Behavior5/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure and does so comprehensively. It details side effects ('enumerates listening TCP ports... reads only the config files... never opens, closes, or binds any ports'), safety aspects ('read-only and side-effect free'), and operational specifics like platform-dependent commands and exit codes, going well beyond basic functionality.

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?

The description is appropriately sized and front-loaded, starting with the core purpose. Each sentence adds necessary information (usage guidelines, side effects, returns), but it could be slightly more streamlined by integrating some details more tightly, though no content is wasted.

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?

Given the complexity of the tool (port scanning with multiple config sources and platform variations), no annotations, and no output schema, the description is highly complete. It covers purpose, usage, behavior, side effects, return values, and exit codes, providing all essential context for an AI agent to understand and invoke the tool effectively.

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 input schema has 100% description coverage, so the baseline is 3. The description adds value by implicitly contextualizing the 'path' parameter as the 'project root to scan' and the 'format' parameter's purpose in the 'Returns' section, but it doesn't provide additional syntax or format details beyond what the schema already documents, warranting a score above baseline but not the highest.

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's purpose with specific verbs ('Scan a project for port conflicts') and resources ('ports declared in common dev-server config sources'), distinguishing it from sibling tools like 'aware_sync' or 'envalid_validate' which likely perform different functions. It explicitly identifies what it does without being tautological.

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?

The description provides explicit guidance on when to use the tool ('before running `npm run dev`, `docker compose up`, or any other dev-server command — especially after switching branches in a monorepo'), including specific scenarios and timing. It also mentions it's 'Safe to call repeatedly,' which helps differentiate usage patterns from other tools.

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/WhenLabs-org/when'

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