Generated GraphQL fails in a predictable way — a field that does not exist, a required argument omitted — and a validator that returns an error leaves the model to guess again from the same starting point. Correcting in place closes the loop with one round trip. The query history is the underrated tool here: the expensive part of this workflow is arriving at a query that works, and being able to retrieve it later means that cost is paid once rather than each time the question comes up again. Note that generation costs OpenAI tokens per attempt, so a loop that regenerates rather than reusing history is spending real money.
A natural-language-to-GraphQL pipeline in five tools: generate a query from a description, validate and update it, execute it with optional visualisation, and read back examples and history.
- generate_graphql_query turns a description into a query rather than requiring the schema to be known first.
- validate_graphql_query both validates and updates — so a query that does not check out is corrected rather than only rejected.
- execute_graphql_query runs it and can visualise the results.
- get_query_examples shows what kinds of question the endpoint supports, which is the fastest way to calibrate what to ask for.
- get_query_history returns every query run, so a working one can be recovered rather than regenerated.
OPENAI_API_KEY — generation runs on OpenAI, so calls bill against your account.
One command plus a key — uvx text-to-graphql-mcp, then supply credentials
