The Rubrik Security Cloud GraphQL API is BIG. The API has more than 1,300 queries, 1,100 mutations, and about 9,000 types. The API schema file is more than 250,000 lines and about 8 MB of text.
The Rubrik MCP server gives an AI agent access to all of it with only four MCP tools: three for discovery and one for execution. The server turns on 13 tools by default, but the other nine are conveniences that don't reach any part of the API the four can't.
This is the first post in a four-part series diving into how that works. This one covers the architecture: the cost of "one tool per operation," why tool search doesn't solve the underlying problem, how a natural-language prompt maps onto GraphQL, and how we index the schema's own built-in documentation so an agent can search it. It also covers one of the goals behind shipping the index inside the package: an agent can write working code against the API without ever connecting to it.
Two jobs: Discovery and Execution
Any agent working against an API has to do two different things:
1. Discovery: Figure out which operation answers the question and what shape the request needs to be: arguments, input types, enum values, which fields to select
2. Execution: Send the request, handle pagination, and return the result
Many MCP servers merge these two jobs, so each operation becomes a tool, the tool's description handles discovery, and calling the tool handles execution. That works well for an API with 20 endpoints, but at more than 2,000 it falls apart in two ways.
Problem 1 - Tools eat context: Every tool an MCP server offers sends its name, description, and JSON input schema to the model, usually on every turn, because that's how the model knows the tool exists.
So we measured what "one tool per operation" would cost for RSC:
| Approach | Approximate tokens |
The Rubrik MCP's 4 core tools (discovery + execution) | ~1,500 |
All 13 Rubrik MCP tools, including “curated” tools and workflow management | ~6,500 |
One tool per operation, name + description + top-level args only | 240,000+ |
One tool per operation, with input types expanded (median ~460 tokens each) | ~1,000,000+ |
Full schema as SDL | ~2,000,000 |
(Token counts are estimated at four characters per token.)
Even the most stripped-down version, a bare name, description, and top-level arguments for each operation, costs more than 240,000 tokens before the user has typed anything. That's more than the context window of many models. And a bare version is useless anyway: the top-level argument for many RSC operations is just input: SomeInput!, which tells the model nothing about what goes inside it.
Problem 2 - Overlapping tools cause the wrong tool to be picked: Context cost is the obvious problem, but tool selection is subtler and does more damage.
A large API has many operations that look nearly the same from the outside. Search the RSC schema for "Take an on-demand snapshot of a VM" and you'll find separate operations for vSphere, Nutanix, Hyper-V, SaaS workloads, SQL and so on. Some of those have V1 and V2 versions, and some come in bulk and single-object flavors. They're all correct for something, and their descriptions are all variations on "Take an on-demand snapshot."
When each of these becomes its own tool, the model has to choose between them using only names and one-line descriptions. Nothing in that choice tells it which of the near-duplicates fits the user's workload. The more tools there are, the more near-neighbors each one has, and the more often the model confidently picks the wrong one.
This is also easy to set up by accident. Connect two copies of the same MCP server (a production config and a dev config, say) and the agent sees every tool twice, each with an exact twin under the same name, and the model is left guessing which one you meant.
What About Tool Search?
Some MCP clients now defer tool definitions. Instead of loading every schema up front, the model gets a list of tool names plus a search tool, and it loads full definitions on demand. That's a real improvement for context cost and worth turning on, so it's fair to ask whether generating a tool for every operation and letting tool search find them would work as well as indexing the schema. We don't think it does, for four reasons.
1. The name list still costs something on every turn: A deferred tool still appears in context by name. When we connected a 170-tool MCP server to a client that defers, each new agent's starting context grew by a few thousand tokens, almost all of it tool names. At that rate, more than 2,000 operations would cost on the order of 25,000 tokens per turn before a single tool is loaded, compared with about 1,500 for our four core tools.
2. A tool definition describes inputs, not outputs: Tool search can only match the text in a tool definition: its name, its description, and at most its input schema. The words that tell GraphQL operations apart often live in what they return. "Detected" matches the lastDetection field that threatMonitoringMatchedObjects returns, and "who is logged in" matches Group.activeUsers, but neither appears anywhere in those operations' inputs. Our index searches return types and their fields, which is where that vocabulary lives.
3. GraphQL's selection set doesn't fit inside a tool: The point of GraphQL is that the caller chooses which fields come back. A tool per operation has to settle that in advance, and every option is a compromise: return a fixed set of fields and miss data or return huge payloads, accept a selection-set argument and push the same return-type discovery onto the model anyway, or flatten nested objects and connections. With the index, the agent writes exactly the query it needs, including nested fields and several root fields in one request.
4. We can measure and tune our own ranking: Tool search ranking belongs to the client, differs from one client to the next, and can't be evaluated or tuned by the API owner. Our search is deterministic, so we can score a change against real questions before it ships (part 3 covers that loop). It also works in clients that don't defer tools at all, where more than 2,000 tools would simply be unusable.
In short, the useful structure lives in the API's type system, so that's what we index.
The Anatomy of a Prompt
Take a prompt an admin might actually type: "Which objects had critical threats detected in the last week?"
Break it into parts:
| Prompt fragment | What it is | GraphQL equivalent |
"Which ... ?" | A read, not a change | query (not mutation) |
"threats detected" | The subject of the question | The root field: threatMonitoringMatchedObjects |
| "critical" | A filter on the subject | An enum argument: severityFilter: [CRITICAL] |
| "in the last week" | A scope on the data | A time argument: beginTime |
| "objects" (a list) | The shape of the answer | The selection set: nodes { objectName objectType filesMatched lastDetection } |
Put together, that's the query:
query {
threatMonitoringMatchedObjects(
severityFilter: [CRITICAL]
beginTime: "2026-10-24T00:00:00Z"
) {
count
nodes { objectName objectType filesMatched lastDetection }
}
}
The parallel isn't a coincidence, because a GraphQL operation is a structured statement of intent. The operation type says whether you're reading or changing something, the root field names the thing you're asking about, arguments narrow it down, and the selection set states exactly what you want back. Natural-language questions about infrastructure have the same parts: a verb, a subject, some qualifiers, and an expected answer shape.
REST spreads that intent across URL paths, HTTP verbs, query strings, and response bodies you can't trim, while GraphQL puts all of it in one typed document. For an LLM, that's close to ideal, because the prompt and the query share a grammar.
It also means the vocabulary that tells operations apart is spread across the whole schema, not just the operation names. "Critical" doesn't appear in the operation's name; it lives in an argument and its enum values. "Detected" shows up in a return field, lastDetection. A discovery system that only looks at operation names (or tool names) misses much of what the user said.
The Documentation is Built In
There's a second property of GraphQL that matters even more here: the documentation lives in the schema.
Every operation, type, field, argument, and enum value in a GraphQL schema can carry a description. Those descriptions aren't a separate docs site that drifts out of date. They're part of the API definition itself, they ship with every schema version, and GraphQL tools (GraphiQL, code generators, IDE plugins) can read them. Here's what a field looks like in the RSC SDL:
type StartThreatHuntV2Reply {
"Forever ID of the hunt that can be used to query threat hunt APIs."
huntId: String!
}
With a REST API you'd need an OpenAPI spec maintained alongside the code, and you'd hope someone kept it current. With GraphQL, the names and descriptions are the reference documentation, and our API reference on developer.rubrik.com is generated from them.
Those descriptions are the raw material for discovery and the Rubrik MCP's search index is built entirely from the schema: operation names and descriptions, the fields on each operation's return type, and the field and type descriptions underneath. There's no hand-written tool catalog and no separate set of hints. The search tool reads the same documentation a developer reads.
That has a consequence we'll come back to in part 3: every improvement to our API documentation makes the Rubrik MCP smarter, with no new tools to ship.
Four Tools: Three to Find, One to Run
The core of the Rubrik MCP is four tools, and three of them handle discovery by reading a prebuilt index of the schema:
- rsc_search_schema takes a natural-language question and returns the ten best candidate operations.
- rsc_describe_operation_full takes an operation name and returns its full signature with every input type and enum expanded inline, plus the fields on its return type, so the agent can write a correct query on the first try.
- rsc_describe_type looks up any single type when the agent needs to go deeper.
And one handles execution:
- rsc_execute_operation runs any GraphQL query the agent has built against the customer's RSC account, with pagination handled for it. It's read-only: for a mutation, the agent uses the same discovery results to write a runnable script instead (more on that below).
Those four tools are enough to reach every operation in the API, running the queries and scripting the mutations, and their definitions cost about 1,500 tokens.
The other nine
The server ships nine more tools on top of the core four:
| Group | Tools | Why they exist |
| Curated reads | rsc_get_workloads, rsc_get_events, rsc_get_clusters, rsc_get_sla_domains, rsc_wait_for_job | One-call answers to the most common questions, with field selection, filters, and pagination already worked out |
| Help search | rsc_search_help | Searches knowledge base articles and product docs, not the API |
| Workflows | rsc_save_workflow, rsc_list_workflows, rsc_delete_workflow | Save a discovered sequence of steps as a named, reusable tool |
None of them reach operations that the core four can't. The curated reads exist as shortcuts for questions that come up constantly, and in some cases for nouns so common in the API that keyword search struggles to rank them (part 4 covers that). A few write tools, such as on-demand snapshots and SLA assignment, are also available, but they're off by default and only appear when an admin turns them on.
Indexing the Schema
The discovery tools are only as good as the index behind them, so it's worth looking at how that index is built.
Three indexes, one ranking: Search uses BM25, a long-established keyword ranking function that scores documents by how many search terms they contain, weighted toward rare terms. (Part 2 goes into how it works and where it falls short.) rsc_search_schema doesn't run just one BM25 search, though. It runs three indexes over different layers of the schema and merges the results:
1. Operation index: Operation names and descriptions, plus return-type field names. This is the closest to what tool search sees.
2. Field index: Every field on every type, with its description. A match here resolves to the type that owns the field, then to the operations that return that type. This is how "who is logged in" finds Group.activeUsers and then the operations that return Group.
3. Type index: The combined vocabulary of each type. This is how "cluster storage runway" lands on the Cluster type and then on the operations that list clusters.
Each index ranks operations independently, and the lists are merged with reciprocal rank fusion, so an operation that shows up in several indexes ranks higher than one that matches strongly in only one. The raw BM25 scores from different indexes measure different things, so we merge by rank instead of score.
Here's real output for "threat hunt for a file hash across backups":
| Type | Query | Description |
| query | threatMonitoringMatchedFileDetailsV2 | Details of the Threat Monitoring matched file |
mutation | startBulkThreatHunt | Start a new bulk threat hunt |
| query | threatHuntMatchedSnapshots | List of matched snapshots for a set of file matches |
mutation | startThreatHuntV2 | Start a new threat hunt. |
query | threatHunts | List of Threat Hunts |
The response costs about 500 tokens, and from it the agent picks startThreatHuntV2, calls rsc_describe_operation_full, and gets back the input shape (baseConfig: ThreatHuntBaseConfigInputType!, objectFids: [UUID!]!) and the return type (huntId: String!). That takes two calls and a few thousand tokens, covering an API surface of about 2 million.
This is a two-stage process: retrieve candidates cheaply, then load the full detail for only the one that matters. Tool search follows the same pattern; the difference is that we retrieve over the API's own structure (operations, fields, and types) instead of a flat list of tool descriptions.
Why Not Just grep the Schema or Use Introspection?
Agents that can run shell commands will happily grep a schema file. On the RSC SDL, grep -i snapshot returns more than 13,000 lines, and grep -i sla returns more than 8,000. The agent then has to page through that output, piece type definitions back together across thousands of lines, and follow input types by hand, all of it inside its context window.
Grep is also literal and unranked: it finds every line containing the string, in file order, with no notion of which match matters most. BM25 does the ranking for you, and because the index splits camelCase names into words and reduces them to stems, "threats detected" can match an operation called threatMonitoringMatchedObjects with a field called lastDetection.
GraphQL introspection is the standard way for a client to learn a schema and it's great for tooling. For an LLM though, it's a poor fit because the RSC introspection result is a single JSON document of more than 14 MB, over 3.5 million tokens. It's more verbose than SDL because every type reference is a nested {kind, name, ofType} object. You can't take a useful slice of it without already knowing what you're looking for. It also needs a live, authenticated connection to the API.
The index is the opposite: it's precomputed, ranked, and returns only the slice you asked for. It's built from the same descriptions that introspection would give you, just arranged in a form an LLM can search.
Offline Code Generation
The index currently ships inside the rsc-client Python package as a set of JSON files, regenerated from the published schema and pulled into the package on a regular cadence. The discovery tools read those files directly, which means discovery needs no credentials and no network access.
We built it that way on purpose, because working offline opens up several workflows:
- Prototype before you have access: A developer evaluating the API, or waiting on a service account, can ask "how would I assign an SLA to a list of VMs?" and get a correct, typed answer immediately.
- Generate code for anything, including writes: rsc_describe_operation_full returns the complete input shape for any mutation, so the agent can write a runnable Python script against rsc-client for an operation it will never execute itself. Raw execution through the MCP is read-only, so when an agent attempts a mutation, the server blocks it, and the agent switches to generating a reviewed, runnable script instead. The change happens outside the MCP, where a person can review the script first, and the agent still does the hard part of getting the request shape right.
- Restrict environments: Teams building automation from a network segment that can't reach the API still get full schema-aware assistance.
- Pin it and make it reproducible: The index matches a specific schema version, and if your tenant is ahead of the index you have installed, the server tells the agent, so it knows a newer operation might be missing rather than concluding it doesn't exist.
Introspection can't do any of this, because it only exists while you're connected.
Putting it Together
The design comes down to a few principles:
1. Keep the core small and stable: With four tools using only about 1,500 tokens of context, we reach the entire API. Our curated tools (workloads, events, clusters, SLA Domains, job polling) are added only as shortcuts for the questions people ask most. The default server is still just 13 tools, plus three write tools an admin can turn on.
2. Index the API, not the tools: The structure that separates one operation from another lives in fields and types, so search there.
3. Use the documentation that's already there: GraphQL ships its docs inside the schema. Build discovery from them, and every documentation improvement becomes a discovery improvement.
4. Retrieve first, then expand: Return ten cheap candidates, then load full detail for one.
Separate discovery from execution: Discovery works offline and without credentials, while execution is authenticated, read-only by default, and governed by the service account's permissions.
The result is an agent that can reach every operation in an API with more than 2,000 operations through four tools, from a context budget smaller than a single expanded tool definition for some of those operations.
Next: in part 2, we look inside the search: how BM25 scores the schema, what it's good and bad at, and how the model rewrites a user's question into keywords the index can match.
The Rubrik MCP is open source at github.com/rubrikinc/rubrik-mcp and installable from PyPI. The discovery tools work without an RSC account, so you can try them on the schema today.