Skip to main content
Glama
fredriksknese

mcp-openmediavault

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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);
        }
      },
    );
  • 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);
  • 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;
    }

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/fredriksknese/mcp-openmediavault'

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