BigQuery SQL — 18 Operations for AI Agents

BigQuery SQL is where analytics happens at warehouse scale — scheduled queries, dbt models, dashboard backends. act101 gives agents the query's shape up front, so they reason about CTEs and joins structurally instead of rereading a thousand-line SELECT.

This page is the canonical reference an AI coding agent uses to refactor, query, and analyze BigQuery SQL code through the act MCP server. 18 operations available: 0 refactor, 18 query, 0 analysis. Each operation is callable from Claude Code, Cursor, Codex, OpenCode, or any MCP-compatible agent host. Click any operation for a stable anchor link suitable for citation.

18Query

Worked BigQuery SQL examples

act101 reads a BigQuery SQL file's DDL statements — CREATE TABLE, CREATE FUNCTION, CREATE PROCEDURE, CREATE MODEL, CREATE SCHEMA, and their DROP/ALTER counterparts — as declarations, along with INSERT/UPDATE/DELETE/MERGE DML statements and each WITH-clause CTE, keeping BigQuery's dotted project.dataset.table names intact as a single identifier rather than splitting them at the dot. The skeleton also descends into a CREATE TABLE's column list, tagging each column property; symbols narrows the same file down to just the table, function, and CTE definitions and drops the columns. The unit of structure in this grammar is the top-level statement: symbols treats the table, function, and CTE the skeleton surfaced as a complete definition set, with no descent into a CTE's own SELECT body or a function's SQL expression. Each example below is the verbatim output of the command shown, run against the file shown. Query outputs are pretty-printed with the timing block omitted.

Read the pass-prediction schema and helper routine as a skeleton

ground-station-passes.bq defines the satellite_ops.ground_station_passes table with five columns, a satellite_ops.pass_duration_minutes helper function, and a high_elevation_passes CTE that aggregates passes above 45 degrees of elevation.

$ act query skeleton ground-station-passes.bq

Before

CREATE TABLE satellite_ops.ground_station_passes (
  satellite_id STRING,
  station_id STRING,
  aos_time TIMESTAMP,
  los_time TIMESTAMP,
  max_elevation_deg FLOAT64
);

CREATE FUNCTION satellite_ops.pass_duration_minutes(aos TIMESTAMP, los TIMESTAMP)
RETURNS FLOAT64
AS (
  TIMESTAMP_DIFF(los, aos, MINUTE)
);

WITH high_elevation_passes AS (
  SELECT satellite_id, station_id, max_elevation_deg
  FROM satellite_ops.ground_station_passes
  WHERE max_elevation_deg > 45
)
SELECT satellite_id, COUNT(*) AS pass_count
FROM high_elevation_passes
GROUP BY satellite_id;

Output

{
    "type": "Skeleton",
    "declarations": [
        {
            "kind": "class",
            "name": "satellite_ops.ground_station_passes",
            "range": {
                "start": {
                    "file": "ground-station-passes.bq",
                    "line": 1,
                    "column": 1,
                    "byte_offset": 0
                },
                "end": {
                    "file": "ground-station-passes.bq",
                    "line": 7,
                    "column": 2,
                    "byte_offset": 168
                }
            },
            "name_range": {
                "start": {
                    "file": "ground-station-passes.bq",
                    "line": 1,
                    "column": 14,
                    "byte_offset": 13
                },
                "end": {
                    "file": "ground-station-passes.bq",
                    "line": 1,
                    "column": 49,
                    "byte_offset": 48
                }
            }
        },
        {
            "kind": "property",
            "name": "satellite_id",
            "range": {
                "start": {
                    "file": "ground-station-passes.bq",
                    "line": 2,
                    "column": 3,
                    "byte_offset": 53
                },
                "end": {
                    "file": "ground-station-passes.bq",
                    "line": 2,
                    "column": 22,
                    "byte_offset": 72
                }
            },
            "name_range": {
                "start": {
                    "file": "ground-station-passes.bq",
                    "line": 2,
                    "column": 3,
                    "byte_offset": 53
                },
                "end": {
                    "file": "ground-station-passes.bq",
                    "line": 2,
                    "column": 15,
                    "byte_offset": 65
                }
            }
        },
        {
            "kind": "property",
            "name": "station_id",
            "range": {
                "start": {
                    "file": "ground-station-passes.bq",
                    "line": 3,
                    "column": 3,
                    "byte_offset": 76
                },
                "end": {
                    "file": "ground-station-passes.bq",
                    "line": 3,
                    "column": 20,
                    "byte_offset": 93
                }
            },
            "name_range": {
                "start": {
                    "file": "ground-station-passes.bq",
                    "line": 3,
                    "column": 3,
                    "byte_offset": 76
                },
                "end": {
                    "file": "ground-station-passes.bq",
                    "line": 3,
                    "column": 13,
                    "byte_offset": 86
                }
            }
        },
        {
            "kind": "property",
            "name": "aos_time",
            "range": {
                "start": {
                    "file": "ground-station-passes.bq",
                    "line": 4,
                    "column": 3,
                    "byte_offset": 97
                },
                "end": {
                    "file": "ground-station-passes.bq",
                    "line": 4,
                    "column": 21,
                    "byte_offset": 115
                }
            },
            "name_range": {
                "start": {
                    "file": "ground-station-passes.bq",
                    "line": 4,
                    "column": 3,
                    "byte_offset": 97
                },
                "end": {
                    "file": "ground-station-passes.bq",
                    "line": 4,
                    "column": 11,
                    "byte_offset": 105
                }
            }
        },
        {
            "kind": "property",
            "name": "los_time",
            "range": {
                "start": {
                    "file": "ground-station-passes.bq",
                    "line": 5,
                    "column": 3,
                    "byte_offset": 119
                },
                "end": {
                    "file": "ground-station-passes.bq",
                    "line": 5,
                    "column": 21,
                    "byte_offset": 137
                }
            },
            "name_range": {
                "start": {
                    "file": "ground-station-passes.bq",
                    "line": 5,
                    "column": 3,
                    "byte_offset": 119
                },
                "end": {
                    "file": "ground-station-passes.bq",
                    "line": 5,
                    "column": 11,
                    "byte_offset": 127
                }
            }
        },
        {
            "kind": "property",
            "name": "max_elevation_deg",
            "range": {
                "start": {
                    "file": "ground-station-passes.bq",
                    "line": 6,
                    "column": 3,
                    "byte_offset": 141
                },
                "end": {
                    "file": "ground-station-passes.bq",
                    "line": 6,
                    "column": 28,
                    "byte_offset": 166
                }
            },
            "name_range": {
                "start": {
                    "file": "ground-station-passes.bq",
                    "line": 6,
                    "column": 3,
                    "byte_offset": 141
                },
                "end": {
                    "file": "ground-station-passes.bq",
                    "line": 6,
                    "column": 20,
                    "byte_offset": 158
                }
            }
        },
        {
            "kind": "function",
            "name": "satellite_ops.pass_duration_minutes",
            "range": {
                "start": {
                    "file": "ground-station-passes.bq",
                    "line": 9,
                    "column": 1,
                    "byte_offset": 171
                },
                "end": {
                    "file": "ground-station-passes.bq",
                    "line": 13,
                    "column": 2,
                    "byte_offset": 310
                }
            },
            "name_range": {
                "start": {
                    "file": "ground-station-passes.bq",
                    "line": 9,
                    "column": 17,
                    "byte_offset": 187
                },
                "end": {
                    "file": "ground-station-passes.bq",
                    "line": 9,
                    "column": 52,
                    "byte_offset": 222
                }
            }
        },
        {
            "kind": "function",
            "name": "high_elevation_passes",
            "range": {
                "start": {
                    "file": "ground-station-passes.bq",
                    "line": 15,
                    "column": 6,
                    "byte_offset": 318
                },
                "end": {
                    "file": "ground-station-passes.bq",
                    "line": 19,
                    "column": 2,
                    "byte_offset": 473
                }
            },
            "name_range": {
                "start": {
                    "file": "ground-station-passes.bq",
                    "line": 15,
                    "column": 6,
                    "byte_offset": 318
                },
                "end": {
                    "file": "ground-station-passes.bq",
                    "line": 15,
                    "column": 27,
                    "byte_offset": 339
                }
            }
        }
    ]
}

