{"id":47958,"library":"graphql-tools","title":"GraphQL Tools","description":"GraphQL Tools is a set of utility functions and classes for building and manipulating GraphQL schemas, creating executable schemas from type definitions, and stitching schemas together. Version 9.x is the current stable release with a moderate release cadence, supporting GraphQL.js ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0 and requiring Node >=16. It ships TypeScript types. Key differentiators: it provides a cohesive toolkit that complements graphql-js with features like schema stitching, mock generation, and operation transformation, widely used in the Apollo ecosystem.","status":"active","version":"9.0.28","language":"javascript","source_language":"en","source_url":"https://github.com/ardatan/graphql-tools","tags":["javascript","typescript"],"install":[{"cmd":"npm install graphql-tools","lang":"bash","label":"npm"},{"cmd":"yarn add graphql-tools","lang":"bash","label":"yarn"},{"cmd":"pnpm add graphql-tools","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency - required to work with GraphQL schemas","package":"graphql","optional":false}],"imports":[{"note":"In v7+, the function is exported from the @graphql-tools/schema subpackage, not from the main graphql-tools package.","wrong":"import { makeExecutableSchema } from 'graphql-tools'","symbol":"makeExecutableSchema","correct":"import { makeExecutableSchema } from '@graphql-tools/schema'"},{"note":"In v7+, stitching is in @graphql-tools/stitch subpackage.","wrong":"import { stitchSchemas } from 'graphql-tools'","symbol":"stitchSchemas","correct":"import { stitchSchemas } from '@graphql-tools/stitch'"},{"note":"GraphQLSchema is from graphql-js, not from graphql-tools.","wrong":"import { GraphQLSchema } from 'graphql-tools'","symbol":"GraphQLSchema","correct":"import { GraphQLSchema } from 'graphql'"},{"note":"The default export is deprecated in v7+; prefer named exports from subpackages.","wrong":"","symbol":"default","correct":"import graphqlTools from 'graphql-tools'"}],"quickstart":{"code":"import { makeExecutableSchema } from '@graphql-tools/schema';\nimport { addMocksToSchema } from '@graphql-tools/mock';\nimport { graphql } from 'graphql';\n\nconst typeDefs = `\ntype Query {\n  hello: String\n}\n`;\n\nconst resolvers = {\n  Query: {\n    hello: () => 'world',\n  },\n};\n\nconst schema = makeExecutableSchema({ typeDefs, resolvers });\n\nconst query = `{ hello }`;\ngraphql({ schema, source: query }).then((result) => {\n  console.log(result);\n});\n\nconst schemaWithMocks = addMocksToSchema({ schema });\ngraphql({ schema: schemaWithMocks, source: query }).then((result) => {\n  console.log(result);\n});","lang":"typescript","description":"Creates an executable schema from type definitions and resolvers, then adds mocks to the schema."},"warnings":[{"fix":"Use imports from specific subpackages like @graphql-tools/schema.","message":"In v7, the main graphql-tools package was split into multiple subpackages (e.g., @graphql-tools/schema, @graphql-tools/stitch). Old imports from 'graphql-tools' will break.","severity":"breaking","affected_versions":">=7.0.0 <8.0.0"},{"fix":"Use named imports from subpackages.","message":"The default export from 'graphql-tools' is deprecated and may be removed in future versions.","severity":"gotcha","affected_versions":">=7.0.0"},{"fix":"Replace mergeSchemas with stitchSchemas.","message":"The `mergeSchemas` function is deprecated; use `stitchSchemas` from @graphql-tools/stitch instead.","severity":"deprecated","affected_versions":">=8.0.0"},{"fix":"Ensure resolver keys match type names and field names exactly.","message":"When using `makeExecutableSchema`, the `resolvers` option must match the schema type names exactly; otherwise, no resolver is applied.","severity":"gotcha","affected_versions":">=9.0.0"},{"fix":"Use the `resolvers` option in addMocksToSchema to preserve some resolvers.","message":"The `addMocksToSchema` function does not preserve custom resolvers automatically. Mock resolvers override all fields.","severity":"gotcha","affected_versions":">=8.0.0"}],"env_vars":null,"search_vec":"'14.0.0':44 '15.0.0':45 '16':51 '16.0.0':46 '17.0.0':47 '9':30 'apollo':82 'build':14 'cadenc':41 'class':12 'cohes':61 'complement':64 'creat':19 'current':34 'definit':24 'differenti':57 'ecosystem':83 'execut':20 'featur':69 'function':10 'generat':74 'graphql':1,3,17,66 'graphql-j':65 'graphql.js':43 'javascript':84 'js':67 'key':56 'like':70 'manipul':16 'mock':73 'moder':39 'node':50 'oper':76 'provid':59 'releas':36,40 'requir':49 'schema':18,21,27,71 'set':7 'ship':53 'stabl':35 'stitch':26,72 'support':42 'togeth':28 'tool':2,4 'toolkit':62 'transform':77 'type':23,55 'typescript':54,85 'use':79 'util':9 'version':29 'wide':78 'x':31","created_at":"2026-06-07T16:54:12.282001+00:00","updated_at":"2026-06-07T16:54:12.282001+00:00","problems":[{"fix":"Install the required subpackage, e.g., `npm install @graphql-tools/schema`.","cause":"In v7+, the main package is deprecated; the package may not be installed if only subpackages are installed.","error":"Cannot find module 'graphql-tools'"},{"fix":"Change import to `import { makeExecutableSchema } from '@graphql-tools/schema'`.","cause":"Importing from the wrong path (e.g., 'graphql-tools' instead of '@graphql-tools/schema').","error":"TypeError: (0 , _schema.makeExecutableSchema) is not a function"},{"fix":"Check that all types referenced in the schema are defined and correctly spelled.","cause":"Type definition mismatch or missing type in the schema.","error":"Error: Unknown type \"XYZ\". Did you mean \"ABC\"?"},{"fix":"Ensure each type is defined only once unless using schema extension syntax.","cause":"Duplicate type definitions in the merged or stitched schemas.","error":"Error: Schema must contain uniquely named types but contains multiple types named \"Query\"."}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/ardatan/graphql-tools#readme","github":"https://github.com/ardatan/graphql-tools","docs":null,"changelog":null,"pypi":null,"npm":"graphql-tools","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops","testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}