gpu_status
Get a one-shot summary of all AMD GPUs showing product name, GPU utilization, VRAM usage, temperatures, power, and fan speed. Each card's unsupported fields return null.
Instructions
One-shot summary of all AMD GPUs: product name, GPU utilization %, VRAM used/total bytes and %, edge/junction/memory temperatures, average and max power, fan speed % and RPM. Returns one entry per card. Fields that the card does not support are returned as null (not omitted).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- server.js:110-151 (handler)The gpuStatus() function is the main handler for the gpu_status tool. It shells out to `rocm-smi -a --json` and `rocm-smi --showmeminfo vram --json`, parses the output, and returns a structured summary of each GPU card including utilization, VRAM, temperature, power, and fan metrics.
async function gpuStatus() { const missing = requireRocmSmi(); if (missing) return errorResult(missing); const r = await run(BIN.rocmSmi, ['-a', '--json']); if (r.code !== 0 && !r.stdout) { return errorResult(`rocm-smi failed (code ${r.code}): ${r.stderr || 'no output'}`); } const data = parseRocmJson(r.stdout); if (!data) return errorResult(`rocm-smi returned no parseable JSON. stderr: ${r.stderr || '<empty>'}`); // VRAM in bytes needs a separate call — showallinfo only gives VRAM %. const vramRaw = parseRocmJson((await run(BIN.rocmSmi, ['--showmeminfo', 'vram', '--json'])).stdout) || {}; const cards = cardKeys(data).map((k) => { const c = data[k]; const v = vramRaw[k] || {}; return { card: k, name: c['Card Series'] || c['Card Model'] || c['Device Name'] || null, gfx_version: c['GFX Version'] || null, pci_bus: c['PCI Bus'] || null, utilization_percent: numOrNull(c['GPU use (%)']), vram_percent: numOrNull(c['GPU Memory Allocated (VRAM%)']), vram_used_bytes: numOrNull(v['VRAM Total Used Memory (B)']), vram_total_bytes: numOrNull(v['VRAM Total Memory (B)']), temp_edge_c: numOrNull(c['Temperature (Sensor edge) (C)']), temp_junction_c: numOrNull(c['Temperature (Sensor junction) (C)']), temp_memory_c: numOrNull(c['Temperature (Sensor memory) (C)']), power_avg_w: numOrNull(c['Average Graphics Package Power (W)']), power_max_w: numOrNull(c['Max Graphics Package Power (W)']), fan_percent: numOrNull(c['Fan speed (%)']), fan_rpm: numOrNull(c['Fan RPM']), }; }); return textResult({ timestamp: new Date().toISOString(), card_count: cards.length, cards, }); } - server.js:357-361 (schema)Schema/registration entry for the 'gpu_status' tool in the TOOLS array. Defines the tool name, description, annotations (read-only), and an empty inputSchema (no parameters).
name: 'gpu_status', description: 'One-shot summary of all AMD GPUs: product name, GPU utilization %, VRAM used/total bytes and %, edge/junction/memory temperatures, average and max power, fan speed % and RPM. Returns one entry per card. Fields that the card does not support are returned as null (not omitted).', annotations: { title: 'GPU status summary', readOnlyHint: true, destructiveHint: false, openWorldHint: false }, inputSchema: { type: 'object', properties: {}, additionalProperties: false }, }, - server.js:395-401 (registration)HANDLERS mapping object that maps tool name 'gpu_status' to the gpuStatus function for dispatch.
const HANDLERS = { gpu_status: gpuStatus, gpu_metrics: gpuMetrics, gpu_processes: gpuProcesses, gpu_watch: gpuWatch, rocm_info: rocmInfo, }; - server.js:47-51 (helper)requireRocmSmi() helper used by gpu_status to check if rocm-smi binary is available before running.
function requireRocmSmi() { if (!BIN.rocmSmi) { return 'rocm-smi is not installed. Install with: sudo apt install rocm-smi (or a full ROCm stack). See https://rocm.docs.amd.com/ for installation options.'; } return null; - server.js:76-89 (helper)parseRocmJson() helper used by gpu_status to parse rocm-smi's JSON output, with fallback for banner text.
function parseRocmJson(stream) { const trimmed = (stream || '').trim(); if (!trimmed) return null; if (/No JSON data to report/i.test(trimmed)) return null; try { return JSON.parse(trimmed); } catch (_) { const start = trimmed.indexOf('{'); const end = trimmed.lastIndexOf('}'); if (start >= 0 && end > start) { try { return JSON.parse(trimmed.slice(start, end + 1)); } catch (_) {} } return null; }