Skip to content

Configure env

The conversational onboarding entry point. Every metric tool, when no env is configured, returns a structured not_configured response that names this tool. The agent gathers backend details from you, calls configure_env, the tool validates the backend is reachable + authenticated + carries 10x engine metrics with the expected labels, and on success persists the entry to ~/.log10x/envs.json. Validator failures don't persist — you get the diagnostic and re-run after fixing.

Example

You

set me up against Grafana Cloud, key in env var

Log10x

Validating endpoint https://prometheus-prod-13-prod-us-east-0.grafana.net

  • Reachable: yes (142ms)
  • Auth: OK (MetricsReader scope present)
  • 10x metrics: all_events_summaryBytes_total found, labelled by k8s_container, symbolMessage

Persisted to ~/.log10x/envs.json as grafana-prod (default).

More to ask

  • "add a staging env against our self-hosted Prometheus"
  • "set up Datadog Prometheus, paste my API+APP keys"
  • "add a Log10x cloud env, API key in LX_KEY"

Prerequisites

Backend credentials for one of the supported types: log10x, prometheus, mimir, cortex, amp, datadog, grafana_cloud_prom, gcp_managed_prom.

Schema and samples

Input example

Real call against the demo env (captured by scripts/capture-tool-envelopes.mjs).

{
  "nickname": "doc-capture-dry-run",
  "metricsBackend": {
    "kind": "log10x",
    "apiKey": "4d985100-ee4a-4b6c-b784-a416b8684868",
    "envId": "6aa99191-f827-4579-a96a-c0ebdfe73884"
  },
  "validateOnly": true,
  "view": "summary"
}
Input schema

Agent-facing JSON Schema (the canonical shape the MCP server publishes via tools/list):

{
  "type": "object",
  "properties": {
    "nickname": {
      "type": "string",
      "minLength": 1,
      "description": "Short human-readable name for this env (e.g., `acme-prod`, `acme-staging`). Must be unique across configured envs."
    },
    "metricsBackend": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "log10x"
            },
            "apiKey": {
              "type": "string"
            },
            "envId": {
              "type": "string"
            }
          },
          "required": [
            "kind",
            "apiKey",
            "envId"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "prometheus"
            },
            "url": {
              "type": "string"
            },
            "auth": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "none"
                    }
                  },
                  "required": [
                    "type"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "bearer"
                    },
                    "token": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "token"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "basic"
                    },
                    "user": {
                      "type": "string"
                    },
                    "password": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "user",
                    "password"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "header"
                    },
                    "name": {
                      "type": "string"
                    },
                    "value": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "name",
                    "value"
                  ],
                  "additionalProperties": false
                }
              ]
            }
          },
          "required": [
            "kind",
            "url",
            "auth"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "mimir"
            },
            "url": {
              "type": "string"
            },
            "auth": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "none"
                    }
                  },
                  "required": [
                    "type"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "bearer"
                    },
                    "token": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "token"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "basic"
                    },
                    "user": {
                      "type": "string"
                    },
                    "password": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "user",
                    "password"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "header"
                    },
                    "name": {
                      "type": "string"
                    },
                    "value": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "name",
                    "value"
                  ],
                  "additionalProperties": false
                }
              ]
            },
            "orgId": {
              "type": "string"
            }
          },
          "required": [
            "kind",
            "url",
            "auth"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "cortex"
            },
            "url": {
              "type": "string"
            },
            "auth": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "none"
                    }
                  },
                  "required": [
                    "type"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "bearer"
                    },
                    "token": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "token"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "basic"
                    },
                    "user": {
                      "type": "string"
                    },
                    "password": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "user",
                    "password"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "header"
                    },
                    "name": {
                      "type": "string"
                    },
                    "value": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "name",
                    "value"
                  ],
                  "additionalProperties": false
                }
              ]
            },
            "orgId": {
              "type": "string"
            }
          },
          "required": [
            "kind",
            "url",
            "auth",
            "orgId"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "amp"
            },
            "url": {
              "type": "string"
            },
            "region": {
              "type": "string"
            }
          },
          "required": [
            "kind",
            "url",
            "region"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "datadog"
            },
            "site": {
              "type": "string"
            },
            "apiKey": {
              "type": "string"
            },
            "appKey": {
              "type": "string"
            }
          },
          "required": [
            "kind",
            "site",
            "apiKey",
            "appKey"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "grafana_cloud_prom"
            },
            "url": {
              "type": "string"
            },
            "user": {
              "type": "string"
            },
            "apiKey": {
              "type": "string"
            }
          },
          "required": [
            "kind",
            "url",
            "user",
            "apiKey"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "gcp_managed_prom"
            },
            "url": {
              "type": "string"
            },
            "projectId": {
              "type": "string"
            }
          },
          "required": [
            "kind",
            "url",
            "projectId"
          ],
          "additionalProperties": false
        }
      ],
      "description": "The metrics backend this env queries. Discriminated by `kind`. The 10x engine in the customer's pipeline must be writing to this same store via its metric output module. Credential fields accept either literal values OR `${VAR_NAME}` references resolved from the environment at load time."
    },
    "labels": {
      "type": "object",
      "properties": {
        "pattern": {
          "type": "string"
        },
        "service": {
          "type": "string"
        },
        "severity": {
          "type": "string"
        },
        "env": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "description": "Optional per-env label name overrides. Defaults to the engine's standard names. Set when the customer's engine `metricFieldNames` config renames `tenx_user_service` to `service`, `message_pattern` to `pattern_hash`, etc."
    },
    "isDefault": {
      "type": "boolean",
      "description": "Mark this env as the user's default. At most one env in the file should have this set."
    },
    "validateOnly": {
      "type": "boolean",
      "description": "When true, run validation and return the result but DO NOT write the env to `~/.log10x/envs.json`. Useful for dry-run checks during conversational onboarding."
    }
  },
  "required": [
    "nickname",
    "metricsBackend"
  ],
  "additionalProperties": false
}

