enumerate_groups
Lists all system groups on an OpenMediaVault NAS to manage user permissions and access control for network shares and services.
Instructions
Enumerate all system groups including system groups
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/users.ts:118-130 (handler)The 'enumerate_groups' tool handler function that executes the tool logic. It calls client.rpc('GroupMgmt', 'enumerateGroups', {}) to enumerate all system groups including system groups, and returns the result as JSON or an error message.
server.tool( "enumerate_groups", "Enumerate all system groups including system groups", {}, async () => { try { const result = await client.rpc("GroupMgmt", "enumerateGroups", {}); return toolResult(JSON.stringify(result, null, 2)); } catch (error) { return toolResult(`Error enumerating groups: ${error}`, true); } }, ); - src/tools/users.ts:121-121 (schema)Input schema definition for the 'enumerate_groups' tool - an empty object {} indicating no parameters are required.
{}, - src/index.ts:43-43 (registration)Main registration point where registerUserTools(server, client) is called to register all user-related tools including 'enumerate_groups'.
registerUserTools(server, client); - src/omv-client.ts:96-150 (helper)The OmvClient.rpc() method is a supporting utility that handles authentication and makes the actual HTTP POST request to the OpenMediaVault RPC endpoint. It manages session cookies, handles authentication errors, and returns the API response.
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; }