Skip to main content
Glama

get_disk_usage

Check disk space usage in WSL environments to monitor storage capacity and identify potential space constraints.

Instructions

Get disk space information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathNoPath to check

Implementation Reference

  • Handler function that executes the 'df -h' command to get disk usage, optionally for a specific path, formats the output, and handles errors.
    async ({ path }) => { try { const cmd = path ? `df -h "${path}"` : 'df -h'; const result = await this.command_executor.execute_command(cmd); return { content: [ { type: 'text' as const, text: this.format_output(result), }, ], }; } catch (error) { return { content: [ { type: 'text' as const, text: `Error: ${error instanceof Error ? error.message : String(error)}`, }, ], isError: true, }; } },
  • Input schema for the get_disk_usage tool, defining an optional 'path' parameter.
    schema: v.object({ path: v.optional( v.pipe( v.string(), v.description('Path to check'), ), ), }),
  • src/index.ts:232-272 (registration)
    Registration of the 'get_disk_usage' tool using this.server.tool, including name, description, schema, annotations, and inline handler.
    this.server.tool( { name: 'get_disk_usage', description: 'Get disk space information', schema: v.object({ path: v.optional( v.pipe( v.string(), v.description('Path to check'), ), ), }), annotations: { readOnlyHint: true, }, }, async ({ path }) => { try { const cmd = path ? `df -h "${path}"` : 'df -h'; const result = await this.command_executor.execute_command(cmd); return { content: [ { type: 'text' as const, text: this.format_output(result), }, ], }; } catch (error) { return { content: [ { type: 'text' as const, text: `Error: ${error instanceof Error ? error.message : String(error)}`, }, ], isError: true, }; } }, );

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/spences10/mcp-wsl-exec'

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