Skip to main content
Glama

Query Graphql

query_graphql
Read-only

Run read-only GraphQL queries against Infrahub to traverse relationships, aggregate data, or read fields missing from typed tools; mutations must use mutate_graphql.

Instructions

Execute a read-only GraphQL query against Infrahub — use for reads only, never mutations.

Mutations are rejected at the AST level: use mutate_graphql instead (available when write mode is enabled). For simple attribute reads, prefer get_nodes / search_nodes — use GraphQL only when you need relationship traversal, aggregation, or fields not exposed by the typed tools.

To discover available kinds and their attributes, read the infrahub://schema resource. If your client does not support MCP resources, call the get_schema tool instead. For the full GraphQL SDL, read infrahub://graphql-schema.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesGraphQL query string. Only queries are allowed — use mutate_graphql for mutations.
branchNoBranch to execute the query against. Defaults to None (uses default branch).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.2.0
    • changedOutput schema / (root)
      Previous value: -{
      -  "additionalProperties": true,
      -  "type": "object"
      -}New value: +null
  2. First observedv1.1.5

TDQS

A4.3/5.0
Behavior4/5

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

Adds substantial behavioral context beyond the readOnlyHint annotation: mutations are rejected at the AST level, and mutate_graphql is availability-gated by write mode. However, it does not describe error behavior, query complexity/pagination limits, or auth/permission requirements.

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

Conciseness4/5

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

Well front-loaded: the read-only constraint leads, followed by the mutation routing, typed-tool preference, and schema-discovery paths. Slightly more content than a minimal tool needs, but each sentence carries routing or behavioral value.

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?

Complete enough to call correctly: read-only scope, mutation rejection, alternative tools, and two schema-discovery paths are all covered. It omits return-shape and error/pagination behavior, though the absence of an output schema slightly raises the expected burden.

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%, so the schema already documents both parameters, including that only queries are allowed and branch defaults to the default branch. The description adds no syntax or format guidance beyond the schema, which is the correct baseline.

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?

Specific verb+resource ('Execute a read-only GraphQL query against Infrahub') with an explicit scope constraint (reads only, never mutations). It clearly distinguishes itself from mutate_graphql and from the typed read tools (get_nodes/search_nodes).

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?

Explicit when-to-use: reads only, never mutations (use mutate_graphql instead). Also names alternatives and the condition that selects them: prefer get_nodes/search_nodes for simple attribute reads, use GraphQL only when relationship traversal, aggregation, or unexposed fields are needed.

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