Skip to main content
Glama

system_disk_usage

Monitor system disk usage to identify storage consumption and manage capacity across filesystems or specific paths.

Instructions

Show disk usage for the system or a specific path

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathNoSpecific path to check (optional, shows all filesystems if omitted)

Implementation Reference

  • The implementation of the `diskUsage` function that executes `du` or `df` commands to check disk usage.
    export async function diskUsage(args: Record<string, unknown>): Promise<string> {
      const path = args.path as string | undefined;
    
      try {
        if (path) {
          const { stdout } = await execFileAsync("du", ["-sh", path], { timeout: 30000 });
          return `Disk usage for '${path}':\n${stdout.trim()}`;
        }
    
        const { stdout } = await execFileAsync("df", ["-h"], { timeout: 10000 });
        return `Disk usage:\n\n${stdout.trim()}`;
      } catch (error: any) {
        throw new Error(`Failed to get disk usage: ${error.message}`);
      }
    }
  • The registration of the `system_disk_usage` tool in the MCP tool list.
    {
      name: "system_disk_usage",
      description: "Show disk usage for the system or a specific path",
      inputSchema: {
        type: "object" as const,
        properties: {
          path: { type: "string", description: "Specific path to check (optional, shows all filesystems if omitted)" },
        },
      },
    },
  • The switch case in `handleSystemTool` that delegates to `diskUsage`.
    case "system_disk_usage": return diskUsage(a);

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