The skeleton reports eight declarations: the table as class, its five columns — satellite_id, station_id, aos_time, los_time, max_elevation_deg — as property, pass_duration_minutes as function, and the high_elevation_passes CTE as function, with the dotted satellite_ops.ground_station_passes and satellite_ops.pass_duration_minutes names kept whole.

List the table, function, and CTE as symbols

The same file defines exactly one table, one function, and one CTE — no other statements.

$ act query symbols ground-station-passes.bq

Before

CREATE TABLE satellite_ops.ground_station_passes (
  satellite_id STRING,
  station_id STRING,
  aos_time TIMESTAMP,
  los_time TIMESTAMP,
  max_elevation_deg FLOAT64
);

CREATE FUNCTION satellite_ops.pass_duration_minutes(aos TIMESTAMP, los TIMESTAMP)
RETURNS FLOAT64
AS (
  TIMESTAMP_DIFF(los, aos, MINUTE)
);

WITH high_elevation_passes AS (
  SELECT satellite_id, station_id, max_elevation_deg
  FROM satellite_ops.ground_station_passes
  WHERE max_elevation_deg > 45
)
SELECT satellite_id, COUNT(*) AS pass_count
FROM high_elevation_passes
GROUP BY satellite_id;

Output

{
    "type": "Symbols",
    "symbols": [
        {
            "name": "satellite_ops.ground_station_passes",
            "kind": "class",
            "range": {
                "start": {
                    "file": "ground-station-passes.bq",
                    "line": 1,
                    "column": 14,
                    "byte_offset": 13
                },
                "end": {
                    "file": "ground-station-passes.bq",
                    "line": 1,
                    "column": 49,
                    "byte_offset": 48
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "satellite_ops.pass_duration_minutes",
            "kind": "function",
            "range": {
                "start": {
                    "file": "ground-station-passes.bq",
                    "line": 9,
                    "column": 17,
                    "byte_offset": 187
                },
                "end": {
                    "file": "ground-station-passes.bq",
                    "line": 9,
                    "column": 52,
                    "byte_offset": 222
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "high_elevation_passes",
            "kind": "function",
            "range": {
                "start": {
                    "file": "ground-station-passes.bq",
                    "line": 15,
                    "column": 6,
                    "byte_offset": 318
                },
                "end": {
                    "file": "ground-station-passes.bq",
                    "line": 15,
                    "column": 27,
                    "byte_offset": 339
                }
            },
            "visibility": "unknown"
        }
    ]
}

symbols reports exactly these three definitions — satellite_ops.ground_station_passes as class, satellite_ops.pass_duration_minutes as function, and high_elevation_passes as function — dropping the five column properties that skeleton listed.

Query

18 query tools, the same on every supported language. Descriptions live in the shared reference: /docs/query-tools.

callers control_flow data_flow definition diagnostics effect_closure effect_summary fix_auto get_type graph import_organize interface mutations references repo_outline skeleton symbols symbols_batch

← BicepBitBake →