Skip to main content
Glama

i2c_read_reg

Read registers from I2C slave devices to verify sensor presence or fetch data. Returns distinct diagnostics for all-zero or all-0xFF responses to flag wiring or power issues.

Instructions

读 I2C 从设备的寄存器(最常见的「这颗 IMU 是不是活的」动作)。

addr 是7 位地址(MPU-6050 写 0x68,别写 8 位的 0xD0/0xD1,工具会拦下来); reg 是寄存器地址;count 是要读的字节数(1–256)。

★ 读回全 0 或全 0xFF 时不要直接判「器件坏了」:工具会分别给出这两种情况 完全不同的成因清单(全 0xFF 往往是器件没接/没上电,而不是寄存器的值是 0xFF)。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
busNo
regYes
addrYes
portNo
countNo
baudrateNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.2/5.0
Behavior4/5

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

With no annotations, the description carries the behavioral burden and does add real context: it discloses that the tool actively validates the address width and rejects 8-bit addresses, and that all-0 / all-0xFF reads produce two distinct diagnostic cause lists (notably that 0xFF usually means the device is unpowered/disconnected, not that the register holds 0xFF). It does not describe error codes, bus-selection behavior, or access requirements.

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?

Front-loaded with the core action and the single most dangerous parameter mistake up front, then a starred gotcha note. No filler sentences; every clause carries actionable information.

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

Completeness4/5

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

An output schema exists, so return-value format need not be covered, and the description instead covers the failure interpretation an agent actually needs. It is nearly complete for a register read, with the remaining gap being the undocumented bus/port/baudrate parameters and no explicit pointer to sibling tools.

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

Parameters3/5

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

Schema description coverage is 0% across 6 parameters, so the description must compensate. It does define addr (7-bit, with 0x68 vs 0xD0/0xD1 example), reg, and count (range 1–256), but leaves bus, port and the unexpected baudrate parameter completely unexplained, so nearly half the parameter surface remains undocumented.

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?

States a specific verb+resource: read an I2C slave register, and even characterizes the archetypal use case (checking whether an IMU is alive). This clearly separates it from i2c_write_reg, i2c_scan and spi_read_reg siblings.

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

Usage Guidelines4/5

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

Gives concrete usage context ("the most common 'is this IMU alive' action") and a hard precondition: addr must be the 7-bit form (0x68, not 0xD0/0xD1) because the tool rejects the 8-bit form. It does not explicitly route the agent between this and siblings like i2c_scan or decode_register, so it stops short of a full when/when-not guide.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.