Skip to main content
Glama
Analytics MCP server

Analytics MCP server

by aby3941

run_sql

Read-onlyIdempotent

Executes guarded read-only PostgreSQL SELECT queries for analytics questions metrics can’t answer, returning result columns, rows, and the executed SQL.

Instructions

Run one read-only PostgreSQL SELECT (WITH, UNION, INTERSECT and EXCEPT allowed) over the tables in schema saas, for questions no metric answers. Writes, DDL, system catalogs and uncommon functions are rejected; rows are capped by an added LIMIT and the query is cancelled if it runs too long. Returns columns, rows and the SQL that was executed.

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": {
      "sql": "<sql>"
    },
    "name": "run_sql"
  }
}

Input Schema

NameRequiredDescriptionDefault
sqlYes

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already declare readOnlyHint and destructiveHint=false, but the description adds substantive behavior the annotations cannot convey: allowed statement forms, rejection of writes/DDL/system catalogs/uncommon functions, an injected LIMIT row cap, timeout cancellation, and the returned columns/rows/executed SQL. This tells the agent exactly how the tool will constrain or modify its query.

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?

Front-loads the verb, resource and scope, then packs constraints and return shape into two dense sentences with no filler. The result is a long run-on that could be split for readability, but every clause carries information.

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

Completeness5/5

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

Covers the things an agent cannot infer: what SQL is accepted, what gets rejected, how results are capped, and that the executed SQL is echoed back. With an output schema present it does not need to enumerate return fields, and it still signals the result shape briefly.

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

Parameters4/5

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

Schema coverage is 0% and the single 'sql' parameter is documented nowhere in the schema, so the description must carry it — and it does, by specifying the dialect subset (SELECT, WITH, UNION, INTERSECT, EXCEPT) and what the SQL may not contain. It does not mention quoting, parameter binding, or schema-qualification conventions, which keeps it from a 5.

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 — 'Run one read-only PostgreSQL SELECT' — plus the exact scope ('tables in schema saas') and the condition that distinguishes it from the metric tools ('for questions no metric answers'). An agent can tell this apart from get_metric/list_metrics without opening any 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 selection rule: use this only for questions no metric answers, which implicitly routes metric-shaped questions to get_metric/list_metrics. It stops short of stating hard exclusions (e.g. prefer describe_table for schema questions) or listing alternatives by name, so it is clear context rather than a full when/when-not map.

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