Skip to main content
Glama

system_processes

Monitor and analyze top system processes by CPU or memory usage to identify resource consumption patterns and performance bottlenecks.

Instructions

List top processes sorted by CPU or memory usage

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sort_byNo'cpu' or 'memory' (default: 'memory')
limitNoNumber of processes to show (default: 20)

Implementation Reference

  • The main handler function for the `system_processes` tool which executes the `ps` command to list processes.
    export async function listProcesses(args: Record<string, unknown>): Promise<string> {
      const sortBy = (args.sort_by as string) || "memory";
      const limit = (args.limit as number) || 20;
    
      const sortFlag = sortBy === "cpu" ? "-%cpu" : "-%mem";
    
      try {
        const { stdout } = await execFileAsync(
          "ps",
          ["aux", `--sort=${sortFlag}`],
          { timeout: 10000 }
        );
    
        const lines = stdout.trim().split("\n");
        const header = lines[0];
        const processes = lines.slice(1, limit + 1);
    
        return `Top ${processes.length} processes by ${sortBy}:\n\n${header}\n${processes.join("\n")}`;
      } catch (error: any) {
        throw new Error(`Failed to list processes: ${error.message}`);
      }
    }
  • The registration definition for the `system_processes` tool.
    {
      name: "system_processes",
      description: "List top processes sorted by CPU or memory usage",
      inputSchema: {
        type: "object" as const,
        properties: {
          sort_by: { type: "string", description: "'cpu' or 'memory' (default: 'memory')" },
          limit: { type: "number", description: "Number of processes to show (default: 20)" },
        },
      },
    },
  • The routing logic in `handleSystemTool` that maps the `system_processes` name to the `listProcesses` implementation.
    case "system_processes": return listProcesses(a);
Behavior2/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 mentions sorting and limiting but lacks critical behavioral details: whether this is a real-time snapshot or historical data, permissions required, potential performance impact, output format, or error conditions. For a system monitoring tool with zero annotation coverage, this is insufficient.

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 a single, efficient sentence that front-loads the core purpose ('List top processes') and adds essential detail ('sorted by CPU or memory usage'). There is no wasted verbiage, repetition, or unnecessary elaboration.

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 complexity of system monitoring, lack of annotations, and no output schema, the description is incomplete. It doesn't explain what 'top processes' means (e.g., current snapshot, aggregated metrics), return format, or behavioral constraints. For a tool that could have significant system interaction, more context is needed.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema fully documents both parameters (sort_by and limit) with their types, descriptions, and defaults. The description adds no additional parameter semantics beyond implying sorting by CPU/memory, which is already covered in the schema. Baseline 3 is appropriate when the schema does the heavy lifting.

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 clearly states the action ('List top processes') and the resource ('processes'), with specific criteria ('sorted by CPU or memory usage'). It distinguishes from sibling tools like system_disk_usage or system_network_connections by focusing on processes, but doesn't explicitly differentiate from potential similar tools not present in the list.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives. The description doesn't mention prerequisites, context (e.g., monitoring vs. troubleshooting), or comparisons to sibling tools like system_logs or docker_container_stats, leaving the agent to infer usage scenarios.

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/batu-sonmez/infraclaude'

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