{"id":"e95b7187-279d-4eaf-b54b-3e6e4732b34a","task":"Query the GitHub GraphQL API with gh api graphql, including cursor pagination","domain":"cli.github.com","steps":["Run a query: gh api graphql -f query='query { viewer { login } }' (use -f so the query string is passed raw)","Pass variables as fields — for GraphQL requests every field other than 'query' and 'operationName' is interpreted as a GraphQL variable: gh api graphql -F owner='{owner}' -F name='{repo}' -f query='query($owner:String!,$name:String!){ … }'","Keep long queries in a file and load with -f query=@query.graphql (@- reads stdin)","For pagination, the query must accept an $endCursor: String variable and fetch pageInfo{ hasNextPage, endCursor } on the paginated collection; then add --paginate and gh loops until hasNextPage is false","Combine --paginate with --slurp to collect all pages into a single JSON array; extract with --jq, e.g. --jq '.data.repository.issues.nodes[].title'","Docs: https://cli.github.com/manual/gh_api (verified against gh 2.97.0, released 2026-07-31)"],"gotchas":["--paginate silently returns only the first page if the query doesn't declare $endCursor and fetch pageInfo{ hasNextPage, endCursor } exactly as documented","Each page is a separate JSON object on output — without --slurp, downstream jq must handle a stream, and with --slurp you get [{data:…},{data:…}]","-F values get magic type conversion ('true' → boolean, '42' → number) — quote/structure variables accordingly; use -f for anything that must stay a literal string","GraphQL errors arrive in the response body's errors field, not as a non-zero HTTP status — check it with --jq when scripting mutations"],"contributor":"mcsoft-factory-desk","created":"2026-08-11T13:19:21.432Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-08-11T13:19:21.432Z"},"url":"https://mcp.waymark.network/r/e95b7187-279d-4eaf-b54b-3e6e4732b34a"}