docs(notebook): add guided tour of the IoT MCP tools - #484
Open
MannXo wants to merge 1 commit into
Open
Conversation
Walks through all 12 tools on the IoT MCP server via the ToolUniverse three-step contract: discovery, sites and assets, sensor inventory, telemetry, a plot, and a workflow registered at runtime. Outputs are stripped, matching the majority of notebooks already in notebook/. The notebook was executed end to end against a local CouchDB loaded with the default dataset. Refs IBM#452 Signed-off-by: Parman Mohammadalizadeh <prmma23@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
A single notebook that walks a first-time user through every tool on the IoT MCP server, using the
ToolUniversethree-step contract. Aimed at the KDD tutorial audience described in #452: someone who has Docker and the default dataset up and wants to understand what the IoT server can actually do.notebook/showcase_iot_mcp_tools.ipynb, 41 cells:init → load_tools → run, namespacing, why the first call is slowlist_tools,find_tools,tool_specificationsites,asset_ids,assets(with theassettypefilter),asset_detailinstalled_sensorsvsmeasured_sensors,sensor_coverage, and the reverse lookupfind_assets_by_sensorsstream_extentfirst (so ahistorycall is never a surprise), thenlatest_reading,sensor_stats, and paginatedhistoryasset_snapshotregistered withtu.register_workflow()and invoked through the sametu.run()entrypointAll 12 tools are covered.
docs/tool_universe.mdgets a one-line pointer so the notebook is findable.The section on
installed_sensorsvsmeasured_sensorssweeps the whole site rather than one asset, because the default dataset happens to contain two genuinely different disagreements worth teaching:Motor_01hasVibration_Xin the registry that never reportsChiller 6has matching counts but mismatched names:Oil Pressurein the registry,Run Statusin the telemetryChanges
uv lock)Related: Refs #452
Verification
Executed end to end against a real local stack, not written from the source alone:
Running it caught two cells that would have shipped looking correct and teaching nothing:
page["cursor"], butHistoryResultexposesnext_cursorwithhas_more, so it always took the "no more pages" branch. It now prints two distinct pages of timestamps.Gates:
ruff check notebook/showcase_iot_mcp_tools.ipynb— all checks passedgitleaks detect --source . --redact --verbose— no leaks founddetect-secrets scanagainst the new file — no findingsnbformat.validate— validChecklist
Notes and open questions
A few judgment calls, each easy to reverse if you would rather go the other way:
Outputs are stripped. 8 of the 10 notebooks already in
notebook/are committed without outputs, and CONTRIBUTING prefers small PRs, so stripping keeps the diff at 742 lines instead of 1532. For a tutorial that people may read on GitHub without running, the executed version is arguably more useful. Say the word and I will push it with outputs.I did not run
ruff formaton the notebook. It wants to expand everytu.run({...})call across roughly eight lines, which reads poorly in a teaching notebook. Worth knowing that all 10 existing notebooks also failruff format --checktoday, and no workflow in.github/workflows/runs ruff, so this is consistent with the repo as it stands rather than a new exception. Happy to format it if you want the notebooks brought into line.This is not a hosted-Colab notebook. Helpter Notebook to Understand MCP Tools and Agents #452 asks for Colab, but also says to assume Docker and data are set up locally, and hosted Colab cannot reach a CouchDB on
localhost. I wrote it for local Jupyter and said so explicitly in the header. If you want a true Colab variant, that needs a reachable CouchDB (or a bundled sample extract) and I would rather agree the approach than guess.748 lines total, over the 300-line preference. Most of it is prose and JSON scaffolding rather than code; I could not see a way to cover 12 tools in one notebook and stay under it.
Two things I noticed but deliberately left alone, since they are outside this issue:
src/mcphub/workflows.pyhasREGISTERED = []and bothchiller_triageandsensor_inventory_gapraise, guarded by a comment saying the IoT server "exposes only registry discovery tools". That is no longer true: it exposeshistory,latest_reading,sensor_stats,sensor_coverage,stream_extentandmeasured_sensors. Re-enabling them looks feasible now. Happy to open a separate issue or PR.uv run pytest tests/unitand./scripts/run_tests.sh, but neithertests/nor that script exists in the repo, so I could not run them.scripts/contains onlycheck_couchdb_data.sh.