Progressive Disclosure (651 Tokens)
Instead of streaming up to 203,421 JSON schema tokens into the prompt upfront, GAP holds MCP tools/list at a fixed 651 tokens and reveals schemas across three progressive levels (L0 -> L1 -> L2).
What you'll learn
- How Level 0 (
__metaGraph), Level 1 (__search), and Level 2 (__type) work step-by-step. - Why permission filtering happens BEFORE search scoring (
INV-05). - Inspect real payload sizes returned at each discovery hop.
On this page
Walkthrough: From Intent to Typed Query
-
L0 — Branch Overview (
gap_describe{overview: true}/__metaGraph)Agents start by inspecting a compact directory capped at <= 24 tokens per branch over MCP
POST /mcp(or inspect thespec/02-gap-ql.mdMetaGraphcontract):{ "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "gap_describe", "arguments": { "overview": true } } }# Spec 02 MetaGraph SDL contract: query { __metaGraph { generation groupCount tokensEstimate branches { id protocol trust status synopsis operationCount } } }- Returned summary:
shop (REST, T1, 4 ops)andnotes (MCP, T1, 1 op)—hundreds of upstream services fit comfortably in a few hundred tokens.
- Returned summary:
-
L1 — Authorized Hybrid Search (
gap_search/__search)Next, search top-k matching operations via hybrid BM25 + HNSW. GAP applies the caller's Cedar visibility bitset first (
INV-05), so forbidden operations never appear in candidate lists or token counts:{ "jsonrpc": "2.0", "id": 2, "method": "tools/call", "params": { "name": "gap_search", "arguments": { "query": "customer order notes", "limit": 5 } } }query { __search(query: "customer order notes", first: 5) { tokensEstimate abstained hits { score kind name path branch sdl } } } -
L2 — On-Demand Type Hydration (
gap_describe{types: [...]}/__type)Finally, hydrate only the composed types needed for the query (in Walking Skeleton, OpenAPI ingestion compiles
shop_CustomersResultandshop_OrdersResult):{ "jsonrpc": "2.0", "id": 3, "method": "tools/call", "params": { "name": "gap_describe", "arguments": { "types": ["shop_CustomersResult", "shop_OrdersResult"], "depth": 1 } } }query { __type(name: "shop_CustomersResult") { name fields { name type { name kind } } } }
Security Guarantee: Visibility Filtering Before Ranking (INV-05) & Scaling Curve
GAP Static 5-Tool (All N)
Visual bar comparison (min-width clamped for clarity on log-scale ratios).
| Scale N | Direct-MCP tools/list | GAP Static tools/list | Schema Token Reduction |
|---|---|---|---|
| N = 10 tools | 1,904 tokens | 651 tokens | 65.8% |
| N = 50 tools | 10,066 tokens | 651 tokens | 93.5% |
| N = 200 tools | 40,586 tokens | 651 tokens | 98.4% |
| N = 1,000 tools | 203,421 tokens | 651 tokens | 99.7% (312x) |