Skip to main content
Glama

get_running_services

Checks common development ports to list running processes and identify expected services that are missing.

Instructions

Lists processes running on common dev ports (3000, 4000, 5173, 8080 etc). Shows what is running and what is expected but missing.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cwdNo

Implementation Reference

  • Main handler function `getRunningServices` that checks expected ports using find-process and returns running services and missing ports.
    export async function getRunningServices(
      expectedPorts: number[]
    ): Promise<ProcessResult> {
      const checks = await Promise.allSettled(
        expectedPorts.map(async (port) => {
          try {
            const results = await findProcess("port", port);
            if (results.length > 0) {
              const first = results[0];
              return {
                running: {
                  port,
                  pid: first.pid,
                  name: first.name,
                } as ServiceInfo,
                missing: null as number | null,
              };
            }
            return {
              running: null as ServiceInfo | null,
              missing: port,
            };
          } catch {
            return {
              running: null as ServiceInfo | null,
              missing: port,
            };
          }
        })
      );
    
      const running: ServiceInfo[] = [];
      const expected_but_missing: number[] = [];
    
      for (const check of checks) {
        if (check.status === "fulfilled") {
          if (check.value.running) {
            running.push(check.value.running);
          } else if (check.value.missing !== null) {
            expected_but_missing.push(check.value.missing);
          }
        }
      }
    
      return { running, expected_but_missing };
    }
  • Type definitions: ServiceInfo (port, pid, name) and ProcessResult (running[], expected_but_missing[]).
    export interface ServiceInfo {
      port: number;
      pid: number;
      name: string;
    }
  • src/index.ts:58-73 (registration)
    Tool registration in ListToolsRequestSchema handler: declares name 'get_running_services', description, and inputSchema (accepts optional cwd).
          {
            name: "get_running_services",
            description:
              "Lists processes running on common dev ports (3000, 4000, 5173, 8080 etc). Shows what is running and what is expected but missing.",
            inputSchema: {
              type: "object",
              properties: {
                cwd: {
                  type: "string",
                },
              },
            },
          },
        ],
      };
    });
  • CallToolRequestSchema handler that dispatches 'get_running_services': detects framework, calls getRunningServices(framework.expectedPorts), returns result as JSON text.
    if (toolName === "get_running_services") {
      try {
        const args = request.params.arguments as { cwd?: string } | undefined;
        const cwd = args?.cwd ?? process.cwd();
        const framework = await detectFramework(cwd);
        const result = await getRunningServices(framework.expectedPorts);
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(result, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify({
                error: `Failed to get running services: ${String(error)}`,
              }),
            },
          ],
        };
      }
    }
  • Framework detector providing expectedPorts for each framework (Next.js: 3000, Vite: 5173, Express: [3000,8080], FastAPI: 8000, unknown: [3000,8000,8080]).
    import { readFile } from "node:fs/promises";
    import { join } from "node:path";
    
    export interface FrameworkInfo {
      framework: "nextjs" | "vite" | "express" | "fastapi" | "unknown";
      logPaths: string[];
      expectedPorts: number[];
    }
    
    const UNKNOWN_FRAMEWORK: FrameworkInfo = {
      framework: "unknown",
      logPaths: ["logs/"],
      expectedPorts: [3000, 8000, 8080],
    };
    
    export async function detectFramework(cwd: string): Promise<FrameworkInfo> {
      try {
        const packageJsonPath = join(cwd, "package.json");
        const packageJsonRaw = await readFile(packageJsonPath, "utf8");
        const packageJson = JSON.parse(packageJsonRaw) as {
          dependencies?: Record<string, string>;
          devDependencies?: Record<string, string>;
        };
    
        const mergedDeps = {
          ...(packageJson.dependencies ?? {}),
          ...(packageJson.devDependencies ?? {}),
        };
    
        if ("next" in mergedDeps) {
          return {
            framework: "nextjs",
            logPaths: [".next/server/"],
            expectedPorts: [3000],
          };
        }
    
        if ("vite" in mergedDeps) {
          return {
            framework: "vite",
            logPaths: ["dist/"],
            expectedPorts: [5173],
          };
        }
    
        if ("express" in mergedDeps) {
          return {
            framework: "express",
            logPaths: ["logs/"],
            expectedPorts: [3000, 8080],
          };
        }
    
        if ("fastapi" in mergedDeps) {
          return {
            framework: "fastapi",
            logPaths: ["logs/"],
            expectedPorts: [8000],
          };
        }
    
        return UNKNOWN_FRAMEWORK;
      } catch {
        return UNKNOWN_FRAMEWORK;
      }
    }
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It discloses that the tool shows running and missing processes on specific ports, but does not mention side effects, permissions, or any limitations beyond the listed ports.

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?

The description is two clear sentences with no redundant information. Each sentence adds value: first states what it does, second adds the expected-but-missing aspect.

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

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of output schema and minimal parameter documentation, the description omits important details such as return format, what 'expected but missing' means, and how the cwd parameter affects the output. More context would be beneficial for a complete understanding.

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

Parameters1/5

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

The input schema has one parameter (cwd) with no description, and schema description coverage is 0%. The description does not explain what cwd does or how it affects the results, leaving the agent with no guidance on its usage.

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 uses a specific verb ('lists') and resource ('processes on common dev ports'), and distinguishes the tool from siblings by focusing on a specific set of ports and including expected but missing processes.

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

Usage Guidelines3/5

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

The description implies the tool is for checking processes on common dev ports, but does not explicitly state when to use it versus alternatives like get_recent_errors or get_session_snapshot, nor does it provide any exclusions or prerequisites.

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/tao-izm/devpulse-mcp'

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