{
  "schemaVersion": "agent9-managed-tool-package-v1",
  "name": "managed_auto_oncall_wetech",
  "version": 65,
  "description": "Wetech-backed read-only evidence Tool for ticket-bound OP Grafana PromQL and TiDB Dashboard TopSQL, Statements, and Slow Query. The isolated browser Tool reads and refreshes login state in a dedicated Drive9 workspace.",
  "parameters": {
    "type": "object",
    "additionalProperties": false,
    "required": [
      "accountAlias",
      "issueKey",
      "cluster",
      "region",
      "operation",
      "queryId",
      "start",
      "end"
    ],
    "properties": {
      "accountAlias": {
        "const": "Wetech"
      },
      "issueKey": {
        "type": "string",
        "pattern": "^APID-[0-9]+$"
      },
      "cluster": {
        "type": "string",
        "minLength": 1,
        "maxLength": 64
      },
      "region": {
        "enum": ["asia-prod", "middle-east-prod"]
      },
      "operation": { "enum": ["metrics_query_range", "topsql", "statements", "slow_query"] },
      "queryId": {
        "type": "string",
        "pattern": "^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$",
        "description": "Stable semantic objective ID. Reuse it only for a changed same-Turn correction of that failed objective."
      },
      "query": {
        "type": "string",
        "minLength": 1,
        "maxLength": 8192,
        "description": "PromQL authored by the Evidence Agent for the exact authorized cluster and window."
      },
      "name": { "type": "string", "minLength": 1, "maxLength": 128 },
      "unit": {
        "type": "string",
        "minLength": 1,
        "maxLength": 32,
        "description": "Short plain string label for the PromQL result, for example cores, seconds, bytes, ratio, or count."
      },
      "instance": { "type": "string", "minLength": 1, "maxLength": 256, "description": "Required for topsql: an available exact TiDB instance selector without surrounding whitespace. Omission is not cluster-wide mode. Never guess or use opaque entity references; instanceFromQueryId is not supported by this Managed Tool." },
      "limit": {
        "type": "integer", "minimum": 1, "maximum": 20,
        "description": "JSON integer from 1 through 20. TopSQL defaults to 5; Slow Query defaults to 20. Use more than 5 TopSQL entries only for a specific evidence objective; 100 is not supported."
      },
      "includeSqlText": {
        "type": "boolean",
        "description": "Dashboard result projection. Defaults to false for broad lists and true for Digest-selected Slow Query detail. Use true only for bounded target-SQL matching or a load-bearing candidate detail; workload/latency lists need only Digests and metrics."
      },
      "digest": {
        "type": "string", "pattern": "^[a-fA-F0-9]{6,64}$",
        "description": "A 6-64 character hexadecimal SQL Digest or prefix copied from suppliedQueryDigests or a prior Provider result. Prefixes are queryable; single-SQL matches include detailed plans. Opaque entity references are invalid."
      },
      "orderBy": { "type": "string", "minLength": 1, "maxLength": 64 },
      "desc": { "type": "boolean" },
      "start": {
        "type": "integer"
      },
      "end": {
        "type": "integer"
      },
      "step": {
        "type": "integer",
        "minimum": 15,
        "maximum": 300
      }
    }
  },
  "effect": "read",
  "entrypoint": "index.mjs",
  "secretEnv": [
    "WETECH_P81_USERNAME",
    "WETECH_P81_PASSWORD",
    "WETECH_P81_TOTP",
    "WETECH_GRAFANA_USERNAME",
    "WETECH_GRAFANA_PASSWORD_ASIA_PROD",
    "WETECH_GRAFANA_PASSWORD_DEFAULT",
    "WETECH_DASHBOARD_USERNAME",
    "WETECH_DASHBOARD_PASSWORD_ASIA_SAAS",
    "WETECH_DASHBOARD_PASSWORD_DEFAULT",
    "WETECH_DRIVE9_SERVER",
    "WETECH_DRIVE9_OWNER_KEY",
    "WETECH_EGRESS_PROXY_TOKEN"
  ],
  "timeoutMs": 120000,
  "maxOutputBytes": 65536,
  "network": {
    "mode": "restricted",
    "workspaceAdminMayAllowUnrestricted": true,
    "allowedHosts": [
      "oncall.ops-staging.pingcap.net",
      "cgxxx.perimeter81.com",
      "static.perimeter81.com",
      "api-ui.perimeter81.com",
      "webclient-mfes.perimeter81.com",
      "cdn.auth0.com",
      "p81-assets.perimeter81.com",
      "auth.perimeter81.com",
      "challenges.cloudflare.com",
      "ssl.gstatic.com",
      "api.drive9.ai",
      "aws-us-west-2.drive9.ai"
    ]
  },
  "egress": []
}
