MCPcopy Create free account
hub / github.com/cloudflare/mcp / runGraphql

Function runGraphql

tests/executor.test.ts:114–121  ·  view source on GitHub ↗
(body: unknown)

Source from the content-addressed store, hash-verified

112
113describe('execute: GraphQL responses', () => {
114 async function runGraphql(body: unknown): Promise<string> {
115 mockIdentityProbe({ accounts: [{ id: ACCOUNT_ID, name: 'Acc' }] })
116 server.use(http.post(`${API_BASE}/graphql`, () => HttpResponse.json(body as object)))
117 const result = await callTool(API_TOKEN, 'execute', {
118 code: `async () => cloudflare.request({ method: "POST", path: "/graphql", body: { query: "{ viewer { __typename } }" } })`
119 })
120 return toolText(result)
121 }
122
123 it('normalizes a successful GraphQL response (result = data.data)', async () => {
124 const text = await runGraphql({ data: { viewer: { __typename: 'Viewer' } } })

Callers 1

executor.test.tsFile · 0.85

Calls 4

mockIdentityProbeFunction · 0.90
callToolFunction · 0.90
toolTextFunction · 0.90
jsonMethod · 0.80

Tested by

no test coverage detected