Skip to main content
Glama
semlayer MCP server

semlayer MCP server

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault

No arguments

Instructions

Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.

semlayer models a data warehouse into a semantic layer and serves it to you. CALL status BEFORE YOU ANSWER ANY QUESTION ABOUT THE USER'S DATA. It is one call, it is instant, and it is the only thing that knows whether a layer is loaded -- do not conclude from these instructions that there is none. This server is most often started WITH a layer, and status says so: state is ready and layer names it. Telling a user you have no data, without having called status, is the one failure that wastes everything the layer was built for. If status reports a layer, go straight to context_for_question. Only if it reports none does the rest of this paragraph apply: a semantic layer has to be BUILT from a warehouse, and until it is there is nothing to search or query. status then tells you which warehouse connections were found on this machine, which layers were found already built, and how to start inference -- every other tool answers with that same object when no layer is loaded, so read next and act on it rather than retrying. Never ask the user for a password or a key in chat. Credentials live in their environment, their .env file, their dbt profile, or their warehouse's connections file; you only ever pass names or URIs. Redshift, Supabase, Neon, and anything speaking the Postgres protocol use the postgres connection. If the user names a warehouse that is not listed as supported, say so plainly, pass the name to discover_connections as requested, and offer the nearest route it returns. infer builds the layer: it reads their warehouse, takes minutes on a real one, and spends their own LLM budget, so ASK THEM FIRST and say which warehouse you are about to model. Pass their question to it; when the layer is ready, status reminds you to answer it. Once a layer is loaded, start every question with context_for_question, apply required filters, never use UNUSABLE objects, and run check_sql before any SQL runs -- including SQL you mean to run with a tool that is not semlayer's. It is the gate, and a statement it has not seen can return a confidently wrong NUMBER instead of an error. status and context_for_question both carry an execution block naming which executor to use: when it says run_sql, use it -- it applies the gate before the statement reaches the warehouse and reports the limits that applied. When it says otherwise, semlayer cannot execute here: run exactly what check_sql approves, VERBATIM and never re-drafted, with the SQL tool the user has connected, and confirm that tool is pointed at the target the block names. Answer in words first, then state the assumptions the answer rests on, and caveat answers built on lifecycle=inferred elements.

Capabilities

Features and capabilities supported by this server

Protocol revision2025-11-25

CapabilityDetails
tools
{
  "listChanged": false
}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}
experimental
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
statusA

What this server has, what it can see, and what to do next.

    Call this first -- and always before telling a user you have no data
    about their warehouse. It answers with the loaded layer (its size, age, and
    how many claims nobody has reviewed yet), the warehouse connections
    visible from this machine, and a `next` field saying what to do --
    including when there is no layer at all, which is the state a fresh
    install is in. Read-only: it opens no warehouse connection and
    changes nothing.
    
discover_connectionsA

Which warehouses are reachable from this machine, by name.

    Reads DuckDB files in the working directory, warehouse environment
    variables, `$SEMLAYER_HOME/.env`, dbt's profiles.yml and Snowflake's
    connections.toml. Names only: no credential is read, no value that
    could be one is reported, and no connection is opened. Each entry says
    whether semlayer can open it (`supported`) and what it would need if
    not (`note`).

    requested: the warehouse the user NAMED, in their words, when it is
    not in the list -- "databricks", "our iceberg tables in s3", "redshift".
    The answer says whether semlayer opens it after all (Redshift is the
    postgres connection), and if not, the nearest route and what to tell
    them. Pass it rather than guessing: a wrong guess here is either a
    promise we cannot keep or a user sent away who did not need to be.
    
load_layerA

Load one of the layers status listed under layers.

    ref: the `ref` from that list, the connection it is for, or a path to
    a layer file. Returns the new status. Use it when several layers are
    on this machine and the user has said which warehouse they mean --
    and after it, tell them which one you loaded. It replaces the layer
    this session answers from and leaves every file as it was; a ref that
    cannot be loaded comes back as status with an `error`, which still
    lists `layers`.
    
inferA

