Repository navigation
Add particle MCP tool - #1422
Conversation
Signed-off-by: tamohannes <[email protected]>
Signed-off-by: tamohannes <[email protected]>
Signed-off-by: tamohannes <[email protected]>
Signed-off-by: tamohannes <[email protected]>
Signed-off-by: tamohannes <[email protected]>
Signed-off-by: tamohannes <[email protected]>
Signed-off-by: tamohannes <[email protected]>
Signed-off-by: tamohannes <[email protected]>
…tool Signed-off-by: tamohannes <[email protected]>
|
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 tool module exposing PDG particle lookups and name-based search via the ChangesParticle Tool Implementation
Sequence DiagramsequenceDiagram
participant Client
participant ParticleTool
participant ParticlePkg
Client->>ParticleTool: call "particle-lookup" or "particle-search" with args
ParticleTool->>ParticlePkg: resolve by PDG ID or name / call findall(query)
ParticlePkg-->>ParticleTool: particle object(s) or empty result
ParticleTool-->>Client: formatted Markdown result or "not found" message
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 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
🧹 Nitpick comments (1)
tests/test_mcp_clients.py (1)
1010-1025: ⚡ Quick winAdd execute-path tests for
ParticleTool(not just registration).Current tests validate configuration and tool names, but not dispatch correctness. Please add coverage for:
execute("particle-lookup", ...)andexecute("particle-search", ...)routing- unknown tool handling
- argument validation (missing/extra args)
Using
monkeypatchonparticle_lookup/particle_searchkeeps these unit tests deterministic.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/test_mcp_clients.py` around lines 1010 - 1025, Add unit tests that exercise ParticleTool.execute routing and argument validation: instantiate ParticleTool, call configure(), then monkeypatch the underlying functions particle_lookup and particle_search to simple async stubs and assert execute("particle-lookup", args) and execute("particle-search", args) call the correct stub and return expected values; also test execute with an unknown tool name raises the expected error/exception and test argument validation by calling execute with missing and extra args to assert it rejects invalid argument shapes. Use the existing test structure in TestParticleTool and the methods ParticleTool.list_tools, ParticleTool.execute, and the module-level particle_lookup/particle_search names so tests remain deterministic via monkeypatching.
🤖 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 bullet for
nemo_skills.mcp.servers.particle_tool.ParticleTool in
docs/agentic_inference/tool_calling.md by deleting the redundant list item so
only one entry for ParticleTool remains (keep the existing link and description
for ParticleTool and ensure surrounding list formatting is unchanged).
In `@nemo_skills/mcp/servers/particle_tool.py`:
- Around line 119-122: The configure method currently accepts arbitrary
overrides and silently stores them in self._config; change it to validate
overrides against the tool's supported keys and reject unknown keys: in
configure (method configure on the Particle tool class) check that overrides is
a dict, compute unknown = set(overrides) - set(self._config.keys()) (or against
an explicit allowed_keys set if present), and if unknown is non-empty raise a
ValueError listing the unsupported keys; otherwise update self._config with the
validated overrides so only supported config keys are accepted.
---
Nitpick comments:
In `@tests/test_mcp_clients.py`:
- Around line 1010-1025: Add unit tests that exercise ParticleTool.execute
routing and argument validation: instantiate ParticleTool, call configure(),
then monkeypatch the underlying functions particle_lookup and particle_search to
simple async stubs and assert execute("particle-lookup", args) and
execute("particle-search", args) call the correct stub and return expected
values; also test execute with an unknown tool name raises the expected
error/exception and test argument validation by calling execute with missing and
extra args to assert it rejects invalid argument shapes. Use the existing test
structure in TestParticleTool and the methods ParticleTool.list_tools,
ParticleTool.execute, and the module-level particle_lookup/particle_search names
so tests remain deterministic via monkeypatching.
🪄 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: 702cea0f-e173-4079-af4a-154508357e9a
📒 Files selected for processing (3)
docs/agentic_inference/tool_calling.mdnemo_skills/mcp/servers/particle_tool.pytests/test_mcp_clients.py
Signed-off-by: tamohannes <[email protected]>
b75b80b to
7b8fdff
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@nemo_skills/mcp/servers/particle_tool.py`:
- Around line 146-152: The execute method currently ignores the extra_args
parameter which can hide unsupported caller-supplied params; update execute (the
async method named execute) to validate extra_args and fail fast when it is
non-empty (e.g., raise ValueError or return a clear error) before dispatching to
particle_lookup(**arguments) or particle_search(**arguments); ensure the check
references the extra_args symbol and returns/errors immediately so callers know
unsupported extra args were provided.
🪄 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: 3526d683-a31c-45aa-85f6-a842a5340ab6
📒 Files selected for processing (2)
docs/agentic_inference/tool_calling.mdnemo_skills/mcp/servers/particle_tool.py
🚧 Files skipped from review as they are similar to previous changes (1)
- docs/agentic_inference/tool_calling.md
Signed-off-by: tamohannes <[email protected]>
Signed-off-by: tamohannes <[email protected]>
## Summary - Add a NeMo-Gym `ns_tools` config that exposes `ParticleTool` 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#1422. Replaces fork-origin PR #1220 so CI can run with full repository secrets. ## Test plan - `PYTHONPATH=. python -m pytest resources_servers/ns_tools/tests/test_particle_mcp_config.py -q --tb=short` --------- Signed-off-by: tamohannes <[email protected]> Co-authored-by: Christian Munley <[email protected]>
## Summary - Add a NeMo-Gym `ns_tools` config that exposes `ParticleTool` 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#1422. Replaces fork-origin PR #1220 so CI can run with full repository secrets. ## Test plan - `PYTHONPATH=. python -m pytest resources_servers/ns_tools/tests/test_particle_mcp_config.py -q --tb=short` --------- Signed-off-by: tamohannes <[email protected]> Co-authored-by: Christian Munley <[email protected]> Signed-off-by: Rita Fernandes Neves <[email protected]>
Summary
NVIDIA-NeMo/Skillsbranch so CI can access repository secrets.Test plan
python -m py_compile nemo_skills/mcp/servers/particle_tool.pypython -m pytest tests/test_mcp_clients.py::TestParticleTool -q --tb=shortpython -m pytest tests/test_mcp_clients.py -q --tb=shortSummary by CodeRabbit
New Features
Documentation
Tests