Skip to content

feat(tools): add GraphQL query and schema introspection tools#80

Open
mcao2 wants to merge 5 commits intonetboxlabs:mainfrom
mcao2:feat/graphql-tools
Open

feat(tools): add GraphQL query and schema introspection tools#80
mcao2 wants to merge 5 commits intonetboxlabs:mainfrom
mcao2:feat/graphql-tools

Conversation

@mcao2
Copy link
Copy Markdown

@mcao2 mcao2 commented Mar 26, 2026

Complex queries against NetBox currently require multiple sequential tool calls — fetching
a device, then its interfaces, then their IP addresses means 3+ round-trips, each
returning fully-expanded nested objects that consume significant context. NetBox's GraphQL
API (/graphql/) exposes the same data with precise field selection and cross-object
joins in a single request, but it's been inaccessible from the MCP server.

This adds three tools built around a new graphql() method on NetBoxRestClient:
netbox_graphql_query executes raw GraphQL queries, while netbox_graphql_schema_search
and netbox_graphql_type_details give LLMs a way to discover the schema before writing
queries — the same discovery-then-query pattern used by Cloudflare's GraphQL MCP server.

@abubnalitic-nbl
Copy link
Copy Markdown
Contributor

abubnalitic-nbl commented Apr 22, 2026

Hey @mcao2, thanks for this PR, and genuinely sorry for how long it sat without a response.

We’ve just landed a CONTRIBUTING.md that states our scope more clearly - GraphQL and schema introspection are deliberately out of scope for this OSS server. The aim is to keep it simple, read-only over REST, and easy to fork. I appreciate that scope hadn’t been communicated before you started, and I’m sorry we didn’t give you a clear signal earlier.

So we won’t be merging this one. That said, the branch is a solid starting point if you want to run this capability against your own NetBox, forking under Apache 2.0 is first-class for exactly this kind of extension, and the code you’ve written is a clean basis. If you publish the fork, a discussion thread would be a welcome place to share it.

Thanks again for the patience and the care you put into this.

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.

2 participants