Skip to main content
Glama
nic01asFr
by nic01asFr

execute_sql_query

Run custom SELECT SQL queries on Grist documents to retrieve and analyze data with joins, aggregations, and parameters for safe querying.

Instructions

Exécute une requête SQL personnalisée sur un document Grist.

Permet d'exécuter des requêtes SQL complexes avec jointures, agrégations et sous-requêtes.

Prérequis: - list_tables: Pour connaître les noms des tables disponibles - list_columns: Pour connaître les noms des colonnes à requêter

Flux de travail typique: 1. list_tables(doc_id) → identifier les tables 2. list_columns(doc_id, table_id) → identifier les colonnes 3. execute_sql_query(doc_id, "SELECT t1.col1, t2.col2 FROM Table1 t1 JOIN Table2 t2 ON t1.id = t2.ref_id WHERE t1.status = ?", parameters=["active"])

Sécurité: - Utilisez toujours des paramètres liés (?) pour les valeurs variables - Seules les requêtes SELECT sont autorisées

Args: doc_id: ID du document sql_query: Requête SQL à exécuter (SELECT uniquement) parameters: Liste des paramètres pour les placeholders '?' dans la requête timeout_ms: Délai d'expiration en millisecondes (défaut: 1000)

Returns: Dict avec les résultats de la requête et métadonnées

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
doc_idYes
sql_queryYes
parametersNo
timeout_msNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior4/5

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

No annotations are provided, so the description carries full responsibility. It explicitly states that only SELECT queries are allowed, implying read-only behavior, and advises secure parameter usage. It does not disclose error handling or performance implications, but the restriction to SELECT is a critical behavior disclosed.

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?

The description is well-structured with sections for prerequisites, workflow, security, args, and returns. It is slightly verbose but front-loaded with the main purpose. Every sentence adds value, though some wording could be tightened.

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?

Given the complexity of SQL execution, no annotations, and low schema coverage, the description covers prerequisites, workflow, security, and all parameters. It misses interaction with other tools (e.g., how results relate to other Grist operations) but is sufficient for basic usage.

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 0%, yet the description explains each parameter in the Args section: doc_id (document ID), sql_query (SELECT only), parameters (for placeholders), timeout_ms (default 1000ms). This adds significant meaning beyond the minimal schema, providing type, default, and usage context.

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?

The description clearly specifies the tool executes custom SQL queries on Grist documents, explicitly limits to SELECT statements, and distinguishes from siblings like filter_sql_query by its support for complex queries with joins and aggregations. The verb+resource+scope is precise and unambiguous.

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?

The description provides prerequisites (list_tables, list_columns), a typical workflow with three steps, and security guidance on using parameterized queries. It implicitly suggests usage for complex queries but does not explicitly contrast with sibling tools like filter_sql_query for simpler needs.

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

Install Server

Other Tools

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/nic01asFr/mcp-server-grist'

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