Build the semantic layer for a warehouse. Ask the user first.

    This READS THEIR WAREHOUSE -- metadata and sample values -- under the
    connection given, and on a real warehouse it takes minutes and uses
    their own LLM key, which costs them money. Ask before calling it, and
    say which warehouse you are about to model.

    connection: a uri from `status.connections`, or one the user gave.
    Omit it to use the session's.
    question: what the user actually asked. Keep it here: when the layer
    is ready, `status` reminds you to answer it, so a run that outlives
    this turn does not lose the point of itself.
    scope: schema names, comma-separated, to model only those. The way to
    make a big warehouse finish quickly.
    wait_seconds: how long to hold this call open (capped at 60). A DuckDB
    file finishes inside it and comes back `ready`, so you can answer in
    the same turn. Anything larger comes back `inferring`.
    use_llm: false for a statistics-only layer -- no descriptions, no
    decode validation, no cost, and much faster.

    While this call is open it streams progress notifications, so a
    client that renders them shows a bar. Nothing will wake you AFTER it
    returns. Tell the user that, and call `status` when they next speak.
    
cancel_inferA

Stop the inference that is running. Takes effect at the next stage.

    Call it when the user asks to stop a run `infer` started. It returns
    immediately with `cancelling`, because a run cannot be interrupted
    mid-stage; call `status` to see it end. With no run going it changes
    nothing and returns status with an `error` saying so.
    
context_for_questionA

START EVERY QUESTION ABOUT THE USER'S DATA HERE.

    Including when you are not sure a layer is loaded: if none is, this
    answers with `status` instead of failing, so there is no reason to
    decide for yourself that there is nothing to query. Deciding that
    without calling anything is how a user with a 36-table layer loaded
    was told the server had no data.

    Returns the part of the layer that bears on this question -- the
    tables it selected, their columns, keys, required filters and
    metrics, the routing knowledge for choosing between them -- plus
    `open_questions`: the claims underneath that nobody has confirmed.

    Write your SQL from this, `check_sql` it, then `run_sql`. Put the
    open questions under your answer as assumptions.
    
run_sqlA

Run ONE read-only SELECT against the session's warehouse.

    `check_sql` runs first and an error means the SQL is NOT executed --
    a query that sums cancelled orders runs perfectly well, so "it ran"
    was never the standard. Warnings do not block, and come back with the
    rows because they are about whether the number means what the user
    thinks.

    Rows are capped and there is a ten-minute time limit; the cap, the
    limit and whether rows were truncated are all stated in the result,
    so you can tell the user what actually applied. Nothing is written,
    nothing is persisted, and your SQL is never rewritten: a required
    filter is reported, never silently applied.

    Refused while an inference is running -- one connection is not shared
    between the two. Ask again when `status` says `ready`.

    The result carries `assumptions` -- the unconfirmed claims the answer
    rests on. Answer the user in words first, then render those under it.
    
review_questionsA

List the open review questions in the loaded layer.

    What is uncertain in this layer, as questions you can answer. Pull
    this when the user asks what is unreviewed or unreliable. Do
    NOT walk the user through it after inference: the questions that
    matter are the ones an answer rested on, and `run_sql` hands you
    those as `assumptions`.

    tables: comma-separated, to scope it to what you are looking at.
    limit: the most to return; `truncated` says whether there were more.

    Read-only. Each question carries its `key`, the claim, what the
    engine saw, and who may decide it. `review_question` gives one in
    full, `review_answer` records a verdict, and `review_decisions` lists
    the ones already given.
    
review_questionA

Fetch one open review question in full, by its key.

    Call it after `review_questions` and before `review_answer`, or
    before putting a question to the user. It adds what the list leaves
    out: every object the question covers, each with where it is, the
    claim and the evidence; what accepting or rejecting would change;
    the shape a `set:` verdict takes; and who may decide.

    Read-only. A key that is not in the queue returns an `error` and
    what to do next -- an answered question has left the queue, which is
    usually what happened.
    
review_answerA

Record a verdict. Takes effect immediately, and says who decided.

    key: the question's `key`, from `review_questions`.

    verdict: `accept`, `reject`, or `set:<value>` -- `review_question`
    gives the shape `set` takes.

    decided_by: `agent` if this is YOUR call, `person` if the user said
    it. Never guess this. You may accept a claim whose accept changes no
    behaviour; rejecting, setting, and accepting anything that unlocks
    behaviour are the person's, and you will be told which this is.

    by: the name to record. For a person, what they told you -- ask once
    if you do not know, never invent it, and never use your own client's
    name. For yourself, something recognisable like `claude-code/opus`.

    exclude: comma-separated object locations the verdict should skip.
    note: your reasoning, kept on the question whether or not the verdict
    was recorded. This is how you PROPOSE one you may not decide.

    If the layer is a set (a hub with members) this is refused and tells
    the user which terminal command records it, so do not promise them it
    is kept until you have the result.
    
review_decisionsA

List every verdict recorded in the loaded layer, and who made it.

    Call it when the user asks what has been decided or by whom, or to
    check what an answer rests on. Each row has the verdict, where it
    applies, the date, the name recorded and a `signal`. Read `signal`:
    `agent` means nobody has confirmed it. Say so when an answer rests
    on one.

    Read-only, and it covers the whole layer the session has loaded. For
    what is still undecided, call `review_questions`.
    
save_layerA

Write the layer into the user's project so their team has it.

    The cache is per-machine; a file in the repository is what a
    colleague reads. From then on this session's verdicts land there.
    Ask where they want it rather than choosing for them. A file already
    at that path is replaced; a path that cannot be written comes back
    as `saved: false` with the reason.

    Refused on a set: a hub and its members are several files the user
    already chose the paths for, and one file cannot hold them.
    
export_layerA

Write a snapshot of the layer in another tool's format.

    path: where the user wants it written.
    target: `dbt` today. On request only, and lossy -- the result says
    what the format could not carry. Nothing keeps it in step with the
    layer afterwards and you must keep answering from the layer, never
    from the export.
    
semantic_searchB

Search tables, columns, and metrics by keywords. The starting point.

get_domainsA

List warehouse domains (table groupings) for navigation.

get_tablesA

List table summaries, optionally within a domain.

table_detailA

Full detail for one table: columns, keys, relationships, REQUIRED FILTERS.

get_metricsB

List defined metrics (name, measure, aggregation, filter).

route_intentC

Which tables to use (and avoid) for an analytical intent.

check_sqlA

Lint SQL against the semantic layer BEFORE it runs ANYWHERE.

    Including SQL you intend to execute with a tool that is not
    semlayer's. Deterministic checks: unknown tables/columns, correlated
    references, deprecated tables, missing required filters, fan-out
    aggregates, SCD2 joins without a validity window. These are the
    mistakes that return a NUMBER rather than an error, so an unchecked
    statement can be confidently wrong. Fix every error and warning
    (each finding carries a fix hint), then re-check. Cheap,
    deterministic, and it never touches the warehouse.
    
compile_metricA

Compile a metric to correct SQL (joins, filters, time bucketing).

    group_by: comma-separated columns. On refusal the response lists
    legal alternatives — retry with those or ask the user; do NOT
    hand-assemble SQL for a refused request.

    scd: "current" or "asof", required when the join path crosses a
    history table. These are different questions — a customer's segment
    now, or their segment when they ordered — so ask the user which they
    meant rather than guessing.
    

Prompts

Interactive templates invoked by user choice

NameDescription
setupWalk me through setting up semlayer

Resources

Contextual data attached and managed by the client

NameDescription

No resources

TDQS

B3.4/5.0

Scored across 21 tools

Disambiguation3/5

Most tools have clear distinct roles, but the entry-point tools overlap heavily: context_for_question ('START EVERY QUESTION HERE'), semantic_search ('The starting point'), route_intent, and get_domains/get_tables all compete for the same navigation job with conflicting guidance. An agent could reasonably misselect among them when beginning a question. The review_* family and the inference lifecycle tools (infer/cancel_infer/status) are cleanly separated.

Naming Consistency4/5

Nearly everything is consistent snake_case verb_noun (get_domains, load_layer, run_sql, check_sql, review_questions, save_layer). The only deviations are the noun-only 'status' and 'table_detail', which break the verb_noun pattern but remain readable and predictable.

Tool Count3/5

21 tools is at the heavy end, and while the server genuinely spans several sub-domains (connection discovery, inference lifecycle, navigation, querying/linting, review workflow, export), the navigation surface could likely be consolidated into fewer entry points. Each tool does something, but the count sits in the borderline 16-25 band.

Completeness4/5

Coverage is strong: discovery, inference with cancellation, navigation, SQL execution plus linting, metric compilation, a full review lifecycle (list/fetch/answer/decisions), and save/export. Minor gaps remain—no way to edit or delete individual layer objects or refresh a saved layer—but agents can work around these.

Maintenance

ActivityActive
ResponsivenessNo recent community issues