Skip to main content
Glama

Update DataLens saved SQL query

datalens_sqlqueries_update
Idempotent

Update an existing SQL query in DataLens by providing its ID, connection, and new query text. Returns the saved query.

Instructions

Save a SQL query anew and return it; the connection and the text go every time.

Experimental in the DataLens API and written from its document: not measured.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesThe text of the query.
paramsNoThe parameters the text takes.
descriptionNoA description.
sql_query_idYesSQL query id.
connection_idYesThe connection it runs over: PostgreSQL, ClickHouse, MySQL, Greenplum, Trino.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.122.1

TDQS

B3.1/5.0
Behavior4/5

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

Annotations already declare the safety profile (writable, idempotent, non-destructive, open-world), so the bar is lower. The description adds genuinely useful context the annotations do not: connection and query text are re-sent on every call (full replacement, not a partial patch), plus an honest "experimental / written from the document, not measured" caveat.

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?

Two short sentences, front-loaded with the operation and the always-resend constraint, with the experimental caveat last. No filler, though the second sentence is more about provenance than invocation.

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

Completeness3/5

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

For a 5-parameter mutation tool with no output schema, the description hints at a return value and replacement semantics but says nothing about the params/description fields, error behavior, or what the returned query looks like. Adequate but thin.

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 description coverage is 100%, so the baseline is 3. The description reinforces that connection_id and query are supplied every call, but adds no syntax or meaning beyond that for the nested params array or description field.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

"Save a SQL query anew" conveys an update/replacement of a saved SQL query and implies a return value, but the phrasing is oblique — it never plainly says it updates an existing query by id, nor distinguishes itself from the sibling datalens_sqlqueries_create.

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

Usage Guidelines2/5

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

No when-to-use guidance is given: nothing says when to update versus create a new query, what happens on a bad sql_query_id, or what permissions/connection requirements apply. The agent is left to infer the tool's place among the sqlqueries_get/create/delete/run siblings.

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

Deploy Server

Other Tools