Querying Nue with Natural Language
4 min
introduction nue exposes its data to ai agents through the model context protocol (mcp) rather than writing graphql by hand, an agent connected to the nue mcp server asks a question in plain language through a single tool — querynuedata — and nue does the rest it inspects the schema, builds the right graphql query, runs it against the correct service, and returns an answer this is the recommended way for conversational and agentic experiences to read nue data developers who want to issue graphql directly can still do so through the api — see query nue objects using graphql docid 9j6pcigzvpcgzsdikcwc how it works when an agent calls querynuedata with a natural language question, nue understands the question and determines which objects and fields are involved discovers the schema through introspection, so it works against your org's actual fields and picklists rather than hardcoded assumptions builds and runs graphql queries against the correct endpoint — cpq objects on one service, order objects on the other joins across services when needed by following scalar foreign keys (for example, linking a subscription's customer to that customer's invoices), so a single question can span cpq and order data returns a concise, natural language answer based on the results the agent only ever sees the one querynuedata tool the underlying graphql machinery — schema discovery and query execution — runs internally and is not exposed as separate tools cross service traversal via ai the raw graphql endpoints traverse relationships only within a single service (see graphql relationship traversal docid\ vemqp0s7ggc4wyrgylgcp ) natural language queries remove that boundary because nue plans the query and joins on shared identifiers itself, an agent can ask questions that combine cpq catalog and pipeline data with order subscription and billing data in one request for example, all of the following are answerable through a single querynuedata call "which customers have an active subscription to acme analytics and an overdue invoice?" "what is the total open pipeline by stage for accounts in the technology industry?" "list subscriptions renewing in the next 90 days along with the customer's account owner " what to expect a few behaviors are worth knowing when you build on querynuedata tenant aware ai model nue resolves the ai model configured for your org at request time, with a safe default if no specific model is configured record limits apply as with direct graphql, results are capped at 100 records per underlying query for broad questions, ask for a narrower set or an aggregate (for example, "how many…" or "total… by…") rather than a full list bounded reasoning each question runs through a capped number of internal steps, so responses stay timely graceful answers if the question can't be answered from the available data, the tool responds with a clear "i couldn't find that" style message rather than surfacing raw query errors or retry noise tips for better answers be specific name the object, the filter, and the metric you care about ("active subscriptions for acme created this year") rather than asking open ended questions prefer aggregates for large sets ask "how many" or "total by…" when you don't need every individual record — this avoids the 100 record cap and returns a direct answer ask follow ups conversational refinement ("now break that down by region") works well, since each question is planned independently against the live schema related guides query nue objects using graphql docid 9j6pcigzvpcgzsdikcwc — issue graphql directly against the cpq and order endpoints graphql relationship traversal docid\ vemqp0s7ggc4wyrgylgcp — nested and reverse relationships within a service graphql aggregations docid\ wxok4pxgwzyfbo4ici2zl — counts, sums, and grouped rollups