Skip to main content
Glama

run_graphql

Execute complex GraphQL queries with nested relations and custom filtering for Gadget apps when standard record queries are insufficient.

Instructions

Run an arbitrary read-only GraphQL query against the Gadget app. Use this for complex queries with nested relations or custom filtering that query_records can't express.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesGraphQL query string
variablesNoGraphQL variables

Implementation Reference

  • The handler implementation for the `run_graphql` tool, which executes an arbitrary GraphQL query if it is not a mutation.
    case "run_graphql": {
      const { query, variables } = args as { query: string; variables?: Record<string, unknown> };
      const trimmed = query.trim().toLowerCase();
      if (trimmed.startsWith("mutation")) {
        return {
          content: [{ type: "text", text: "Mutations are not allowed — this server is read-only." }],
          isError: true,
        };
      }
      const data = await gql(query, variables);
      return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
    }
  • The definition of the `run_graphql` tool, including its name, description, and input schema.
      name: "run_graphql",
      description:
        "Run an arbitrary read-only GraphQL query against the Gadget app. Use this for complex queries with nested relations or custom filtering that query_records can't express.",
      inputSchema: {
        type: "object",
        required: ["query"],
        properties: {
          query: { type: "string", description: "GraphQL query string" },
          variables: { type: "object", description: "GraphQL variables" },
        },
      },
    },
Behavior4/5

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

With no annotations provided, the description carries the safety disclosure burden and explicitly states 'read-only', which is critical behavioral context. However, it omits other behavioral details like return format, error handling, or pagination that would help an agent predict outcomes.

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?

Two well-structured sentences with zero waste. First sentence front-loads the core action and safety constraint; second sentence provides usage guidance. Every word earns its place.

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

Completeness4/5

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

Given the high flexibility of 'arbitrary GraphQL' and lack of output schema, the description adequately covers purpose, safety (read-only), and sibling differentiation. Minor gap in not describing the response structure, though this is somewhat implied by 'query' context.

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?

Schema description coverage is 100% ('GraphQL query string', 'GraphQL variables'), establishing baseline 3. The description adds semantic context that the query parameter handles 'complex queries with nested relations', but doesn't add syntax details or format specifications beyond the schema.

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

Purpose5/5

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

The description uses specific verb 'Run' with clear resource 'GraphQL query' against 'Gadget app', and explicitly distinguishes from sibling tool 'query_records' by stating this handles cases 'that query_records can't express'.

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

Usage Guidelines5/5

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

Explicitly states when to use: 'complex queries with nested relations or custom filtering' and implicitly when not to use by referencing the limitation of the alternative. Explicitly names sibling alternative 'query_records'.

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/Stronger-eCommerce/gadget-mcp'

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