Skip to content

fix: reject __in lookups, suggest list-as-value form#144

Merged
abubnalitic-nbl merged 3 commits into
netboxlabs:mainfrom
puneetdixit200:docs/clarify-filter-lookups
May 26, 2026
Merged

fix: reject __in lookups, suggest list-as-value form#144
abubnalitic-nbl merged 3 commits into
netboxlabs:mainfrom
puneetdixit200:docs/clarify-filter-lookups

Conversation

@puneetdixit200

@puneetdixit200 puneetdixit200 commented May 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • reject relationship ID list filters like vminterface_id__in before calling NetBox, because unsupported lookups may be silently ignored and return overly broad results
  • keep object-ID lookups such as id__in valid
  • update the netbox_get_objects tool description so MCP clients see the runtime rule
  • add regression coverage for both filter validation and the tool description

Closes #79. Supersedes #145, credit to @llamafilm for the broader-scope insight and the actionable error message.

Verification

  • uv run pytest tests/test_filter_validation.py -q
  • uv run pytest tests/test_tool_descriptions.py -q
  • uv run pytest tests/test_filter_validation.py tests/test_tool_descriptions.py -q
  • uv run pytest -q
  • uv run ruff check
  • git diff --check

AI disclosure

This contribution was prepared with AI assistance and reviewed before submission.

@puneetdixit200 puneetdixit200 changed the title docs: clarify NetBox lookup filter support fix: reject relationship ID list filters May 24, 2026
@puneetdixit200

Copy link
Copy Markdown
Contributor Author

Updated this beyond the original wording-only guard. The branch now rejects relationship ID list filters such as vminterface_id__in in validate_filters() before they can be sent to NetBox, while keeping object-ID list lookups like id__in valid.

Verification passed locally: uv run pytest -q, uv run ruff check, and git diff --check.

…t so id__in, status__in, etc. are also rejected (empirically silently ignored by NetBox), and surface the working list-as-value form in the error message. Keep PR netboxlabs#144's tool-description warning and tests.
@abubnalitic-nbl

Copy link
Copy Markdown
Contributor

Thanks for this @puneetdixit200 , I've included some of the improvements from #145 as well for a more complete handling of the __in suffix

@abubnalitic-nbl abubnalitic-nbl changed the title fix: reject relationship ID list filters fix: reject __in lookups, suggest list-as-value form May 26, 2026
@abubnalitic-nbl abubnalitic-nbl merged commit 7900563 into netboxlabs:main May 26, 2026
10 checks passed
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.

Tool description misleads LLMs about __in filter support — silently returns all records

2 participants