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

Progressive Discovery L0 to L2 Flow (Fixed 651-Token tools/list) 0. Static tools/list 5 static tools (651 tok) 1. L0: gap_describe overview: true (<=24 tok/branch) 2. L1: gap_search BM25 + Cedar Bitset (INV-05) 3. L2: gap_describe types: ["shop_CustomersResult"] 4. gap_query / gap_mutate Typed batched GraphQL execution
Progressive Discovery L0 to L2 Flow (Fixed 651-Token tools/list)
  1. 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 the spec/02-gap-ql.md MetaGraph contract):

    json MCP 2026-07-28 — L0 Overview Call
    {
      "jsonrpc": "2.0",
      "id": 1,
      "method": "tools/call",
      "params": {
        "name": "gap_describe",
        "arguments": { "overview": true }
      }
    }
    graphql GAP-QL Spec Reference (spec/02-gap-ql.md)
    # Spec 02 MetaGraph SDL contract:
    query { __metaGraph { generation groupCount tokensEstimate branches { id protocol trust status synopsis operationCount } } }
    • Returned summary: shop (REST, T1, 4 ops) and notes (MCP, T1, 1 op)—hundreds of upstream services fit comfortably in a few hundred tokens.
  2. 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:

    json MCP 2026-07-28 — L1 Authorized Search
    {
      "jsonrpc": "2.0",
      "id": 2,
      "method": "tools/call",
      "params": {
        "name": "gap_search",
        "arguments": { "query": "customer order notes", "limit": 5 }
      }
    }
    graphql GAP-QL SearchResult SDL (spec/02-gap-ql.md)
    query { __search(query: "customer order notes", first: 5) { tokensEstimate abstained hits { score kind name path branch sdl } } }
  3. 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_CustomersResult and shop_OrdersResult):

    json MCP 2026-07-28 — L2 Composed Type Lookup
    {
      "jsonrpc": "2.0",
      "id": 3,
      "method": "tools/call",
      "params": {
        "name": "gap_describe",
        "arguments": { "types": ["shop_CustomersResult", "shop_OrdersResult"], "depth": 1 }
      }
    }
    graphql GAP-QL Introspection Shape (spec/02-gap-ql.md)
    query { __type(name: "shop_CustomersResult") { name fields { name type { name kind } } } }

Security Guarantee: Visibility Filtering Before Ranking (INV-05) & Scaling Curve

MCP tools/list Prompt Tax by Catalog Scale (N = 10 to 1,000) Measured schema tokens sent to LLM before user prompt arrives (ADR-021)
GAP Static 5-Tool (All N) 651 tok (constant)
Direct-MCP (N = 10) 1,904 tok
Direct-MCP (N = 50) 10,066 tok
Direct-MCP (N = 200) 40,586 tok
Direct-MCP (N = 1,000) 203,421 tok (312x larger)

Visual bar comparison (min-width clamped for clarity on log-scale ratios).

MCP tools/list schema overhead comparison (N = 10 to 1,000)
Scale NDirect-MCP tools/listGAP Static tools/listSchema Token Reduction
N = 10 tools1,904 tokens651 tokens65.8%
N = 50 tools10,066 tokens651 tokens93.5%
N = 200 tools40,586 tokens651 tokens98.4%
N = 1,000 tools203,421 tokens651 tokens99.7% (312x)