Skip to main content
Glama

Run SQL

run_sql
Read-only

Run one PostgreSQL SELECT (https://www.postgresql.org/docs/current/sql-select.html) against Doovalacky's own warehouse, this company's synced copy of its sources, and answer its rows, to explore the data and to write a report's sql block. It never reaches a source's live API. Each source is a schema named by list_connections' sql_schema (simpro, xero, verizon_connect, the_fleet_office, deputy, moveware, dialpad, three_cx, splose, momence, elmo, employment_hero, geotab, google_ads, emailed_reports), holding one view per resource named and shaped as describe_resources lists it, plus data, the whole document as the source sent it (jsonb: data->>'Name', data#>>'{Customer,ID}'). Name the sources read with connection_ids; the first one's schema is also the default, so jobs reads simpro.jobs. Joins, CTEs, window functions and every read-only function work. period_start() and period_end() answer a report block's period. Tax file numbers, bank details and birth dates are removed from every document. Nothing can be written, and a query runs at most 15s. Dates a source sent as text compare as text: date_issued >= '2026-07-01'. At most 200 rows answer at once, and truncated true means more remain: read on with ORDER BY and OFFSET in the SQL, and count or total with COUNT(*), SUM and GROUP BY rather than reading every row. The warehouse is documented at https://docs.doovalacky.ai/.

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
sqlYesOne SELECT (or WITH ... SELECT), no semicolons between statements.
limitNoRows to answer. Default and most 200.
connection_idsNoThe sources it reads. Omit when the company has one.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.5/5.0
Behavior5/5

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

Goes well beyond the readOnly/destructive annotations: hard 15s query timeout, a 200-row answer cap with a `truncated` flag and the recommended ORDER BY/OFFSET continuation, the note that documents carry a jsonb `data` column of the raw payload, PII stripping (tax file numbers, bank details, birth dates), and the text-comparison caveat for dates. These are exactly the operational constraints an agent needs before composing SQL, and none of it is deducible from the annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The purpose is front-loaded and most sentences carry unique operational information, but it is one dense block of roughly 200 words with nested parentheticals. The enumeration of all fifteen schema names is largely redundant given the preceding pointer to list_connections' sql_schema, and that enumeration is the single largest source of bloat.

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?

With no output schema, the description carries the full burden of describing returns and does so: rows, the `truncated` boolean, the 200-row ceiling, COUNT/SUM/GROUP BY guidance for aggregates, and the jsonb `data` column. For a parameterized SQL execution tool, an agent has enough to call it correctly on the first attempt.

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 100%, so the baseline is 3, but the description adds real meaning: `connection_ids` selects which source schemas are read and the first one becomes the default (so `jobs` resolves to simpro.jobs), and the 200-row ceiling gives the `limit` parameter its practical bound. It does not explain the interaction between an explicit `limit` and the truncation threshold, 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 precise verb and resource ('Run one PostgreSQL SELECT') plus the exact scope ('Doovalacky's own warehouse, this company's synced copy of its sources') and the two jobs it serves (data exploration and writing a report's sql block). The boundary 'It never reaches a source's live API' separates it from any live-call sibling without the agent needing to open another 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 clear positive guidance: use it to explore data and to author a report's sql block, and it routes the agent to list_connections' sql_schema and describe_resources for schema/view naming. It stops short of naming when NOT to use it — for example, pointing to run_report, search_records or get_record for simpler path-based retrieval — so the choice among retrieval siblings is still left to inference.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources