Skip to main content
Glama

Update DataLens saved SQL query

datalens_sqlqueries_update
Idempotent

Update a DataLens SQL query using its ID, connection, and query text, then return 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.

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_query_id": "<sql_query_id>",
      "connection_id": "<connection_id>",
      "query": "<query>"
    },
    "name": "datalens_sqlqueries_update"
  }
}

Input Schema

NameRequiredDescriptionDefault
queryYesThe text of the query.
paramsNoThe parameters the text takes.
dry_runNoSend nothing: answer `{dry_run: true, request}`, the first write the tool would make (null: none).
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. Changed1 schema field changedv0.142.2
    • addedInput schema / properties / dry_run
      Added value: +{
      +  "default": false,
      +  "description": "Send nothing: answer `{dry_run: true, request}`, the first write the tool would make (null: none).",
      +  "type": "boolean"
      +}
  2. Addedv0.122.1

TDQS

B3.4/5.0
Behavior4/5

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

Beyond the annotations (readOnlyHint=false, idempotentHint=true, destructiveHint=false), the description discloses two things structured fields do not: the call returns the saved query, and connection_id plus query must be resent on every call, i.e. replace semantics. The caveat "Experimental in the DataLens API and written from its document: not measured" is a genuine reliability warning that tells the agent the behavior is untested.

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 with the operation stated first and the reliability caveat second; nothing is padding. The phrasing "go every time" is slightly idiomatic where 'must be supplied on every call' would be unambiguous, which keeps it off a 5.

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 6-parameter write tool with no output schema, the definition covers return intent, replace semantics, and the experimental status, and the annotations carry the safety profile. It is silent on what happens to optional fields (params, description) that are omitted during a full replace, which is the one behavior an agent most needs before calling it.

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 every parameter including dry_run and params already carries its own documentation and the baseline of 3 applies. The description reinforces that connection_id and query are mandatory each time, but adds no syntax, format, or defaulting detail beyond the schema.

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

Purpose4/5

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

"Save a SQL query anew and return it" states the verb (persist) and resource (saved SQL query), and the clause "the connection and the text go every time" pins down that it is a full replace rather than a patch. It stops short of naming the create/run siblings it must be distinguished from, so an agent still has to infer that sql_query_id makes this the update path.

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?

There is no statement of when to use this versus datalens_sqlqueries_create, _run, or _get, and no guidance on when dry_run is appropriate even though that parameter exists. The only orientation is the implicit 'save' framing; nothing tells the agent when not to call it.

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