What is GraphQL?
GraphQL is a query language and API style where the client specifies exactly the fields it wants in one request against a typed schema, avoiding the over- and under-fetching common with REST and exposing a single flexible endpoint.
GraphQL is an API query language and runtime that lets a client ask for precisely the data it needs, no more, no less, in a single request. Instead of many REST endpoints each returning a fixed shape, a GraphQL API exposes one endpoint backed by a strongly typed schema; the client sends a query naming the exact fields and nested relationships it wants, and the server returns matching JSON. This solves two chronic REST problems: over-fetching (an endpoint returns far more than you need) and under-fetching (you must call several endpoints to assemble one view). The typed schema also doubles as live documentation and enables tooling like autocompletion and validation. GraphQL has three operation types, queries (read), mutations (write), and subscriptions (real-time updates). The tradeoffs versus REST: caching is harder because everything goes through one endpoint and POST, and a careless client can issue an expensive nested query, so servers add depth limits, query cost analysis, and persisted queries. For LLM agents, GraphQL's introspectable schema is attractive because an agent can discover available fields programmatically, but the same flexibility means tool designers must constrain what queries an agent may run. Many MCP servers wrap GraphQL APIs (notably GitHub's), translating the model's intent into safe, bounded queries.