get_sensors
Retrieve sensor readings for fans, power supplies, and temperature from a Cisco C-Series server managed by CIMC to monitor hardware health.
Instructions
Get all sensor readings: fans, power supplies, and temperature data from the CIMC-managed server.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/server.ts:48-96 (handler)The main handler function that retrieves all sensor data (fans, power supplies, CPU/memory temperatures, power stats) from the CIMC-managed server by making sequential API calls to resolve different equipment classes and returning formatted JSON.
export async function getSensors(): Promise<string> { // Sequential calls to avoid overloading BMC const fans = await resolveClass("equipmentFan"); const psus = await resolveClass("equipmentPsu"); const cpuEnv = await resolveClass("processorEnvStats"); const memEnv = await resolveClass("memoryEnvStats"); const powerStats = await resolveClass("computeMbPowerStats"); return JSON.stringify( { fans: fans.map((f) => ({ dn: f.dn, id: f.id, model: f.model, operability: f.operability, presence: f.presence, speed: f.speed, })), powerSupplies: psus.map((p) => ({ dn: p.dn, id: p.id, model: p.model, vendor: p.vendor, serial: p.serial, operability: p.operability, presence: p.presence, voltage: p.voltage, power: p.power, thermal: p.thermal, })), cpuTemperatures: cpuEnv.map((c) => ({ dn: c.dn, temperature: c.temperature, })), memoryTemperatures: memEnv.map((m) => ({ dn: m.dn, temperature: m.temperature, })), powerStats: powerStats.map((p) => ({ dn: p.dn, consumedPower: p.consumedPower, inputCurrent: p.inputCurrent, inputVoltage: p.inputVoltage, })), }, null, 2, ); } - src/tools/server.ts:41-46 (schema)Tool definition object specifying the tool name as 'get_sensors', its description, and an empty input schema (no parameters required).
export const getSensorsDef = { name: "get_sensors", description: "Get all sensor readings: fans, power supplies, and temperature data from the CIMC-managed server.", inputSchema: z.object({}), }; - src/index.ts:74-79 (registration)Registers the get_sensors tool with the MCP server using the definition metadata and wrapped handler function.
server.tool( getSensorsDef.name, getSensorsDef.description, getSensorsDef.inputSchema.shape, wrapHandler(getSensors), );