Skip to main content
Glama

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
SQL_AGENT_DSNNoDatabase connection string, e.g. sqlite:///./shop.db or postgresql://readonly:password@localhost:5432/shop. A path with no scheme is read as SQLite. Required unless demo mode is enabled.
OPENAI_API_KEYNoAPI key for the OpenAI-compatible endpoint used by the ask and evaluate tools. Not needed for list_tables, describe_table or run_sql.
SQL_AGENT_DEMONoSet to 1 to use the bundled sample database (demo mode). Alternative to SQL_AGENT_DSN.
OPENAI_BASE_URLNoBase URL for an OpenAI-compatible endpoint, if not using the default OpenAI endpoint.
SQL_AGENT_MODELNoModel name for the agent, e.g. deepseek-ai/DeepSeek-V3.
SQL_AGENT_MAX_STEPSNoMaximum number of steps for the agent loop. Default is 12.

Instructions

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

Query a SQL database in plain language, and check the answer.

Two ways to use this server:

  • ask runs an agent that inspects the schema, writes SQL, runs it and answers. It returns the SQL that actually executed (final_sql), the rows, and a trace of every step with its latency and cost. If the agent typed SQL into its answer without running it, that is reported separately as claimed_sql and sql_was_executed is false — do not quote unexecuted SQL to the user as evidence.

  • list_tables, describe_table and run_sql let you write the SQL yourself. run_sql accepts one read-only SELECT or WITH statement.

evaluate runs a golden set — questions with hand-written reference SQL — against this database and reports accuracy, the failures and what each cost. It calls the model once per step of every case, so it is not free.

The database is opened read-only. Writes are refused twice over: by the connection and by a parser that accepts a single SELECT and nothing else.

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
askA

Answer a question about the database in plain language. Returns the answer, the SQL that was actually executed, the rows it returned, and a trace of every step with its latency and cost. sql_was_executed is false when the agent answered without running a query; in that case final_sql is null and claimed_sql holds whatever SQL the model typed into its answer without running it.

evaluateA

Run a golden set of questions with hand-written reference SQL against this database and report accuracy, every failure with its reason, the tool path taken and the cost. Pass the path to a YAML file of cases; omit it to use the one bundled with the sample database. Each case runs the full agent loop, so this calls the model once per step of every case and is not free — use only to run a single case first.

list_tablesA

Every table in the database with its row count. On PostgreSQL the count is the planner's estimate, marked rows_estimated, because counting every row of every table to orient is not cheap.

describe_tableA

A table's columns, types, foreign keys and three real rows. Read this before writing SQL against a table you have not inspected: the sample rows are what reveal that an INTEGER column holds cents and that a TEXT column holds ISO dates.

run_sqlA

Execute one read-only SELECT or WITH statement and return up to 50 rows. Anything else is refused: several statements, a write, a write inside a CTE, ATTACH, PRAGMA, SET, a row lock. When the database rejects the query you get its own error text back, which is usually enough to fix it.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

TDQS

A4.1/5.0

Scored across 5 tools

Disambiguation5/5

Each tool occupies a clearly distinct niche: list_tables and describe_table differ in granularity (inventory vs. columns/sample rows), run_sql executes agent-authored SQL, ask handles natural-language questions, and evaluate runs a golden-set harness. The ask vs. run_sql boundary is explicitly clarified by the input type (plain language vs. SQL) and the returned sql_was_executed/final_sql fields.

Naming Consistency4/5

Three tools follow a clean verb_noun pattern (list_tables, describe_table, run_sql), and all five are verb-first imperatives. However, ask and evaluate are bare verbs with implicit nouns, which is a minor deviation from the otherwise predictable scheme.

Tool Count5/5

Five tools is tight and well-scoped for a read-only SQL agent: orient, inspect, execute, ask in natural language, and evaluate accuracy. No tool feels redundant or like filler, and nothing essential is obviously missing at this size.

Completeness4/5

The surface covers the full read-only lifecycle—discover tables, inspect schemas with sample rows, run SELECT/WITH queries, ask plain-language questions, and validate against golden cases. Minor gaps remain, such as no dedicated EXPLAIN/query-plan or schema-search tool, though agents can approximate both through run_sql against catalog tables.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues