Skip to content

Add IoT telemetry analysis and history tools#451

Merged
DhavalRepo18 merged 12 commits into
mainfrom
migrate-stream-extent
Jul 14, 2026
Merged

Add IoT telemetry analysis and history tools#451
DhavalRepo18 merged 12 commits into
mainfrom
migrate-stream-extent

Conversation

@ShuxinLin

@ShuxinLin ShuxinLin commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add the IoT stream_extent, history, latest_reading, sensor_coverage, and sensor_stats MCP tools.
  • Parse ISO 8601 timestamps consistently, apply half-open windows by chronological value, compare aware timestamps by instant, and reject invalid or mixed-awareness streams.
  • Add exact paged history with query-bound opaque cursors, sensor projection, metadata exclusion, and final-page lookahead.
  • Select latest readings by parsed timestamp and report UTC age with explicit offset-free timestamp semantics.
  • Compute full-stream sensor coverage and constant-memory numeric statistics with explicit handling for missing, null, invalid, and non-finite values.
  • Keep decorated tool functions in main.py, move response models to models.py, and centralize telemetry timestamp, paging, projection, cursor, and accumulator logic in telemetry_helper.py.
  • Review and tighten all 12 IoT tool docstrings, shorten the server instruction to routing guidance, and document the complete registry and telemetry tool surface.
  • Keep generated tool descriptions and returned errors storage-neutral.

Tests

  • .venv/bin/pytest src/servers/iot/tests (90 passed)
  • .venv/bin/python -m py_compile src/servers/iot/main.py src/servers/iot/models.py src/servers/iot/telemetry_helper.py src/servers/iot/tests/test_tools.py
  • Live smoke tests for full-range, date-only, sensor-filtered, all-sensor, invalid-sensor, timezone-mismatch, full sensor coverage, two-page history, exact final-page detection, and latest readings.

This branch was created from add-iot-measured-sensors; that branch has since merged into main in #450, so this PR targets main.

Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
@ShuxinLin ShuxinLin changed the title Add IoT stream extent tool Add IoT stream extent and sensor statistics tools Jul 14, 2026
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
@ShuxinLin ShuxinLin changed the title Add IoT stream extent and sensor statistics tools Add IoT stream extent, coverage, and statistics tools Jul 14, 2026
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
@ShuxinLin ShuxinLin changed the title Add IoT stream extent, coverage, and statistics tools Add IoT telemetry analysis and history tools Jul 14, 2026
@ShuxinLin
ShuxinLin requested a review from DhavalRepo18 July 14, 2026 22:07
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>

@DhavalRepo18 DhavalRepo18 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Repeatng one more time, I am merging this PR so we can all look at the all tools in one place and arrangement become easy.

@DhavalRepo18
DhavalRepo18 merged commit dda9f20 into main Jul 14, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants