Skip to main content
Glama
fredriksknese

mcp-openmediavault

get_network_interfaces

Retrieve network interface details including IP addresses, netmask, gateway, and speed from an OpenMediaVault NAS system to monitor and manage network configuration.

Instructions

List all network interfaces on the OpenMediaVault system with IP, netmask, gateway, and speed

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
enumerateNoIf true, enumerate all detected devices. If false, list configured interfaces.

Implementation Reference

  • The handler function for get_network_interfaces tool. Takes an 'enumerate' parameter and either calls client.rpc('Network', 'enumerateDevices', {}) to enumerate all detected devices, or client.getList('Network', 'getInterfaceList', {...}) to list configured interfaces. Returns JSON result or error message.
    async ({ enumerate }) => {
      try {
        let result: unknown;
        if (enumerate) {
          result = await client.rpc("Network", "enumerateDevices", {});
        } else {
          result = await client.getList("Network", "getInterfaceList", {
            start: 0,
            limit: 100,
            sortfield: null,
            sortdir: null,
          });
        }
        return toolResult(JSON.stringify(result, null, 2));
      } catch (error) {
        return toolResult(
          `Error fetching network interfaces: ${error}`,
          true,
        );
      }
    },
  • Input schema for get_network_interfaces tool using Zod. Defines 'enumerate' as an optional boolean parameter with default value false, describing whether to enumerate all detected devices or list configured interfaces.
    {
      enumerate: z
        .boolean()
        .optional()
        .default(false)
        .describe(
          "If true, enumerate all detected devices. If false, list configured interfaces.",
        ),
    },
  • Registration of get_network_interfaces tool with the MCP server using server.tool(). Includes tool name, description, input schema, and handler function.
    server.tool(
      "get_network_interfaces",
      "List all network interfaces on the OpenMediaVault system with IP, netmask, gateway, and speed",
      {
        enumerate: z
          .boolean()
          .optional()
          .default(false)
          .describe(
            "If true, enumerate all detected devices. If false, list configured interfaces.",
          ),
      },
      async ({ enumerate }) => {
        try {
          let result: unknown;
          if (enumerate) {
            result = await client.rpc("Network", "enumerateDevices", {});
          } else {
            result = await client.getList("Network", "getInterfaceList", {
              start: 0,
              limit: 100,
              sortfield: null,
              sortdir: null,
            });
          }
          return toolResult(JSON.stringify(result, null, 2));
        } catch (error) {
          return toolResult(
            `Error fetching network interfaces: ${error}`,
            true,
          );
        }
      },
    );
  • Helper function toolResult() that formats the response content for MCP tools. Returns an object with content array containing text and optional error flag.
    function toolResult(text: string, isError = false) {
      return { content: [{ type: "text" as const, text }], isError };
    }
  • OmvClient.rpc() method used by the handler to make RPC calls to OpenMediaVault API. Handles authentication, session management, and error handling for API requests.
    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;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It mentions what data is listed but does not disclose behavioral traits such as permissions required, rate limits, error conditions, or whether it's a read-only operation. The description is minimal and misses key operational details.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose without unnecessary words. It directly communicates the tool's function and scope, making it easy to understand quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description is incomplete for a tool that likely returns structured data. It specifies what data is included but not the format or potential limitations. For a system monitoring tool, more context on output behavior would be helpful.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage for its single parameter, so the baseline is 3. The description does not add any parameter-specific information beyond what the schema provides, as it doesn't mention the 'enumerate' parameter or its effects.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('List') and resource ('all network interfaces on the OpenMediaVault system'), with specific details about what information is included (IP, netmask, gateway, and speed). It distinguishes itself from siblings like list_disks or list_filesystems by specifying network interfaces.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for retrieving network interface data but does not explicitly state when to use this tool versus alternatives. It lacks guidance on prerequisites, exclusions, or comparisons with other tools, though the context suggests it's for system monitoring.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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