Skip to main content
Glama

query_graphql

Read-only

Fetch infrastructure data from Infrahub using read-only GraphQL queries. Supports relationship traversal and aggregation for complex data retrieval.

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).

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior4/5

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

Annotations already declare readOnlyHint=true. The description adds that mutations are rejected at the AST level, which provides concrete behavioral context. However, it does not detail other potential behaviors like rate limits or caching, but for a read-only tool this is sufficient.

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 concise and well-structured: it states the purpose first, then provides usage guidelines, and ends with schema discovery references. Every sentence adds value with no redundancy.

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

Completeness5/5

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

The description covers purpose, when to use, alternatives, schema discovery, and the behavioral constraint (AST-level rejection of mutations). Given that an output schema exists, the tool definition is complete for an agent to select and invoke correctly.

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% (both parameters have descriptions). The description repeats that the `query` parameter is for GraphQL queries only and that `branch` defaults to None (uses default branch). It adds no new information beyond the schema, so baseline 3 is appropriate.

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 clearly states the tool's purpose: 'Execute a read-only GraphQL query against Infrahub — use for reads only, never mutations.' It specifies the verb and resource ('execute a GraphQL query') and distinguishes from mutations, including naming the sibling tool `mutate_graphql` for mutation use.

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?

The description provides explicit guidance on when to use this tool vs alternatives: '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.' It also explains that mutations are rejected and directs to `mutate_graphql` for mutations.

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/opsmill/infrahub-mcp'

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