Repository navigation
Add radioactive decay MCP tool - #1423
Conversation
Signed-off-by: tamohannes <hovhannes.tamoyan@gmail.com>
Signed-off-by: tamohannes <hovhannes.tamoyan@gmail.com>
Signed-off-by: tamohannes <hovhannes.tamoyan@gmail.com>
Signed-off-by: tamohannes <hovhannes.tamoyan@gmail.com>
Signed-off-by: tamohannes <hovhannes.tamoyan@gmail.com>
Signed-off-by: tamohannes <hovhannes.tamoyan@gmail.com>
Signed-off-by: tamohannes <hovhannes.tamoyan@gmail.com>
Signed-off-by: tamohannes <hovhannes.tamoyan@gmail.com>
Signed-off-by: tamohannes <hovhannes.tamoyan@gmail.com>
…cay-mcp-tool Signed-off-by: tamohannes <hovhannes.tamoyan@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (2)
📝 WalkthroughWalkthroughAdds a new MCP server tool RadioactivedecayTool exposing two tools, ChangesRadioactivedecayTool MCP Server Implementation
sequenceDiagram
rect rgba(10, 90, 180, 0.5)
participant Client
end
rect rgba(20, 160, 80, 0.5)
participant MCP_Server as RadioactivedecayTool
end
rect rgba(200, 80, 40, 0.5)
participant Lib as radioactivedecay
end
Client->>MCP_Server: call "nuclide-info" or "decay-chain" with arguments
MCP_Server->>MCP_Server: validate inputs, inject configured time_unit if missing
MCP_Server->>Lib: construct Nuclide/Inventory and compute info or decay
Lib-->>MCP_Server: return nuclide metadata or activity results
MCP_Server-->>Client: return formatted string or error message
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Review rate limit: 9/10 reviews remaining, refill in 6 minutes. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/agentic_inference/tool_calling.md`:
- Around line 374-375: Remove the duplicated built-in tool entry for
RadioactivedecayTool: keep a single list item for
`nemo_skills.mcp.servers.radioactivedecay_tool.RadioactivedecayTool` (the entry
linking to the radioactivedecay_tool.py and noting the `radioactivedecay`
requirement) and delete the repeated line so the tool appears only once in the
list; ensure the remaining item preserves the correct link and description.
In `@nemo_skills/mcp/servers/radioactivedecay_tool.py`:
- Around line 123-126: The configure method currently blindly updates
self._config with any overrides, which can mask typos and lets missing required
keys like time_unit be silently ignored (since other code uses
self._config.get(...)); change configure(self, overrides, ...) to validate
overrides against the set of allowed keys (the keys already present in
self._config or an explicit ALLOWED_CONFIG_KEYS), raise a ValueError for any
unknown key, and require/validate presence of required keys such as "time_unit"
(do not rely on _config.get for required fields) so callers fail fast; update
references in code that read time_unit (the usage around line 159) to access the
validated key directly (e.g., self._config["time_unit"]) after configure ensures
it exists.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: ae8e4146-8dfb-4ef6-97b4-301fd405606f
📒 Files selected for processing (3)
docs/agentic_inference/tool_calling.mdnemo_skills/mcp/servers/radioactivedecay_tool.pytests/test_mcp_clients.py
Signed-off-by: tamohannes <hovhannes.tamoyan@gmail.com>
d635b93 to
333403c
Compare
Signed-off-by: tamohannes <hovhannes.tamoyan@gmail.com>
There was a problem hiding this comment.
♻️ Duplicate comments (1)
nemo_skills/mcp/servers/radioactivedecay_tool.py (1)
132-132:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winUse direct key access after override-key validation
Line 132 uses
overrides.get(...), but after Lines 124–130, a non-empty validoverridescan only contain"time_unit". Direct access is clearer and fail-fast.Suggested change
- time_unit = overrides.get("time_unit", self._config["time_unit"]) + time_unit = overrides["time_unit"]As per coding guidelines, "Don't use
.get()for accessing dictionary keys if the code expects them to be present; use direct accessdata[key_name]to fail with a clear error instead of silently corrupting data".🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@nemo_skills/mcp/servers/radioactivedecay_tool.py` at line 132, Replace the permissive dictionary .get() access with direct indexing: where you currently have time_unit = overrides.get("time_unit", self._config["time_unit"]), change to use the validated override when overrides is non-empty (e.g. time_unit = overrides["time_unit"]) and fall back to self._config["time_unit"] only when overrides is empty; this relies on the existing validation logic around overrides (Lines ~124–130) so that missing/invalid keys raise immediately instead of silently masking errors.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@nemo_skills/mcp/servers/radioactivedecay_tool.py`:
- Line 132: Replace the permissive dictionary .get() access with direct
indexing: where you currently have time_unit = overrides.get("time_unit",
self._config["time_unit"]), change to use the validated override when overrides
is non-empty (e.g. time_unit = overrides["time_unit"]) and fall back to
self._config["time_unit"] only when overrides is empty; this relies on the
existing validation logic around overrides (Lines ~124–130) so that
missing/invalid keys raise immediately instead of silently masking errors.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 2e5a3f15-3044-47f6-ac2e-ef4369e0bc9f
📒 Files selected for processing (2)
docs/agentic_inference/tool_calling.mdnemo_skills/mcp/servers/radioactivedecay_tool.py
✅ Files skipped from review due to trivial changes (1)
- docs/agentic_inference/tool_calling.md
Signed-off-by: tamohannes <hovhannes.tamoyan@gmail.com>
## Summary - Add a NeMo-Gym `ns_tools` config that exposes `RadioactivedecayTool` through the existing NeMo-Skills ToolManager bridge. - Add a focused config test to keep the resource-server wiring valid. - This is the Gym-side companion to NVIDIA-NeMo/Skills#1423. Replaces fork-origin PR #1221 so CI can run with full repository secrets. ## Test plan - `PYTHONPATH=. python -m pytest resources_servers/ns_tools/tests/test_radioactivedecay_mcp_config.py -q --tb=short` --------- Signed-off-by: tamohannes <hovhannes.tamoyan@gmail.com> Co-authored-by: Christian Munley <cmunley@nvidia.com>
## Summary - Add a NeMo-Gym `ns_tools` config that exposes `RadioactivedecayTool` through the existing NeMo-Skills ToolManager bridge. - Add a focused config test to keep the resource-server wiring valid. - This is the Gym-side companion to NVIDIA-NeMo/Skills#1423. Replaces fork-origin PR #1221 so CI can run with full repository secrets. ## Test plan - `PYTHONPATH=. python -m pytest resources_servers/ns_tools/tests/test_radioactivedecay_mcp_config.py -q --tb=short` --------- Signed-off-by: tamohannes <hovhannes.tamoyan@gmail.com> Co-authored-by: Christian Munley <cmunley@nvidia.com> Signed-off-by: Rita Fernandes Neves <rfernandesne@nvidia.com>
Summary
NVIDIA-NeMo/Skillsbranch so CI can access repository secrets.Test plan
python -m py_compile nemo_skills/mcp/servers/radioactivedecay_tool.pypython -m pytest tests/test_mcp_clients.py::TestRadioactivedecayTool -q --tb=shortpython -m pytest tests/test_mcp_clients.py -q --tb=shortSummary by CodeRabbit
New Features
Bug Fixes / Validation
Documentation
Tests