Skip to main content
Glama

gpu_metrics

Read-only

Retrieve comprehensive GPU metrics including clocks, voltages, PCIe details, firmware, activity, throttle status, and energy counters using rocm-smi's native JSON output.

Instructions

Full rocm-smi -a --json output for every GPU (clocks, voltages, PCIe link width/speed, firmware versions, per-engine activity, throttle status, energy counters). Use when gpu_status is not enough. The shape is rocm-smi’s native JSON, unmodified.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the gpu_metrics tool. It runs 'rocm-smi -a --json', parses the output, and returns the raw JSON data along with a timestamp.
    async function gpuMetrics() {
      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>'}`);
    
      return textResult({
        timestamp: new Date().toISOString(),
        source: 'rocm-smi -a --json',
        data,
      });
    }
  • Tool schema definition for gpu_metrics in the TOOLS array: name, description, annotations, and inputSchema (no parameters required, read-only hint).
    {
      name: 'gpu_metrics',
      description: 'Full rocm-smi -a --json output for every GPU (clocks, voltages, PCIe link width/speed, firmware versions, per-engine activity, throttle status, energy counters). Use when gpu_status is not enough. The shape is rocm-smi’s native JSON, unmodified.',
      annotations: { title: 'Full GPU metrics', readOnlyHint: true, destructiveHint: false, openWorldHint: false },
      inputSchema: { type: 'object', properties: {}, additionalProperties: false },
    },
  • server.js:395-401 (registration)
    Handler registration: maps the 'gpu_metrics' tool name to the gpuMetrics function in the HANDLERS object.
    const HANDLERS = {
      gpu_status: gpuStatus,
      gpu_metrics: gpuMetrics,
      gpu_processes: gpuProcesses,
      gpu_watch: gpuWatch,
      rocm_info: rocmInfo,
    };
  • Helper function requireRocmSmi() used by gpuMetrics to verify rocm-smi is installed before proceeding.
    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;
    }
  • Helper functions textResult() and errorResult() used by gpuMetrics to format JSON-RPC responses.
    function textResult(obj) {
      return { content: [{ type: 'text', text: JSON.stringify(obj, null, 2) }] };
    }
    function errorResult(message) {
      return { content: [{ type: 'text', text: message }], isError: true };
    }
Behavior4/5

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

Annotations already mark readOnlyHint=true and destructiveHint=false. The description adds context about the tool being a full dump (clocks, voltages, PCIe, firmware, etc.) and that the output is unmodified, which is helpful beyond annotations.

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?

Two sentences, front-loading the core purpose and details. Every sentence adds value: first defines tool, second provides usage guidance. No wasted words.

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

Completeness5/5

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

Given no parameters and no output schema, the description sufficiently explains what the tool returns (full rocm-smi -a --json output) and when to use it. Annotations complement the read-only nature. Complete for a simple metrics tool.

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

Parameters4/5

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

The input schema has no parameters, and schema coverage is 100%. With zero params, the description does not need to add parameter info. Baseline of 4 is appropriate.

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 tool returns full rocm-smi -a --json output for every GPU with specific fields listed. It distinguishes from sibling tools by indicating when to use it (when gpu_status is not enough).

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

Usage Guidelines5/5

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

Explicitly states 'Use when gpu_status is not enough', providing clear guidance on when to prefer this tool over alternatives. Also notes the output shape is unmodified rocm-smi JSON.

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/LukeLamb/claude-rocm-mcp'

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