GraphQL Search
Schema discovery for AI agents

How should an agent find the part of a schema it needs?

Real GraphQL schemas do not fit in a context window. Two working group proposals answer this problem in different ways. They complement each other. Try each one on a real schema, with the same search settings, and see how its own knobs change what comes back.

Try Schema SearchTry Semantic IntrospectionRead about both
question: "latest commit in a repository"

Schema Search

A valid slice of the schema

type Query {
  repository(...): Repository
}
type Repository {
  defaultBranchRef: Ref
}
# Ref, GitObject, Commit ...

Semantic Introspection

A ranked list of coordinates

1  Ref.target
2  Commit.committedDate
3  Commit.message
4  Repository.defaultBranchRef
5  Commit.history

Each result carries a score and its paths to the root.

The problem

The schema is the manual, and it is too long to read

An LLM needs the schema to use a GraphQL API. But most of a large schema has nothing to do with the task. Today every tool picks a part of the schema in its own way.

72,000

lines of SDL in the GitHub schema, approximately

160,000

lines of SDL in the GitLab schema, approximately

No shared contract yet

  • Apollo MCP Server has a search tool
  • Hot Chocolate ships semantic introspection
  • Meta loads partial schemas on demand
Two proposals

Two complementary contracts

Both proposals take natural language and leave the search algorithm to the service. They differ in how the client asks, what comes back, and who decides how much to return. A slice suits an agent that wants usable context in one request. Ranked results suit an agent that explores across several turns.

HTTP endpoint

Schema Search

Dale Seo, Apollo, with Michael Staib, ChilliCream

Request

request
GET /graphql/schema
    ?q=latest+commit+in+a+repository
    &v=september-2025

Response

response
type Query {
  repository(owner: String!, name: String!): Repository
}
type Repository { defaultBranchRef: Ref }
type Ref { target: GitObject }
interface GitObject { oid: GitObjectID! }
type Commit implements GitObject {
  oid: GitObjectID!
  message: String!
  committedDate: DateTime!
}
scalar GitObjectID
scalar DateTime
Transport
GET next to the GraphQL endpoint
How much comes back
The service decides with a size budget
Next step
A new search, with more intents
Scores
None. The response is only a schema.

Introspection extension

Semantic Introspection

Pascal Senn and Michael Staib, ChilliCream

Request

request
query {
  __search(
    query: "latest commit in a repository"
    first: 5
  ) {
    coordinate
    score
    pathsToRoot
  }
}

Response

response
"__search": [
  { "coordinate": "Ref.target",
    "score": 0.82,
    "pathsToRoot": [["Query.repository",
      "Repository.defaultBranchRef", "Ref.target"]] },
  ...
]
Transport
A field in any GraphQL operation
How much comes back
The client decides with first and minScore
Next step
Look up definitions by coordinate
Scores
One per result

Response values are examples. Scores and results on each page come from the search you run.

How it works

One search core, two protocols

Both pages share the same ranking. So a change you see on one page comes from that protocol's own settings, not from a different search. The protocol decides how a request becomes a search, how the results become a response, and what the client can ask next.

Shared search core

Schema

Parsed SDL

Scope

Which parts are eligible

Granularity

Coordinate, field or type

Ranking

BM25, vector or hybrid

Protocol

Schema Search

The top results merged into a valid slice of the schema.

Protocol

Semantic Introspection

Top results with scores and paths, cut by first and minScore.

Measurements

Measure each protocol with its own knobs

Each page shows how its protocol's own controls change what comes back. Schema Search changes how many results go into the slice and whether descriptions stay. Semantic Introspection changes first and minScore. The two are never ranked against each other, because they answer different needs.

Coverage

The share of coordinates in the reference query that the client received.

Tokens

Everything the client read, across all of its requests.

Validity

Whether the response builds as a schema without other input.

Agent success

Whether a model answered the question against a mock server, and in how many turns.

Measurements on the working group's evaluation bench are planned: about 800 questions over the GitHub, GitLab, Linear, Shopify and Singapore open data schemas.

Built in the open

Bring your approach, schema or test case

This is a community project for the GraphQL AI Working Group. Each proposal is presented on its own terms, and its authors are invited to review it. A new idea, such as a hybrid of both, can share the same search core.

Join the AI Working Group →