Skip to main content
Glama

i2c_scan

Scan the I2C bus for 7-bit addresses and list possible devices at each responding address, with optional low/high range limits.

Instructions

扫描 I2C 总线上的 7 位地址,标出每个应答地址上可能是什么器件。

这是「板子上到底挂了什么」的第一手答案。low/high 可缩小范围 (默认 0x08–0x77,即 I2C 规范里可自由分配的段;保留段会被跳过)。

★ 三条边界(别把结论放大): · 「有应答」只说明该地址有人 ACK,不代表这颗器件功能正常; · 同一地址常被多颗器件共用(0x68 上可能是 MPU-6050 也可能是 DS1307), 要定种必须读它的 WHO_AM_I / ID 寄存器(i2c_read_reg); · 挂在 TCA9548A 这类 I2C 多路复用器后面的器件默认是断开的, 直接扫主总线只能看到复用器自己(0x70–0x77)。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
busNo
lowNo
highNo
portNo
baudrateNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4/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 handles it well: it discloses that reserved address segments are skipped, that the default scan range is 0x08–0x77, and that an ACK only proves a responder exists, not that the part is functional. It does not cover permissions or error behavior, but for a read-only scan this is substantial disclosure.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded purpose sentence followed by a clearly delineated three-point caveat block. Every element earns its place, though the formatting emphasis markers add some noise.

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 values need not be explained, and the description instead supplies the interpretive caveats an agent needs to avoid over-reading scan results. The remaining gap is the silently undocumented bus/port/baudrate parameters.

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

Parameters2/5

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

Schema description coverage is 0% across 5 parameters, so the description must compensate. It explains low/high as a narrowing range and gives their conceptual default, but bus, port, and baudrate are completely undocumented in both schema and description. It also states a default range of 0x08–0x77 while the schema shows low=0/high=0, leaving the actual default behavior ambiguous.

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 uses a specific verb+resource: '扫描 I2C 总线上的 7 位地址' (scan 7-bit addresses on the I2C bus), and clearly frames the output as which responding addresses might hold which device. It also implicitly distinguishes itself from i2c_read_reg by describing the scan as the identification starting point.

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?

It gives context for use ('板子上到底挂了什么' first-hand answer), points to the alternative tool for identification ('要定种必须读它的 WHO_AM_I / ID 寄存器(i2c_read_reg)'), and warns when the scan will be misleading (devices behind a TCA9548A mux). What is missing is explicit routing versus the other scan siblings (spi_scan, onewire_scan), but the context is clear.

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