Skip to main content
Glama
FabrWill

GraphQL MCP Server

by FabrWill

introspect

Retrieve GraphQL schema details to understand available queries, types, and fields before executing operations.

Instructions

Introspect the GraphQL schema, use this tool before doing a query to get the schema information if you do not have it available as a resource already.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
__ignore__NoThis does not do anything

Implementation Reference

  • src/index.ts:78-113 (registration)
    Registration of the "introspect" MCP tool using server.tool(), including input schema and inline handler function.
    server.tool(
      "introspect",
      "Introspect the GraphQL schema, use this tool before doing a query to get the schema information if you do not have it available as a resource already.",
      {
        // This is a workaround to help clients that can't handle an empty object as an argument
        // They will often send undefined instead of an empty object which is not allowed by the schema
        __ignore__: z
          .boolean()
          .default(false)
          .describe("This does not do anything"),
      },
      async () => {
        try {
          const schema = await introspectEndpoint(env.ENDPOINT, env.HEADERS);
    
          return {
            content: [
              {
                type: "text",
                text: schema,
              },
            ],
          };
        } catch (error) {
          return {
            isError: true,
            content: [
              {
                type: "text",
                text: `Failed to introspect schema: ${error}`,
              },
            ],
          };
        }
      }
    );
  • Inline handler function for the "introspect" tool that calls introspectEndpoint and returns the GraphQL schema as text content or error.
    async () => {
      try {
        const schema = await introspectEndpoint(env.ENDPOINT, env.HEADERS);
    
        return {
          content: [
            {
              type: "text",
              text: schema,
            },
          ],
        };
      } catch (error) {
        return {
          isError: true,
          content: [
            {
              type: "text",
              text: `Failed to introspect schema: ${error}`,
            },
          ],
        };
      }
    }
  • Input schema for the "introspect" tool using Zod (dummy __ignore__ boolean field to workaround client issues with empty objects).
    {
      // This is a workaround to help clients that can't handle an empty object as an argument
      // They will often send undefined instead of an empty object which is not allowed by the schema
      __ignore__: z
        .boolean()
        .default(false)
        .describe("This does not do anything"),
    },
  • Helper function 'introspectEndpoint' that performs GraphQL introspection query on the endpoint and returns the schema in SDL format.
    export async function introspectEndpoint(
    	endpoint: string,
    	headers?: Record<string, string>,
    ) {
    	const response = await fetch(endpoint, {
    		method: "POST",
    		headers: {
    			"Content-Type": "application/json",
    			...headers,
    		},
    		body: JSON.stringify({
    			query: getIntrospectionQuery(),
    		}),
    	});
    
    	if (!response.ok) {
    		throw new Error(`GraphQL request failed: ${response.statusText}`);
    	}
    
    	const responseJson = (await response.json()) as any;
    	// Transform to a schema object
    	const schema = buildClientSchema(responseJson.data);
    
    	// Print the schema SDL
    	return printSchema(schema);
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. While it mentions the tool's purpose and usage timing, it lacks details on behavioral traits such as whether this is a read-only operation, potential performance impacts, error conditions, or what the output format looks like (though there's no output schema). For a tool with zero annotation coverage, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded with essential information in a single, efficient sentence. It states the action ('Introspect the GraphQL schema'), the purpose ('to get the schema information'), and the usage context ('before doing a query... if you do not have it available'). Every word earns its place with zero waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (introspecting a GraphQL schema), no annotations, no output schema, and 100% schema coverage for a single trivial parameter, the description is minimally adequate. It covers the basic purpose and usage context but lacks details on behavioral aspects, output format, or error handling that would be helpful for an AI agent. A score of 3 reflects this being the minimum viable description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 1 parameter with 100% description coverage (the '__ignore__' parameter is documented as 'This does not do anything'). The tool description adds no parameter-specific information beyond what the schema provides. According to scoring rules, with high schema coverage (>80%), the baseline is 3 even with no param info in the description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Introspect the GraphQL schema' (verb+resource). It specifies this is to 'get the schema information' for use before querying. However, it doesn't explicitly differentiate from sibling tools like 'inspect' or 'query', which might have overlapping functionality in a GraphQL context.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context on when to use this tool: 'use this tool before doing a query to get the schema information if you do not have it available as a resource already.' This gives a specific scenario (pre-query when schema info is unavailable). However, it doesn't mention when NOT to use it or explicitly compare to alternatives like the 'inspect' sibling tool.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/FabrWill/gql-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server