Skip to main content
Glama
Nitesh-Nandan

query-executor

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
LOG_LEVELNoPython logging levelINFO
DATABASES_FILENoPath to the databases registry filedatabases.json
CONNECT_TIMEOUTNoasyncpg connection timeout in seconds10.0
DEFAULT_PROJECTNoFallback project when project_id is omitteddefault
EXPLAIN_TIMEOUT_MSNoStatement timeout for EXPLAIN ANALYZE in milliseconds30000
STAT_STATEMENTS_DEFAULT_LIMITNoDefault row limit for pg_stat_statements20

Capabilities

Features and capabilities supported by this server

CapabilityDetails
tools
{
  "listChanged": true
}
logging
{}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}
extensions
{
  "io.modelcontextprotocol/ui": {}
}
experimental
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
describe_postgres_schemaA

Inspect a PostgreSQL schema and return its full structure as JSON.

Call this before writing any query, JOIN, or EXPLAIN — it gives you exact table/column names and indexes so you don't guess.

Returns a JSON object:

  • "columns": table_name, column_name, data_type, is_nullable, column_default

  • "foreign_keys": which columns reference which tables (use for JOINs)

  • "indexes": full CREATE INDEX definitions (check before running EXPLAIN)

Large schemas (100+ tables) return a lot of JSON — filter by table_name client-side rather than calling this multiple times.

execute_postgresA

Execute a SQL query against a PostgreSQL database and return rows as JSON.

Returns: {"rows": [...], "row_count": N}

Mode behaviour (per project in databases.json):

  • readonly — only SELECT/WITH accepted; writes are blocked before reaching the DB.

  • readwrite — all SQL allowed; use only on non-production projects.

Call describe_postgres_schema first to confirm table/column names. If row_count equals your LIMIT, there are likely more rows.

explain_postgresA

Run EXPLAIN (ANALYZE, BUFFERS, FORMAT JSON) on a query and return the plan.

The query executes to collect real timing; results are discarded — only the plan is returned. A statement timeout prevents runaway queries.

Returns: {"plan": []}

Use before running a slow or unfamiliar query on a large table. Check describe_postgres_schema first to see what indexes exist. Write queries are blocked.

list_projectsA

List all configured database projects and their access modes.

Call this first when you don't know which project_id to use. Returns every project registered in databases.json, including which one is the default (used when project_id is omitted).

Returns a JSON object: { "default_project": "<project_id>", "projects": [ {"project_id": "", "mode": "readonly|readwrite", "is_default": true|false}, ... ] }

pg_stat_statementsA

Return the top N most expensive queries from pg_stat_statements.

Best starting point for a performance audit — shows which query patterns cost the most cumulative time across the application.

Returns: {"rows": [{query, calls, total_exec_sec, mean_exec_sec, max_exec_sec, total_rows, shared_blks_hit, shared_blks_read}], "row_count": N}

Query text uses $1/$2 placeholders (pg_stat_statements normalises literals). Requires the pg_stat_statements extension (enabled by default on RDS, Cloud SQL, Supabase; otherwise: CREATE EXTENSION pg_stat_statements).

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Nitesh-Nandan/query-executor'

If you have feedback or need assistance with the MCP directory API, please join our Discord server