Skip to main content
Glama
tornikegomareli

macOS Tools MCP Server

system_performance

Monitor macOS system performance by analyzing CPU, memory, disk, and network usage. View current metrics, historical data, running processes, and get optimization insights.

Instructions

Monitor system performance and analyze resource usage

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesType of performance analysis
timeRangeNoTime range for historical data (e.g., '1h', '24h', '7d')
metricNoSpecific metric to analyze

Implementation Reference

  • Main handler function implementing the system_performance tool logic, handling actions like current metrics, historical data, processes, and optimizations.
    export async function performanceMonitor(
      params: SystemPerformanceParams
    ): Promise<PerformanceResult> {
      try {
        const db = initDatabase();
        
        switch (params.action) {
          case "current": {
            const metrics = await getCurrentMetrics();
            storeMetrics(db, metrics);
            
            if (!params.metric || params.metric === "all") {
              return { status: "success", data: metrics };
            }
            
            // Return specific metric
            const filteredMetrics: SystemMetrics = {
              ...metrics,
              cpu: params.metric === "cpu" ? metrics.cpu : {} as any,
              memory: params.metric === "memory" ? metrics.memory : {} as any,
              disk: params.metric === "disk" ? metrics.disk : {} as any,
              network: params.metric === "network" ? metrics.network : {} as any,
            };
            
            return { status: "success", data: filteredMetrics };
          }
          
          case "history": {
            const timeRange = params.timeRange || "1h";
            const historicalData = getHistoricalMetrics(db, timeRange);
            
            if (params.metric && params.metric !== "all") {
              // Filter historical data by metric
              const filtered = historicalData;
              
              return { status: "success", data: filtered };
            }
            
            return { status: "success", data: historicalData };
          }
          
          case "processes": {
            const cacheKey = createCacheKey("processes", { metric: params.metric });
            
            const processes = await processListCache.get(cacheKey, async () => {
              const procs = await getTopProcesses();
              
              if (params.metric && params.metric !== "all") {
                // Sort by specific metric
                return procs.sort((a, b) => {
                  switch (params.metric) {
                    case "cpu":
                      return b.cpu - a.cpu;
                    case "memory":
                      return b.memory - a.memory;
                    default:
                      return 0;
                  }
                });
              }
              
              return procs;
            });
            
            return { status: "success", data: processes };
          }
          
          case "optimize": {
            const suggestions = await analyzeForOptimizations();
            return { status: "success", data: suggestions };
          }
          
          default:
            return { status: "error", error: "Invalid action" };
        }
      } catch (error) {
        return {
          status: "error",
          error: error instanceof Error ? error.message : String(error),
        };
      }
    }
  • src/index.ts:42-64 (registration)
    Tool registration in the list of available tools, including name, description, and input schema.
      name: "system_performance",
      description: "Monitor system performance and analyze resource usage",
      inputSchema: {
        type: "object",
        properties: {
          action: {
            type: "string",
            enum: ["current", "history", "processes", "optimize"],
            description: "Type of performance analysis",
          },
          timeRange: {
            type: "string",
            description: "Time range for historical data (e.g., '1h', '24h', '7d')",
          },
          metric: {
            type: "string",
            enum: ["cpu", "memory", "disk", "network", "all"],
            description: "Specific metric to analyze",
          },
        },
        required: ["action"],
      },
    },
  • Zod schema for validating input parameters to the system_performance tool.
    const SystemPerformanceSchema = z.object({
      action: z.enum(["current", "history", "processes", "optimize"]),
      timeRange: z.string().optional(),
      metric: z.enum(["cpu", "memory", "disk", "network", "all"]).optional(),
    });
  • TypeScript interface defining the parameters for the system_performance tool.
    export interface SystemPerformanceParams {
      action: "current" | "history" | "processes" | "optimize";
      timeRange?: string;
      metric?: "cpu" | "memory" | "disk" | "network" | "all";
    }
  • src/index.ts:118-129 (registration)
    Dispatch handler in the MCP server that routes calls to the system_performance tool and formats the response.
    case "system_performance": {
      const params = SystemPerformanceSchema.parse(args);
      const result = await performanceMonitor(params);
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
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 of behavioral disclosure. While 'monitor' and 'analyze' imply read-only operations, it doesn't clarify if 'optimize' might involve mutations, rate limits, authentication needs, or what the output looks like. For a tool with an 'optimize' action and no annotations, this is a significant gap in transparency.

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 highly concise and front-loaded, consisting of a single, efficient sentence that directly states the tool's purpose without unnecessary details. Every word earns its place, making it easy to parse quickly.

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 a performance monitoring tool with actions like 'optimize' and no annotations or output schema, the description is incomplete. It fails to address behavioral aspects, usage context, or output expectations, leaving critical gaps for an AI agent to understand how to invoke it effectively.

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?

The description doesn't add meaning beyond what the input schema provides, as schema description coverage is 100% with clear parameter descriptions and enums. The baseline score of 3 is appropriate because the schema adequately documents the parameters, and the description doesn't compensate or enhance this information.

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 tool's purpose with specific verbs ('monitor' and 'analyze') and resources ('system performance' and 'resource usage'), making it immediately understandable. However, it doesn't differentiate from the sibling tool 'enhanced_search', which might also relate to system analysis, leaving room for potential confusion.

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?

The description provides no guidance on when to use this tool versus alternatives, such as the sibling 'enhanced_search'. It lacks context about specific scenarios, prerequisites, or exclusions, leaving the agent to infer usage from the tool name and parameters alone.

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/tornikegomareli/macos-tools-mcp-server'

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