get_mounted_filesystems
Retrieve mounted filesystems and usage statistics to monitor storage capacity and manage disk space on OpenMediaVault NAS systems.
Instructions
Get all currently mounted filesystems with their usage statistics
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/storage.ts:54-68 (handler)The main handler function for get_mounted_filesystems tool. It calls client.rpc with FileSystemMgmt.enumerateMountedFilesystems and returns the result as formatted JSON, with error handling.
async () => { try { const result = await client.rpc( "FileSystemMgmt", "enumerateMountedFileSystems", {}, ); return toolResult(JSON.stringify(result, null, 2)); } catch (error) { return toolResult( `Error fetching mounted filesystems: ${error}`, true, ); } }, - src/tools/storage.ts:50-69 (registration)Tool registration using server.tool() with name 'get_mounted_filesystems', description, empty schema (no parameters), and the handler function.
server.tool( "get_mounted_filesystems", "Get all currently mounted filesystems with their usage statistics", {}, async () => { try { const result = await client.rpc( "FileSystemMgmt", "enumerateMountedFileSystems", {}, ); return toolResult(JSON.stringify(result, null, 2)); } catch (error) { return toolResult( `Error fetching mounted filesystems: ${error}`, true, ); } }, ); - src/tools/storage.ts:53-53 (schema)Empty schema object {} indicating this tool requires no input parameters.
{}, - src/tools/storage.ts:5-7 (helper)toolResult helper function that formats the response as MCP content with type 'text', supporting both success and error cases.
function toolResult(text: string, isError = false) { return { content: [{ type: "text" as const, text }], isError }; } - src/omv-client.ts:96-150 (helper)OmvClient.rpc method that performs the actual HTTP POST to OpenMediaVault's RPC endpoint. Handles authentication, session management, and error handling for API calls.
async rpc( service: string, method: string, params: Record<string, unknown> = {}, ): Promise<unknown> { if (!this.sessionId && !this.cookie) { await this.login(); } const url = `${this.baseUrl}/rpc.php`; const body = { service, method, params, options: null, }; const headers: Record<string, string> = { "Content-Type": "application/json", }; if (this.cookie) { headers["Cookie"] = this.cookie; } if (this.sessionId) { headers["X-OPENMEDIAVAULT-SESSIONID"] = this.sessionId; } const response = await fetch(url, { method: "POST", headers, body: JSON.stringify(body), }); if (response.status === 401) { // Session expired — re-login and retry await this.login(); return this.rpc(service, method, params); } if (!response.ok) { const errorText = await response.text(); throw new Error(`OMV API error (${response.status}): ${errorText}`); } const data = (await response.json()) as OmvResponse; if (data.error) { throw new Error( `OMV RPC error [${service}.${method}]: ${data.error.message} (code ${data.error.code})`, ); } return data.response; }