Skip to content

fix(devices): compile list() filters into df expression#50

Merged
asachs01 merged 1 commit into
mainfrom
fix/devices-list-df-filters
Jul 5, 2026
Merged

fix(devices): compile list() filters into df expression#50
asachs01 merged 1 commit into
mainfrom
fix/devices-list-df-filters

Conversation

@asachs01

@asachs01 asachs01 commented Jul 5, 2026

Copy link
Copy Markdown
Member

Summary

Root-cause fix for the filter half of wyre-technology/ninjaone-mcp#56. GET /v2/devices only accepts df (device filter), pageSize, and after — but devices.list() sent organizationId / status / nodeClass as named query params, which the API silently ignores. Every filtered call therefore returned the full unfiltered fleet.

Changes

  • Compile filters into a df expression per the Ninja RMM Public API v2.0.5 Device Filter Syntax:
    • organizationIdorg=<id>
    • nodeClassclass=<NodeClass>
    • status ONLINE/OFFLINE → bare online / offline predicates; APPROVAL_PENDING → status=PENDING
    • combined with AND
  • Add an after param (numeric device-id pagination); cursor from BaseListParams is accepted as a string alias.
  • Fail loudly on a status with no df equivalent (UNKNOWN) rather than silently returning everything — same principle as the deps-dev(deps-dev): bump the dev-dependencies group across 1 directory with 7 updates #54 board_id fix.
  • Mark the four params the endpoint never supported (displayName, includeSystem, includeOS, includeNetworkInterfaces) @deprecated; they're no longer sent.

Testing

Four new integration tests (all verified failing before the change): multi-filter → df=org=5 AND class=WINDOWS_WORKSTATION AND online with named params absent; OFFLINE + cursor alias → df=offline&after=42; APPROVAL_PENDING → df=status=PENDING; UNKNOWN rejects. 90/90 pass, tsup build clean, no new lint warnings.

Note on the MCP server

The companion ninjaone_devices_list fix (forward the filters + surface a pagination cursor in the response so truncation is detectable) lands separately in ninjaone-mcp for #56.

Refs wyre-technology/ninjaone-mcp#56

GET /v2/devices only honors df/pageSize/after — the named params the SDK
sent (organizationId, status, nodeClass) were silently ignored by the
API, so every filtered devices.list() returned the full unfiltered fleet.

Compile organizationId/nodeClass/status into a df device-filter string
(org=<id>, class=<NodeClass>, online|offline, status=PENDING), add an
`after` param with `cursor` accepted as a string alias, and reject
statuses with no df equivalent (UNKNOWN) instead of silently returning
everything. The four unsupported passthrough fields (displayName,
includeSystem/OS/NetworkInterfaces) are marked @deprecated and no longer
sent.

Refs: wyre-technology/ninjaone-mcp#56
@asachs01 asachs01 merged commit 6f2e661 into main Jul 5, 2026
2 checks passed
github-actions Bot pushed a commit that referenced this pull request Jul 5, 2026
## [2.0.1](v2.0.0...v2.0.1) (2026-07-05)

### Bug Fixes

* **devices:** compile list() filters into df expression ([#50](#50)) ([6f2e661](6f2e661)), closes [wyre-technology/ninjaone-mcp#56](wyre-technology/ninjaone-mcp#56)
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.

1 participant