slice_graphql_schema — Slice GraphQL SDL Schema to Minimal Subgraph

Parses GraphQL Schema Definition Language (`Query`, `Mutation`, `Subscription`, `type`, `input`, `interface`, `union`, `enum`, `scalar`), scores root fields against `query` or explicit `rootFields`, and emits a valid mini-SDL containing only selected root fields and the transitive closure of referenced types.

Why buy vs. DIY: Replaces heavyweight `graphql-js` AST bundlers on edge runtimes and shrinks 10,000-line federated GraphQL schemas into minimal, copy-pasteable mini-SDL + sample operations.

Pricing: $0.001 USD per GraphQL SDL subgraph slice (x402 instant micropayment) · REST: POST https://spec-slice.apikeg.com/v1/slice-graphql-schema · MCP: https://spec-slice.apikeg.com/mcp

Input Parameters

FieldTypeRequired / DefaultDescription & Constraints
sdl string Required Full GraphQL Schema Definition Language (SDL) string. (minLength: 1)
query string Optional Natural-language task intent scored against root Query, Mutation, and Subscription fields. (maxLength: 500)
rootFields array Optional Explicit root field names to extract (e.g. 'createCreditNote' or 'Mutation.refundInvoice'). (maxItems: 50)
operationTypes array Optional Optional filter restricting root operation containers. (maxItems: 3)
maxRootFields integer Default: 5 Maximum number of matched root fields to retain in the mini-SDL. (min: 1, max: 50)
compactDescriptions boolean Default: false Strip triple-quoted and single-line descriptions from the emitted mini-SDL.

REST Example (curl)

curl -X POST "https://spec-slice.apikeg.com/v1/slice-graphql-schema" \
  -H "Content-Type: application/json" \
  -d '{
  "query": "issue credit note for invoice",
  "maxRootFields": 2,
  "compactDescriptions": true,
  "sdl": "scalar DateTime\nenum CreditReason { DUPLICATE OVERCHARGE }\ninput IssueCreditNoteInput { invoiceId: ID! reason: CreditReason! }\ntype CreditNote { id: ID! issuedAt: DateTime! }\ntype Warehouse { id: ID! code: String! }\ntype Query { warehouses: [Warehouse!]! }\ntype Mutation { issueCreditNote(input: IssueCreditNoteInput!): CreditNote! }"
}'

MCP tools/call Payload

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "slice_graphql_schema",
    "arguments": {
      "query": "issue credit note for invoice",
      "maxRootFields": 2,
      "compactDescriptions": true,
      "sdl": "scalar DateTime\nenum CreditReason { DUPLICATE OVERCHARGE }\ninput IssueCreditNoteInput { invoiceId: ID! reason: CreditReason! }\ntype CreditNote { id: ID! issuedAt: DateTime! }\ntype Warehouse { id: ID! code: String! }\ntype Query { warehouses: [Warehouse!]! }\ntype Mutation { issueCreditNote(input: IssueCreditNoteInput!): CreditNote! }"
    }
  }
}