Skip to main content
Glama
JackXuyi

Current operating environment

getDiskUsage

Check current disk space usage on your system to monitor storage capacity and prevent data loss from insufficient space.

Instructions

获取当前平台的硬盘使用率

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler implementation for the 'getDiskUsage' tool. It checks the platform (macOS vs others) and executes the appropriate 'df' command via execSync to retrieve disk usage information, then returns it as text content in the MCP response format.
    case "getDiskUsage": { let diskUsage; if (os.platform() === 'darwin') { // macOS 使用 df -h 命令 diskUsage = execSync('df -h').toString(); } else { // 其他平台使用 df -h --output=used,size,pcent 命令 diskUsage = execSync('df -h --output=used,size,pcent').toString(); } return { content: [{ type: "text", text: diskUsage }] }; }
  • The tool schema definition for 'getDiskUsage', registered in the listTools response. Includes the tool name, description in Chinese ('Get current platform's disk usage rate'), and an empty input schema (no parameters required).
    { name: "getDiskUsage", description: "获取当前平台的硬盘使用率", inputSchema: { type: "object", properties: {}, required: [] } },
  • src/index.ts:787-787 (registration)
    Registration of the listTools handler function, which returns the list of tools including 'getDiskUsage' schema.
    server.setRequestHandler(ListToolsRequestSchema, handleRequest);
  • src/index.ts:790-790 (registration)
    Registration of the callTool handler function, which contains the switch case dispatching to the 'getDiskUsage' implementation.
    server.setRequestHandler(CallToolRequestSchema, handleCallToolRequest);

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/JackXuyi/env-mcp'

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