Skip to main content
Glama

Compile GASP metrics into your engine's own format

compile_target
Read-onlyIdempotent

Compile the GASP Standard metrics your mapping covers into the files of your semantic-layer engine. Takes the same input as compile_model (a GASP adapter, or an Ossie mapping with your semantic_model), compiles the metrics the same way and writes them in the engine's own format and your warehouse's SQL: target 'snowflake' gives a Cortex Analyst semantic model YAML (tables with database.schema.table base tables, time dimensions, dimensions, facts, relationships and the gasp_ metrics; loadable as a semantic view) plus staged_views.sql, the views the staged metrics read and the period spine table, to run first; target 'cube' gives a Cube data model, one cube per table with its joins, a dimension per field and the metrics as measures, plus one view joining the cubes from revenue_event; target 'dbt' gives a dbt project fragment for the MetricFlow semantic layer under models/gasp/, a model per table (with gasp_surrogate_key, the key columns as text joined with '_', where a snapshot is keyed by entity and date, since MetricFlow keys on one column), the sources, a semantic model per table with its entities, dimensions and measures, plus the metrics as simple, ratio or derived over those measures. A filtered aggregate is written as a CASE inside the aggregate, which every warehouse runs. Each staged table's query is the compiled source in the target dialect. Entries with unmapped pairs or no computable formula are listed and left out. Pass metrics or department for a subset.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "adapter": "<adapter>",
      "target": "<target>"
    },
    "name": "compile_target"
  }
}

Input Schema

NameRequiredDescriptionDefault
outputNo'full' (default): the report followed by every file in a fenced block; 'files': the files alone, each under a ### <path> heading; 'report': the coverage and notes alone.
targetYesThe engine: 'snowflake' (Cortex Analyst semantic model YAML plus staged views SQL), 'cube' (Cube data-model directory) or 'dbt' (dbt MetricFlow models, semantic models and metrics).
adapterYesYour mapping as text: a GASP adapter (JSON; schema: https://gaspwiki.com/schemas/gasp-adapter-v1.json) or an Ossie mapping document (YAML or JSON). Check it with validate_mapping first.
dialectNoCube and dbt: the SQL dialect of the measures, models and staged queries (postgres, snowflake, bigquery or databricks). Omit to use the adapter's warehouse, else postgres. The snowflake target always writes Snowflake SQL.
metricsNoComma-separated metric names, abbreviations, aliases or formula ids to write (each resolved as in lookup_metric). Omit for every metric.
databaseNoSnowflake: the database prepended to schema.table sources, since a Cortex Analyst base table is database.schema.table. Cube does not need it.
departmentNoWrite every metric of one department (e.g. 'Core'); combines with metrics.
period_spineNoThe table of (period_start, period_end) rows the staged queries read, as named in your warehouse. Default gasp.period_spine.
staged_schemaNoSnowflake: the schema the staged views are created in. Default: the schema of the first mapped table.
semantic_modelNoWith an Ossie mapping: your semantic model document (YAML or JSON), whose sources and field expressions the files read.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.3/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations only declare the read-only/idempotent/closed-world profile; the description goes well beyond by disclosing exactly what each target emits (Cortex Analyst YAML plus staged_views.sql, Cube data model, dbt MetricFlow project under models/gasp/), the ordering requirement that staged views and the period spine table 'run first', the surrogate-key convention for snapshots, and the CASE-based filtered aggregate behavior. It also documents the failure mode — entries with unmapped pairs or no computable formula are listed and omitted — which is the kind of edge-case behavior an agent could not infer elsewhere.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The purpose and sibling contrast are front-loaded in the first sentence, and the target-by-target detail follows in a logical order. However, the target enumeration is delivered as one enormous run-on sentence with repeated 'plus ...' clauses, and some of it duplicates enum descriptions already in the schema.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 10-parameter, three-target compiler with no output schema and no destructive annotations, this covers the artifacts, ordering, filtering options and skip-behavior thoroughly. The only soft spot is the verb 'writes', which could be read as persisting files to disk even though the `output` parameter shows the result is returned as fenced text.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the enum values, defaults and per-parameter meanings are already documented in structured form, and the description mostly restates them (target outputs, dialect defaults, database/department subsetting). It does add the useful cross-parameter note that metrics and department combine, but that is also present in the schema. Baseline 3 applies when the schema carries the parameter semantics.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Compile the GASP Standard metrics ... into the files of your semantic-layer engine') and immediately contrasts scope with the sibling compile_model ('takes the same input ... compiles the metrics the same way and writes them in the engine's own format'). An agent can distinguish this from compile_model without opening either schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives a clear when-to-use signal (when you need engine-native output rather than the standard form compile_model produces) and a prerequisite ('Check it with validate_mapping first'), plus per-target guidance on which target yields which artifacts. It stops short of an explicit exclusion statement telling the agent when to call compile_model instead, leaving that to inference from the contrast.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.