Skip to main content
Glama

get_network_adapters

Retrieve detailed information about network adapters in Cisco C-Series servers, including model, vendor, MAC addresses, and port specifications for inventory and configuration management.

Instructions

List all network adapters (NICs) with model, vendor, MAC addresses, and port details.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The getNetworkAdapters async function is the main handler that retrieves network adapter data. It queries four CIMC classes (adaptorUnit, adaptorExtEthIf, adaptorHostEthIf, networkAdapterUnit) via resolveClass and returns a JSON string containing adapters, externalPorts, hostInterfaces, and networkAdapters arrays with relevant properties.
    export async function getNetworkAdapters(): Promise<string> {
      const adapters = await resolveClass("adaptorUnit", true);
      const extEth = await resolveClass("adaptorExtEthIf");
      const hostEth = await resolveClass("adaptorHostEthIf");
      const networkAdapters = await resolveClass("networkAdapterUnit");
    
      return JSON.stringify(
        {
          adapters: adapters.map((a) => ({
            dn: a.dn,
            id: a.id,
            model: a.model,
            vendor: a.vendor,
            serial: a.serial,
            presence: a.presence,
            cimc: a as Record<string, unknown>,
          })),
          externalPorts: extEth.map((e) => ({
            dn: e.dn,
            id: e.id,
            mac: e.mac,
            linkState: e.linkState,
            operSpeed: e.operSpeed,
            adminSpeed: e.adminSpeed,
          })),
          hostInterfaces: hostEth.map((h) => ({
            dn: h.dn,
            name: h.name,
            mac: h.mac,
            mtu: h.mtu,
            uplinkPort: h.uplinkPort,
          })),
          networkAdapters: networkAdapters.map((n) => ({
            dn: n.dn,
            model: n.model,
            numIntf: n.numIntf,
          })),
        },
        null,
        2,
      );
    }
  • The getNetworkAdaptersDef object defines the tool's metadata: name 'get_network_adapters', description listing network adapters with model, vendor, MAC addresses and port details, and an empty inputSchema (z.object({})) indicating no input parameters are required.
    export const getNetworkAdaptersDef = {
      name: "get_network_adapters",
      description:
        "List all network adapters (NICs) with model, vendor, MAC addresses, and port details.",
      inputSchema: z.object({}),
    };
  • src/index.ts:131-136 (registration)
    Registers the get_network_adapters tool with the MCP server using server.tool(), passing the definition's name, description, inputSchema.shape, and wrapping the handler with error handling via wrapHandler().
    server.tool(
      getNetworkAdaptersDef.name,
      getNetworkAdaptersDef.description,
      getNetworkAdaptersDef.inputSchema.shape,
      wrapHandler(getNetworkAdapters),
    );

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/schwarztim/cimc-mcp'

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