Skip to main content
Glama
elekto-com-br

Elekto MCP for SQL Server

Official

Query a table or view

query_table
Read-onlyIdempotent

Run read-only SELECT queries on one table or view with filters, grouping, aggregates, pagination, and sampling, returning row_count and a truncated flag.

Instructions

Runs a SELECT on one table or view, with optional column list, filter, ordering, grouping, aggregates (COUNT, SUM, AVG, MIN, MAX), pagination and random sampling, and returns the rows in an object with row_count and a measured 'truncated' flag, so a short result is never mistaken for a complete one. Rows are capped by the database's max_query_rows. Call get_table_schema first for exact column names; for null ratios, distinct counts and frequent values use get_data_profile instead of paging through rows. Reads actual data; never runs INSERT, UPDATE, DELETE or procedures.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
topNoMaximum number of rows to return (default 100, capped by the per-database limit).
skipNoNumber of rows to skip before returning results (for pagination, default 0).
tableYesTable or view name, bare, with no schema prefix. Example: 'GenericSecurity'
whereNoWHERE clause without the WHERE keyword, as SQL. Example: "Source = 'BDS' AND ReferenceDate >= '2026-01-01'"
schemaNoTable/view schema. Empty means dbo. Example: 'Feeder'
columnsNoColumns as ONE comma-separated string, not a JSON array. Example: 'ReferenceDate, Source, Close'. Empty or '*' returns every column. Reserved words need no quoting or brackets.
databaseYesName of the database as registered in the configuration.
group_byNoGROUP BY columns as ONE comma-separated string. Example: 'Source, Name'
order_byNoORDER BY clause without the ORDER BY keyword. Example: 'ReferenceDate DESC, Name'
aggregatesNoAggregates as ONE comma-separated string of FUNC(column) [AS alias], with FUNC one of COUNT, SUM, AVG, MIN, MAX. Only a bare column name is allowed inside the parentheses. Example: 'COUNT(*) AS Total, MAX(ReferenceDate) AS Ultima'
sample_percentNoRandom sampling percentage, from 0.01 to 100. Zero (the default) means no sampling.

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?

Beyond the readOnly/idempotent annotations, it discloses the return shape (row_count plus a measured 'truncated' flag), that rows are capped by the database's max_query_rows, and that it never runs INSERT/UPDATE/DELETE or procedures. The truncation semantics are exactly the kind of behavior that prevents misreading a short result.

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-loaded with the operation and its capabilities, then the output contract, then the sibling routing, then the read-only boundary. Dense but every clause earns its place; the single long sentence is slightly overloaded but stays scannable.

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?

For an 11-parameter query tool with no output schema, the description compensates by describing the returned object (rows, row_count, truncated) and the row cap. An agent has everything needed to call it and interpret results correctly.

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

Parameters3/5

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

Schema coverage is 100% and each of the 11 parameters is documented with examples, so the description need not carry parameter detail. It only summarizes the parameter surface (filters, grouping, aggregates, sampling) without adding syntax or format beyond the schema, which is the expected baseline.

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?

Names a specific verb (SELECT) and resource (one table or view) and enumerates the supported clauses: column list, filter, ordering, grouping, aggregates, pagination, sampling. An agent can distinguish this from sibling readers like get_table_schema or get_data_profile without opening schemas.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly routes the agent: call get_table_schema first for exact column names, and use get_data_profile for null ratios, distinct counts and frequent values instead of paging through rows. Both a prerequisite and a when-not alternative are stated.

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