{
  "title": "GraphQL Query Cost Estimator",
  "human_url": "https://happytails.ai/en/developer-tools/graphql-query-cost-estimator/",
  "agent_url": "https://happytails.ai/agents/en/developer-tools/graphql-query-cost-estimator/",
  "language": "en",
  "markdown_url": "https://happytails.ai/en/developer-tools/graphql-query-cost-estimator.md",
  "content": "GraphQL Query Cost Estimator\nEstimate how expensive a GraphQL operation is before it reaches your server. Find the deeply nested and multiplied list selections, with every list size assumption written down.\nHow to use GraphQL Query Cost Estimator\nPaste the GraphQL operation in the main box.\nPaste the schema as SDL or introspection JSON.\nAdjust the default list size, slicing arguments and field costs if your server uses other values.\nRun the estimate and review the hotspots, then download the JSON or CSV breakdown.\nHow can we improve this tool?\nReport a problem or share an idea.\nPlease leave out private information. Your message and the tool name go to our team via PostHog.\nUseful next steps\nGraphQL Query Validator\nGraphQL Schema Explorer\nAPI pagination merger\nAccepts an operation of up to 200,000 characters, a schema of up to 1,000,000 characters and variables of up to 200,000 characters. It counts at most 10,000 fields and 64 nesting levels, list sizes from 1 to 10,000 and field costs from 0 to 1,000. The estimate runs in your browser in a background worker. Downloads are a JSON report and a CSV breakdown.\nThe cost model\nEach selected field has the object or scalar cost for its return type, multiplied by the list sizes above it. The total is the sum over expanded field selections; repeated selections can therefore overestimate merged server execution. __typename is free. This planning model does not execute a server, conditional directives or nested list contents, and is not a server-enforced limit.\nList sizes\nA list field takes its size from the largest slicing argument, such as first, last or limit. Operation variable defaults and schema argument defaults are used when a value is omitted. Without a slicing value it uses @listSize(assumedSize:) when enabled, then the model default list size. @cost(weight:) replaces a field cost. All derived sizes must be whole numbers from 1 to 10,000, and weights from 0 to 1,000. Invalid operations, variables, bounds and cyclic fragments stop the estimate with a typed error.\nReading the report\nThe report lists assumptions, the ten most expensive subtrees and the full tree with depth, multiplier, list size, own cost and subtree cost. The CSV has one row per field path. Fragment spreads expand where used; a cyclic fragment is a query validation error rather than a finite cost assumption.",
  "content_format": "text/plain",
  "visibility": "public",
  "links": [
    {
      "name": "GraphQL Query Validator",
      "url": "https://happytails.ai/en/developer-tools/graphql-query-validator/"
    },
    {
      "name": "GraphQL Schema Explorer",
      "url": "https://happytails.ai/en/developer-tools/graphql-schema-explorer/"
    },
    {
      "name": "API pagination merger",
      "url": "https://happytails.ai/en/developer-tools/api-pagination-merger/"
    }
  ],
  "tool": {
    "id": "graphql-query-cost-estimator",
    "category": "developer-tools",
    "built": true,
    "requirements": "Accepts an operation of up to 200,000 characters, a schema of up to 1,000,000 characters and variables of up to 200,000 characters. It counts at most 10,000 fields and 64 nesting levels, list sizes from 1 to 10,000 and field costs from 0 to 1,000. The estimate runs in your browser in a background worker. Downloads are a JSON report and a CSV breakdown.",
    "implementation": {
      "fields": [
        {
          "key": "schema",
          "label": "Schema",
          "value": "",
          "type": "textarea",
          "maxLength": 1000000,
          "help": "GraphQL SDL, or introspection JSON with a __schema object. @cost and @listSize directives in SDL are read when enabled below."
        },
        {
          "key": "variables",
          "label": "Variables, optional",
          "value": "",
          "type": "textarea",
          "maxLength": 200000,
          "help": "A JSON object. Whole number variables used as slicing arguments set list sizes."
        },
        {
          "key": "operationName",
          "label": "Operation name, optional",
          "value": "",
          "type": "text",
          "maxLength": 200,
          "help": "Needed when the document has more than one operation."
        },
        {
          "key": "defaultListSize",
          "label": "Default list size",
          "value": "10",
          "type": "text",
          "inputMode": "numeric",
          "maxLength": 5,
          "help": "Whole number from 1 to 10000, used for list fields without a slicing argument or @listSize."
        },
        {
          "key": "slicingArguments",
          "label": "Slicing arguments",
          "value": "first,last,limit",
          "type": "text",
          "maxLength": 500,
          "help": "Comma separated argument names whose value sets a list size. The largest given value is used."
        },
        {
          "key": "objectCost",
          "label": "Cost per object field",
          "value": "1",
          "type": "text",
          "inputMode": "decimal",
          "maxLength": 10,
          "help": "Number from 0 to 1000 for fields that return an object, interface or union."
        },
        {
          "key": "scalarCost",
          "label": "Cost per scalar field",
          "value": "0",
          "type": "text",
          "inputMode": "decimal",
          "maxLength": 10,
          "help": "Number from 0 to 1000 for fields that return a scalar or enum."
        },
        {
          "key": "useDirectives",
          "label": "Use @cost and @listSize from the schema",
          "value": true,
          "type": "checkbox"
        }
      ],
      "registrationFamily": "api-contracts-schemas",
      "codeDirection": "ltr",
      "inputMaxLength": 200000,
      "inputErrorCode": "API_CONTRACTS_SCHEMAS_TOO_LONG_GRAPHQL_QUERY_COST_ESTIMATOR",
      "note": "Runs in your browser in a background worker. Accepts an operation of up to 200000 characters and counts at most 10000 fields.",
      "experience": {
        "automatic": false,
        "single": false,
        "inputMaxLength": 200000,
        "inputMode": "text",
        "label": "GraphQL operation",
        "placeholder": "query { books(first: 20) { title } }",
        "help": "One operation, or several with the operation name set. Fragments are expanded. Up to 200,000 characters. Review the settings before running.",
        "helpParts": [
          "One operation, or several with the operation name set. Fragments are expanded.",
          "Up to 200,000 characters.",
          "Review the settings before running."
        ],
        "action": null
      },
      "mode": "explicit",
      "interactive": false
    },
    "execution": "Browser interface",
    "api": null,
    "browser_agent": {
      "supported": true,
      "name": "run_current_tool",
      "discovery": "WebMCP on the human page in a supporting browser",
      "verification": "See audit/API-AUDIT.md; availability is not verification"
    }
  },
  "markdown": "# GraphQL Query Cost Estimator\n\n- Human page: https://happytails.ai/en/developer-tools/graphql-query-cost-estimator/\n- Markdown: https://happytails.ai/en/developer-tools/graphql-query-cost-estimator.md\n- Structured JSON: https://happytails.ai/agents/en/developer-tools/graphql-query-cost-estimator/index.json\n- Visibility: public\n\n## Tool capabilities\n\n| Property | Value |\n| --- | --- |\n| Tool ID | `graphql-query-cost-estimator` |\n| Category | developer-tools |\n| Implementation | Registered implementation. Registration alone is not a production-quality guarantee. |\n| Browser execution | Use the visible action or interactive controls. |\n| Browser processing | Browser; see tool notes for network behavior. |\n| HTTP API | Not callable through HTTP. |\n| Browser-agent interface | run_current_tool |\n\n### Implementation notes\n\nRuns in your browser in a background worker. Accepts an operation of up to 200000 characters and counts at most 10000 fields.\n\n### Inputs and settings\n\nText input: GraphQL operation.\n\nExample or placeholder shown in the interface (not a validated fixture):\n\n```text\nquery { books(first: 20) { title } }\n```\n\nOne operation, or several with the operation name set. Fragments are expanded. Up to 200,000 characters. Review the settings before running.\n\n| Setting | Meaning | Control type | Default | Constraints |\n| --- | --- | --- | --- | --- |\n| `schema` | Schema | textarea | \"\" |  |\n| `variables` | Variables, optional | textarea | \"\" |  |\n| `operationName` | Operation name, optional | text | \"\" |  |\n| `defaultListSize` | Default list size | text | \"10\" |  |\n| `slicingArguments` | Slicing arguments | text | \"first,last,limit\" |  |\n| `objectCost` | Cost per object field | text | \"1\" |  |\n| `scalarCost` | Cost per scalar field | text | \"0\" |  |\n| `useDirectives` | Use @cost and @listSize from the schema | checkbox | true |  |\n\n### Browser-agent workflow\n\n1. Open the human page in a browser that supports WebMCP.\n2. Discover the interface exposed by that page; use its actual schema.\n3. Select files on the page first when the tool requires files.\n4. Call `run_current_tool` with valid input and settings.\n5. Inspect the returned result or error and the displayed output. Retrieve files from the displayed download links.\n\nCalls do not automatically copy or download results. Browser permissions still apply. Interface availability alone is not proof of successful execution.\n\n### Planning specification\n\nAccepts an operation of up to 200,000 characters, a schema of up to 1,000,000 characters and variables of up to 200,000 characters. It counts at most 10,000 fields and 64 nesting levels, list sizes from 1 to 10,000 and field costs from 0 to 1,000. The estimate runs in your browser in a background worker. Downloads are a JSON report and a CSV breakdown.\n\nThis describes intended requirements. Use the implementation notes, interface schema and observed output to determine current support.\n\n### Complete machine-readable capability record\n\n```json\n{\n  \"id\": \"graphql-query-cost-estimator\",\n  \"category\": \"developer-tools\",\n  \"built\": true,\n  \"requirements\": \"Accepts an operation of up to 200,000 characters, a schema of up to 1,000,000 characters and variables of up to 200,000 characters. It counts at most 10,000 fields and 64 nesting levels, list sizes from 1 to 10,000 and field costs from 0 to 1,000. The estimate runs in your browser in a background worker. Downloads are a JSON report and a CSV breakdown.\",\n  \"implementation\": {\n    \"fields\": [\n      {\n        \"key\": \"schema\",\n        \"label\": \"Schema\",\n        \"value\": \"\",\n        \"type\": \"textarea\",\n        \"maxLength\": 1000000,\n        \"help\": \"GraphQL SDL, or introspection JSON with a __schema object. @cost and @listSize directives in SDL are read when enabled below.\"\n      },\n      {\n        \"key\": \"variables\",\n        \"label\": \"Variables, optional\",\n        \"value\": \"\",\n        \"type\": \"textarea\",\n        \"maxLength\": 200000,\n        \"help\": \"A JSON object. Whole number variables used as slicing arguments set list sizes.\"\n      },\n      {\n        \"key\": \"operationName\",\n        \"label\": \"Operation name, optional\",\n        \"value\": \"\",\n        \"type\": \"text\",\n        \"maxLength\": 200,\n        \"help\": \"Needed when the document has more than one operation.\"\n      },\n      {\n        \"key\": \"defaultListSize\",\n        \"label\": \"Default list size\",\n        \"value\": \"10\",\n        \"type\": \"text\",\n        \"inputMode\": \"numeric\",\n        \"maxLength\": 5,\n        \"help\": \"Whole number from 1 to 10000, used for list fields without a slicing argument or @listSize.\"\n      },\n      {\n        \"key\": \"slicingArguments\",\n        \"label\": \"Slicing arguments\",\n        \"value\": \"first,last,limit\",\n        \"type\": \"text\",\n        \"maxLength\": 500,\n        \"help\": \"Comma separated argument names whose value sets a list size. The largest given value is used.\"\n      },\n      {\n        \"key\": \"objectCost\",\n        \"label\": \"Cost per object field\",\n        \"value\": \"1\",\n        \"type\": \"text\",\n        \"inputMode\": \"decimal\",\n        \"maxLength\": 10,\n        \"help\": \"Number from 0 to 1000 for fields that return an object, interface or union.\"\n      },\n      {\n        \"key\": \"scalarCost\",\n        \"label\": \"Cost per scalar field\",\n        \"value\": \"0\",\n        \"type\": \"text\",\n        \"inputMode\": \"decimal\",\n        \"maxLength\": 10,\n        \"help\": \"Number from 0 to 1000 for fields that return a scalar or enum.\"\n      },\n      {\n        \"key\": \"useDirectives\",\n        \"label\": \"Use @cost and @listSize from the schema\",\n        \"value\": true,\n        \"type\": \"checkbox\"\n      }\n    ],\n    \"registrationFamily\": \"api-contracts-schemas\",\n    \"codeDirection\": \"ltr\",\n    \"inputMaxLength\": 200000,\n    \"inputErrorCode\": \"API_CONTRACTS_SCHEMAS_TOO_LONG_GRAPHQL_QUERY_COST_ESTIMATOR\",\n    \"note\": \"Runs in your browser in a background worker. Accepts an operation of up to 200000 characters and counts at most 10000 fields.\",\n    \"experience\": {\n      \"automatic\": false,\n      \"single\": false,\n      \"inputMaxLength\": 200000,\n      \"inputMode\": \"text\",\n      \"label\": \"GraphQL operation\",\n      \"placeholder\": \"query { books(first: 20) { title } }\",\n      \"help\": \"One operation, or several with the operation name set. Fragments are expanded. Up to 200,000 characters. Review the settings before running.\",\n      \"helpParts\": [\n        \"One operation, or several with the operation name set. Fragments are expanded.\",\n        \"Up to 200,000 characters.\",\n        \"Review the settings before running.\"\n      ],\n      \"action\": null\n    },\n    \"mode\": \"explicit\",\n    \"interactive\": false\n  },\n  \"execution\": \"Browser interface\",\n  \"api\": null,\n  \"browser_agent\": {\n    \"supported\": true,\n    \"name\": \"run_current_tool\",\n    \"discovery\": \"WebMCP on the human page in a supporting browser\",\n    \"verification\": \"See audit/API-AUDIT.md; availability is not verification\"\n  }\n}\n```\n\n## Page guide\n\nEstimate how expensive a GraphQL operation is before it reaches your server. Find the deeply nested and multiplied list selections, with every list size assumption written down.\n\n### How to use GraphQL Query Cost Estimator\n\n1. Paste the GraphQL operation in the main box.\n2. Paste the schema as SDL or introspection JSON.\n3. Adjust the default list size, slicing arguments and field costs if your server uses other values.\n4. Run the estimate and review the hotspots, then download the JSON or CSV breakdown.\n\nHow can we improve this tool?\n\nReport a problem or share an idea.\n\nPlease leave out private information. Your message and the tool name go to our team via PostHog.\n\n## Useful next steps\n\n- [GraphQL Query Validator](https://happytails.ai/en/developer-tools/graphql-query-validator/) ([Markdown](https://happytails.ai/en/developer-tools/graphql-query-validator.md))\n\n- [GraphQL Schema Explorer](https://happytails.ai/en/developer-tools/graphql-schema-explorer/) ([Markdown](https://happytails.ai/en/developer-tools/graphql-schema-explorer.md))\n\n- [API pagination merger](https://happytails.ai/en/developer-tools/api-pagination-merger/) ([Markdown](https://happytails.ai/en/developer-tools/api-pagination-merger.md))\n\nAccepts an operation of up to 200,000 characters, a schema of up to 1,000,000 characters and variables of up to 200,000 characters. It counts at most 10,000 fields and 64 nesting levels, list sizes from 1 to 10,000 and field costs from 0 to 1,000. The estimate runs in your browser in a background worker. Downloads are a JSON report and a CSV breakdown.\n\n## The cost model\n\nEach selected field has the object or scalar cost for its return type, multiplied by the list sizes above it. The total is the sum over expanded field selections; repeated selections can therefore overestimate merged server execution. \\_\\_typename is free. This planning model does not execute a server, conditional directives or nested list contents, and is not a server-enforced limit.\n\n### List sizes\n\nA list field takes its size from the largest slicing argument, such as first, last or limit. Operation variable defaults and schema argument defaults are used when a value is omitted. Without a slicing value it uses @listSize(assumedSize:) when enabled, then the model default list size. @cost(weight:) replaces a field cost. All derived sizes must be whole numbers from 1 to 10,000, and weights from 0 to 1,000. Invalid operations, variables, bounds and cyclic fragments stop the estimate with a typed error.\n\n### Reading the report\n\nThe report lists assumptions, the ten most expensive subtrees and the full tree with depth, multiplier, list size, own cost and subtree cost. The CSV has one row per field path. Fragment spreads expand where used; a cyclic fragment is a query validation error rather than a finite cost assumption.\n"
}