Source: src/tools/configure-env.ts.

Output example

Real envelope from the demo env. view: "summary" returns the full StructuredOutput with typed data. Long arrays + base64 PNG bodies trimmed for readability; the real call returns them in full.

Headline (the 1-line agent-facing answer):

Configure env refused: Field log10x.apiKey appears to hold a literal credential. Move the value into an environment variable and reference it as ${VAR\_NAME} in your config. This prevents secrets from leaking into committed dotfiles or backups..

{
  "schema_version": "1.0",
  "schema_epoch": "2026-05-25",
  "tool": "log10x_configure_env",
  "generated_at": "2026-05-26T15:38:42.095Z",
  "view": "summary",
  "summary": {
    "headline": "Configure env refused: Field log10x.apiKey appears to hold a literal credential. Move the value into an environment variable and reference it as `${VAR_NAME}` in your config. This prevents secrets from leaking into committed dotfiles or backups.."
  },
  "data": {
    "ok": false,
    "nickname": "doc-capture-dry-run",
    "error": "Field log10x.apiKey appears to hold a literal credential. Move the value into an environment variable and reference it as `${VAR_NAME}` in your config. This prevents secrets from leaking into committed dotfiles or backups."
  },
  "actions": [],
  "truncated": false,
  "warnings": [
    "Demo mode — account-scoped tools query the read-only Log10x demo env. Call log10x_login_status to use your own data."
  ]
}
Output schema

The data block inside the StructuredOutput envelope:

interface ToolData {
  ok: boolean;
  nickname: string;
  error: string;
}

Envelope-level fields the agent should also read: summary.headline (1-line answer), actions[] (next-call chain hints as {tool, args, reason}), truncated: boolean, images[] (PNG attachments where applicable), schema_epoch (engine-ID stability boundary).