{
  "id": "gcx",
  "name": "gcx",
  "homepage": "https://grafana.com/docs/grafana-cloud/ai-tools/gcx/",
  "description": "CLI for managing Grafana Cloud resources.",
  "executables": [
    "gcx"
  ],
  "dotfiles": {
    "paths": [
      "~/.config/gcx/config.yaml"
    ],
    "secret": [],
    "secret_paths": [
      {
        "file": "~/.config/gcx/config.yaml",
        "match": {
          "key_path": [
            "stacks.*.grafana.token",
            "stacks.*.grafana.password"
          ]
        }
      }
    ]
  },
  "commands": {
    "format": 1,
    "label": "Query Grafana Cloud",
    "description": "Run PromQL or LogQL queries against Grafana Cloud. Login, resource pull/push, alerts and other gcx areas are not covered.",
    "quality": "ai-draft",
    "parser": {
      "end_of_options": "--",
      "interleave": "permute",
      "long_equals": true,
      "short_attached": false,
      "short_bundles": false
    },
    "subcommand": [
      {
        "path": [
          "metrics",
          "query"
        ],
        "label": "Query metrics (PromQL)",
        "source": [
          {
            "id": "readme",
            "kind": "help",
            "url": "https://raw.githubusercontent.com/grafana/gcx/HEAD/README.md",
            "revision": "2026-10-27",
            "evidence": "$ gcx metrics query  'sum by (handler)(rate(grafana_http_request_duration_seconds_count{}[5m]))' --since 1h -o graph\ngcx metrics query 'rate(http_requests_total[5m])' --since 1h\ngcx logs query '{app=\"nginx\"} |= \"error\"' --since 1h\n"
          }
        ],
        "field": [
          {
            "id": "query",
            "label": "Query",
            "description": "PromQL expression, for example rate(http_requests_total[5m]).",
            "type": "string",
            "position": 0,
            "min": 1,
            "sources": [
              "readme"
            ]
          },
          {
            "id": "since",
            "label": "Time range",
            "description": "Look back this far, for example 1h.",
            "type": "string",
            "option": [
              "--since"
            ],
            "suggestions": [
              {
                "value": "1h",
                "label": "1 hour"
              }
            ],
            "sources": [
              "readme"
            ]
          },
          {
            "id": "output",
            "label": "Output format",
            "type": "string",
            "option": [
              "-o"
            ],
            "suggestions": [
              {
                "value": "graph",
                "label": "Graph"
              }
            ],
            "sources": [
              "readme"
            ]
          }
        ],
        "task": [
          {
            "id": "query",
            "label": "Run query",
            "fields": [
              "query",
              "since",
              "output"
            ],
            "required": [
              "query"
            ]
          }
        ],
        "group": [
          {
            "id": "basic",
            "label": "Basic",
            "fields": [
              "query",
              "since",
              "output"
            ]
          }
        ]
      },
      {
        "path": [
          "logs",
          "query"
        ],
        "label": "Query logs (LogQL)",
        "source": [
          {
            "id": "readme",
            "kind": "help",
            "url": "https://raw.githubusercontent.com/grafana/gcx/HEAD/README.md",
            "revision": "2026-10-27",
            "evidence": "$ gcx metrics query  'sum by (handler)(rate(grafana_http_request_duration_seconds_count{}[5m]))' --since 1h -o graph\ngcx metrics query 'rate(http_requests_total[5m])' --since 1h\ngcx logs query '{app=\"nginx\"} |= \"error\"' --since 1h\n"
          }
        ],
        "field": [
          {
            "id": "query",
            "label": "Query",
            "description": "LogQL expression, for example a stream selector plus a line filter.",
            "type": "string",
            "position": 0,
            "min": 1,
            "sources": [
              "readme"
            ]
          },
          {
            "id": "since",
            "label": "Time range",
            "description": "Look back this far, for example 1h.",
            "type": "string",
            "option": [
              "--since"
            ],
            "suggestions": [
              {
                "value": "1h",
                "label": "1 hour"
              }
            ],
            "sources": [
              "readme"
            ]
          },
          {
            "id": "output",
            "label": "Output format",
            "type": "string",
            "option": [
              "-o"
            ],
            "suggestions": [
              {
                "value": "graph",
                "label": "Graph"
              }
            ],
            "sources": [
              "readme"
            ]
          }
        ],
        "task": [
          {
            "id": "query",
            "label": "Run query",
            "fields": [
              "query",
              "since",
              "output"
            ],
            "required": [
              "query"
            ]
          }
        ],
        "group": [
          {
            "id": "basic",
            "label": "Basic",
            "fields": [
              "query",
              "since",
              "output"
            ]
          }
        ]
      }
    ]
  }
}
