port_info
Identify which dev server is using a specific TCP port, or confirm if the port is free. Resolve port conflicts quickly.
Instructions
Get info on a specific port. Returns the dev server holding it, or null if free / not a dev process.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| port | Yes | TCP port number |
Implementation Reference
- src/index.ts:22-31 (schema)Tool registration and input schema for 'port_info' — defines the tool name, description, and expected input (port number).
{ name: "port_info", description: "Get info on a specific port. Returns the dev server holding it, or null if free / not a dev process.", inputSchema: { type: "object", properties: { port: { type: "number", description: "TCP port number" } }, required: ["port"], additionalProperties: false, }, }, - src/index.ts:90-93 (handler)Handler for the 'port_info' tool — parses the port argument, calls portInfo(), and returns the result or a 'free' status.
case "port_info": { const port = z.number().int().parse((args as any)?.port); const data = await portInfo(port); return ok(data ?? { port, status: "free" }); - src/dev-servers.ts:44-47 (handler)Core implementation of portInfo() — calls listDevServers() to get all dev servers and filters by the given port.
export async function portInfo(port: number): Promise<DevServer | null> { const all = await listDevServers(); return all.find((s) => s.port === port) ?? null; } - src/types.ts:1-13 (helper)DevServer type definition (port, pid, process, framework, uptime, etc.) — the return shape of portInfo.
export interface DevServer { port: number; pid: number; process: string; cmdline: string; cwd: string | null; project_name: string | null; framework: string | null; uptime_seconds: number; memory_mb: number; cpu_pct: number; user: string; }