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
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | Specific path to check (optional, shows all filesystems if omitted) |
Implementation Reference
- src/tools/system/disk.ts:6-20 (handler)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}`); } } - src/tools/system/index.ts:8-17 (registration)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)" }, }, }, }, - src/tools/system/index.ts:60-60 (handler)The switch case in `handleSystemTool` that delegates to `diskUsage`.
case "system_disk_usage": return diskUsage(a);