Skip to main content
Glama

Teable MCP (Official)

sql-query

Read-onlyIdempotent

Run a read-only PostgreSQL query (SELECT only) on the tables of one project. Use it for counts, sums, grouping and reads that join several tables.

Use database names, not display names or IDs:

  • Table: the dbTableName from get-tables-meta, already in "schema.table" form; quote each part, e.g. FROM "bseXXX"."tblYYY"

  • Column: the dbFieldName from get-fields, in double quotes, e.g. "Status"

  • System columns: "__id", "__auto_number", "__created_time", "__last_modified_time", "__created_by", "__last_modified_by"

Add LIMIT 100 to queries that return rows. Timestamps are stored in UTC; convert with timezone('Asia/Shanghai', "col") when needed.

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>",
      "baseId": "<baseId>"
    },
    "name": "sql-query"
  }
}

Input Schema

NameRequiredDescriptionDefault
sqlYesSQL query to execute (SELECT only)
baseIdYesThe project (base) ID, e.g. "bseXXXXXXXX". Use list-bases to find it.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already declare readOnlyHint, idempotentHint, and destructiveHint=false, and the description reinforces with 'SELECT only' while adding genuinely new operational context: UTC timestamp storage with a timezone() conversion recipe, a LIMIT 100 convention, and available system columns. This is substantial behavior disclosure beyond the annotation block.

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

Conciseness5/5

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

Front-loaded with the one-line purpose and the primary usage cue, then organized into a scannable bullet list of identifier rules plus a closing constraints line. No filler sentences; every item carries an actionable rule.

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

Completeness4/5

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

For a 2-parameter query tool with no output schema, the definition covers allowed statement type, identifier resolution, row-limit hygiene, and timestamp handling. The only gap is the shape of the response (rows/columns, error behavior on non-SELECT), which the agent must infer.

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

Parameters5/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 goes well past it: it specifies that the sql parameter must use dbTableName values in already-qualified "schema.table" form with each part quoted, that columns use dbFieldName in double quotes, and that baseId corresponds to a project. A terse schema string is upgraded into a workable naming contract.

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+resource ('Run a read-only PostgreSQL query') with an explicit scope ('on the tables of one project') and an enforcement clause ('SELECT only'). This clearly distinguishes it from siblings like get-records and call-api-read, which are record/API-level accessors rather than ad-hoc SQL.

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 explicit positive guidance: 'Use it for counts, sums, grouping and reads that join several tables,' which tells the agent when SQL beats the record-listing siblings. It also names prerequisite discovery tools (get-tables-meta, get-fields) for resolving names. It stops short of an explicit exclusion (e.g. 'for simple single-table reads prefer get-records'), so not a 5.

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