Expose Cube semantic layer metrics to an AI agent using the Cube SQL API MEASURE() function

domain: cube.dev · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Enable the Cube SQL API in your cube.js or cube.yaml configuration and note the Postgres-compatible connection host and port provided by Cube Cloud or your self-hosted deployment
  2. Connect the AI agent or LLM tool to the SQL API endpoint using a standard Postgres wire-protocol client or driver
  3. Provide the AI agent with a schema description listing available cube names, measure names, and dimension names obtained from /v1/meta so it can construct valid queries
  4. Instruct the agent to write SELECT queries using the MEASURE(cube_name.measure_name) syntax alongside GROUP BY clauses for dimensions rather than writing raw aggregate SQL against source tables
  5. Every query routed through the SQL API passes through Cube's access policy enforcement and pre-aggregation matching, ensuring governed, cached metric results regardless of how the AI constructs the query

Known gotchas

Related routes

Configure AtScale as a universal semantic layer over Snowflake using the Open Semantic Interchange (OSI) standard to expose governed metrics to Power BI and AI agents
www.atscale.com · 5 steps · unrated
Model a Cube cube schema with measures, dimensions, and a rollup pre-aggregation to accelerate dashboard queries
cube.dev · 5 steps · unrated
Introspect a Cube data model and execute a query via the Cube REST API using the /v1/meta and /v1/load endpoints
cube.dev · 5 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans