Skip to main content
Glama

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
SCHEMAGATE_MEMORYNoEnables memory of question-SQL pairs. Set to a path or '1' for ~/.schemagate/memory/<db>.jsonl. Off by default.
SCHEMAGATE_MCP_PORTNoPort for the streamable-http transport. Used when SCHEMAGATE_MCP_TRANSPORT=streamable-http.
SCHEMAGATE_AUDIT_LOGNoEnables audit logging. Set to a file path, or '1' for ~/.schemagate/audit.jsonl. Off by default.
SCHEMAGATE_DATABASE_URLYesDatabase URL to connect to. Set to 'demo' to serve the bundled sample schema.
SCHEMAGATE_AUTO_EMBEDDERNoSet to '0' to force the hashed embedder even if schemagate[huggingface] is installed.
SCHEMAGATE_MCP_TRANSPORTNoMCP transport. Use 'stdio' (default) or 'streamable-http' for HTTP.stdio
SCHEMAGATE_CATALOG_CONFIGNoPath to a catalog configuration JSON file. Can contain 'restrict', 'hint', and 'groups' blocks.

Instructions

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

Schema selection and read-only query execution. Call select_schema with the user's question and, whenever you know it, their identity (principal like 'okta:jdoe' and roles). Write SQL only against the DDL returned; anything not returned is not available to this caller. Then call run_query with that SQL and the same principal and roles to get the rows -- it accepts one read-only SELECT, refuses writes, and refuses any table this caller may not see. Pass the identity to both: run_query scopes on what it is given, not on the earlier call.

Capabilities

Features and capabilities supported by this server

Protocol revision2025-11-25

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

Tools

Functions exposed to the LLM to take actions

NameDescription
select_schemaA

Start here for any question about the data. Returns the few tables and views the question needs, as compact DDL to write SQL against, scoped to the caller: objects and columns they may not read are absent, not ranked low. Pass principal and roles whenever you know who is asking. Returns 'ddl' (put it in your SQL prompt), 'objects' (the names chosen), 'explain' (score and reason per object) and 'selected' / 'total_objects'. Reads table structure only, never rows. Next: write one SELECT against 'ddl' and call run_query with the same principal and roles; call describe_object if a table needs more columns than the compact DDL shows. If the right table is missing, raise top_k or rephrase rather than writing SQL against a table that was not returned.

list_objectsA

List every table and view this caller may read: 'objects' holds each one's name, kind (table or view), column count and description, with 'count' visible out of 'total_objects'. Use it to show what data exists, or when select_schema did not return what you expected. It returns no DDL and no rows, and on a large database it is long: to answer a question, call select_schema instead. Pass principal and roles; restricted objects are absent for callers without the role.

describe_objectA

Full DDL (all visible columns, keys, comments) for one table or view, if the caller may read it. Use it when select_schema's compact DDL is not enough. A restricted or missing object returns the same 'not available' error, so its existence is not revealed.

run_queryA

Execute one read-only SELECT and return the rows (capped by max_rows). Write the SQL against the DDL select_schema returned for the same caller. Refuses writes, multiple statements, and any table or column the caller may not read, with an error that says so ('not available to this caller'), which you can pass on to the user instead of reporting 'no results'.

semantic_queryA

For questions about what text says when no column records it, e.g. 'which complaints ask for a refund'. Runs one read-only SELECT through the same checks as run_query, then has the server's model read one text column of the returned rows and either keep the rows that meet a criterion or add a short answer per row. Returns columns, rows, how many rows were judged, and which text was sent to the model. Off unless the server enables it (SCHEMAGATE_MCP_SEMANTIC=1), because the row text goes to the model provider; at most 200 rows are judged. Use plain run_query whenever a column already holds the answer.

answerA

Question in, rows out: selects the schema, writes the SQL with the server's own configured model, and runs it, all scoped to the caller. Only available when the server has a model configured; most clients should use select_schema then run_query with their own model instead.

deep_answerA

Like answer, but able to work in steps (mode 'adaptive', the default, tries one plain query first and only works in steps when it fails or comes back empty; mode 'deep' always does): the server's model may run small exploring queries to see real values (how a status or country is spelled, a date format, whether a join matches), ask for more tables, and fix a query the database rejected, before running the final query. Every query goes through the same read-only and caller-scope checks as run_query. Returns the rows plus a step-by-step trace (each step's SQL and outcome) and what was sent to the model. Off unless the server enables it (SCHEMAGATE_MCP_DEEP=1), because exploring rows go to the model provider; use it for questions that name values or span several tables, and answer for simple ones.

refresh_catalogA

Re-read the database structure (new tables, changed columns, changed grants) and swap the index in. Call it after a migration or a permission change, or when health shows the catalog is stale; it is not needed before ordinary questions. Takes no arguments, never changes the database, and can take seconds on a large schema. Returns {ok: true, objects, seconds}. If the database is unreachable it returns {ok: false, kept_previous: true, error}: the previous catalog stays in service.

healthA

Server status: whether the catalog is loaded, how many objects it holds, the database dialect, and audit-log counts. Takes no arguments; safe to call any time.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

TDQS

A4.4/5.0

Scored across 9 tools

Disambiguation4/5

The core workflow (select_schema -> run_query, with describe_object/list_objects/refresh_catalog/health as clear supporting utilities) is unambiguous, and descriptions explicitly steer clients away from answer/deep_answer. However, answer, deep_answer, and semantic_query all wrap model-driven querying and share the same read-only checks, so an agent must read carefully to pick among them, especially when the deep/semantic features are disabled by env flags.

Naming Consistency4/5

Eight of nine names follow a predictable snake_case verb_noun or noun_verb form (run_query, select_schema, describe_object, list_objects, refresh_catalog, semantic_query). The outliers are the bare 'answer' and noun-only 'health', plus the adjective-prefixed 'deep_answer', which are readable but break the verb pattern.

Tool Count5/5

Nine tools is well-scoped for a read-only schema gateway: a discovery path, a query path, three catalog/ops utilities, and two optional model-assisted modes. Each tool has a distinct role and none feels like filler.

Completeness4/5

The surface covers the full read-only lifecycle: discover objects, inspect DDL, select relevant schema, execute scoped SQL, refresh the catalog, and check health, with no writes needed by design. Minor gaps remain, such as no dedicated column/value search tool (select_schema relies on question phrasing and top_k) and no way to sample values without enabling the off-by-default deep mode.

Maintenance

ActivityActive
ResponsivenessLimited data