Skip to content

[Enh]: add query_graphql DML tool to MCP server #3208

@JerryNixon

Description

@JerryNixon

What?

Allow agents to make complex queries that include join operations.

Why?

Join operations allow agents to retrieve related information across entities, enabling richer reasoning and discovery scenarios that single-entity queries cannot provide.

How?

Expose a single GraphQL MCP tool whose behavior is controlled by an enum parameter.

Example tool signature

{
  "name": "graphql",
  "description": "Execute GraphQL queries, mutations, or retrieve the schema.",
  "input_schema": {
    "type": "object",
    "properties": {
      "operation": {
        "type": "string",
        "enum": ["query", "mutation", "schema"],
        "description": "Type of GraphQL operation."
      },
      "query": {
        "type": "string",
        "description": "GraphQL query or mutation text. Not required when operation = schema."
      },
      "variables": {
        "type": "object",
        "description": "Optional GraphQL variables."
      }
    },
    "required": ["operation"]
  }
}

Behavior.

operation = query
Execute the provided GraphQL query.

operation = mutation
Execute the provided GraphQL mutation.

operation = schema
Return the GraphQL schema or a simplified schema description.

Example schema request

{
  "operation": "schema"
}

Example query request

{
  "operation": "query",
  "query": "query { products(first:5) { productId name category { name } } }"
}

Example mutation request

{
  "operation": "mutation",
  "query": "mutation { createProduct(item:{ name:\"Widget\" }) { productId name } }"
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions