Add analyze_dataset orchestrator and recommended_next_steps (#30, #32)#40
Merged
Merged
Conversation
#32: New analyze_dataset tool runs the full first-look pipeline (inspect_mesh, validate_dataset, inspect_variable, calculate_area, calculate_zonal_mean, plot_mesh, plot_variable) in one deterministic call. Accepts direct paths or session_id+dataset_handle, forwards use_remote/endpoint to every stage, and recovers per-stage failures into a warnings list rather than aborting. #30: Result-bearing tools now expose recommended_next_steps so an agent can chain a workflow without already knowing the tool vocabulary. Coverage: calculate_zonal_mean, validate_dataset (branched on pass/fail), subset_bbox, subset_polygon, extract_cross_section. Tests: 12 new tests in test_analyze_dataset.py and test_recommended_next_steps.py; full suite at 247 passed.
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.
Summary
Closes #30 and #32. Two related improvements that turn the tool surface from a passive library wrapper into a chainable workflow:
analyze_dataset: deterministic one-shot orchestrator that runs the full first-look pipeline (inspect_mesh→validate_dataset→inspect_variable→calculate_area→calculate_zonal_mean→plot_mesh→plot_variable) and returns a single structured result. Each stage runs defensively; a failure is recorded inwarningsand the pipeline continues. Accepts direct paths orsession_id+dataset_handle. Forwardsuse_remote/endpointto every underlying stage.recommended_next_steps: result-bearing tools now suggest follow-up calls so an agent can chain a workflow without knowing the tool vocabulary up front. Coverage in this PR:calculate_zonal_mean,validate_dataset(branched on pass/fail),subset_bbox,subset_polygon,extract_cross_section. (inspect_mesh,inspect_variable,calculate_areaalready had this from earlier work.)analyze_datasetis the deterministic counterpart torun_scientific_agent— same general shape, but no LLM reasoning, no branching heuristics, just a predictable chain.Test plan
uv run pytest tests/ --ignore=tests/test_remote_agent.py→ 247 passeduv run pre-commit run --all-files→ cleantests/test_analyze_dataset.py(6 tests — healpix-only, with-data, plots-on, dataset_handle, single-stage failure recovery, recommended_next_steps presence)tests/test_recommended_next_steps.py(6 tests — one per tool, plus the validate-fail branch)analyze_dataset("healpix:2")returns mesh+area+plot, no warningsFiles changed
src/uxarray_mcp/tools/orchestration.py— new file, definesanalyze_datasetsrc/uxarray_mcp/tools/__init__.py+src/uxarray_mcp/server.py— register the new toolsrc/uxarray_mcp/tools/inspection.py—recommended_next_stepsoncalculate_zonal_meanandvalidate_datasetsrc/uxarray_mcp/tools/advanced.py—recommended_next_stepsonsubset_bbox,subset_polygon,extract_cross_sectionCHANGELOG.md— Unreleased entries for Tool results should recommend next steps to guide agent chaining #30 and Add one-shot analysis entry point: analyze(path) or analyze(session_id, dataset_handle) #32tests/test_analyze_dataset.py,tests/test_recommended_next_steps.py— new