get_inventory
Retrieve complete hardware inventory for Cisco C-Series servers, including CPUs, memory, PCI cards, network adapters, and storage controllers.
Instructions
Complete hardware inventory: CPUs, DIMMs, PCI cards, network adapters, and storage controllers. Answers 'What hardware is in this server?'
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/server.ts:194-268 (handler)Handler function that fetches complete hardware inventory (CPUs, DIMMs, PCI cards, network adapters, storage controllers, firmware versions) from CIMC using resolveClass queries and returns formatted JSON
export async function getInventory(): Promise<string> { // Sequential calls const cpus = await resolveClass("processorUnit"); const dimms = await resolveClass("memoryUnit"); const pci = await resolveClass("pciEquipSlot"); const adapters = await resolveClass("adaptorUnit"); const controllers = await resolveClass("storageController"); const firmware = await resolveClass("firmwareRunning"); return JSON.stringify( { cpus: cpus.map((c) => ({ dn: c.dn, id: c.id, model: c.model, vendor: c.vendor, arch: c.arch, cores: c.cores, coresEnabled: c.coresEnabled, threads: c.threads, speed: c.speed, operability: c.operability, presence: c.presence, })), memory: dimms .filter((d) => d.presence === "equipped") .map((d) => ({ dn: d.dn, id: d.id, model: d.model, vendor: d.vendor, serial: d.serial, capacityMB: d.capacity, clockMHz: d.clock, type: d.type, formFactor: d.formFactor, location: d.location, operState: d.operState, })), pciSlots: pci.map((p) => ({ dn: p.dn, id: p.id, model: p.model, vendor: p.vendor, controllerReported: p.controllerReported, })), networkAdapters: adapters.map((a) => ({ dn: a.dn, id: a.id, model: a.model, vendor: a.vendor, serial: a.serial, presence: a.presence, })), storageControllers: controllers.map((c) => ({ dn: c.dn, id: c.id, model: c.model, vendor: c.vendor, serial: c.serial, raidSupport: c.raidSupport, type: c.type, presence: c.presence, })), firmwareVersions: firmware.map((f) => ({ dn: f.dn, type: f.type, version: f.version, deployment: f.deployment, })), }, null, 2, ); } - src/tools/server.ts:187-192 (schema)Tool definition with name 'get_inventory', description, and empty input schema (no parameters required)
export const getInventoryDef = { name: "get_inventory", description: "Complete hardware inventory: CPUs, DIMMs, PCI cards, network adapters, and storage controllers. Answers 'What hardware is in this server?'", inputSchema: z.object({}), }; - src/index.ts:102-107 (registration)Registers the get_inventory tool with the MCP server using the definition metadata and wrapped handler
server.tool( getInventoryDef.name, getInventoryDef.description, getInventoryDef.inputSchema.shape, wrapHandler(getInventory), ); - src/utils/client.ts:49-56 (helper)Helper function used by getInventory to query all objects of a specific class from CIMC (e.g., processorUnit, memoryUnit, adaptorUnit)
export async function resolveClass( classId: string, hierarchical = false, ): Promise<Record<string, string>[]> { const xml = `<configResolveClass cookie="{cookie}" inHierarchical="${hierarchical}" classId="${classId}"/>`; const result = await authenticatedRequest(xml); return extractOutConfigs(result, "configResolveClass"); }