Skip to main content
Glama

Get DataLens saved SQL query

datalens_sqlqueries_get
Read-onlyIdempotent

Retrieve a saved DataLens SQL query's text, connection, and parameters by ID, optionally including revision, favorite status, or permissions.

Instructions

One saved SQL query: its text, its connection and its parameters.

Experimental in the DataLens API and written from its document: not measured. An organization whose SQL editor is off answers 403 SQL_EDITOR_NOT_ALLOWED.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rev_idNoThe revision to read; the current one when left out.
sql_query_idYesSQL query id.
include_favoriteNoAlso say whether it is a favourite.
include_permissionsNoAlso say what the caller may do with it.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.122.1

TDQS

A3.6/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint and openWorldHint, so the safety profile is covered. The description adds genuinely new context beyond that: the endpoint is experimental/not measured, and an organization with the SQL editor disabled receives 403 SQL_EDITOR_NOT_ALLOWED. This is useful operational detail the annotations cannot express.

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?

Two tight sentences front-load the identity of the resource and its returned fields, followed by the caveat about experimental status and the 403 case. No filler and nothing redundant with the structured fields.

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?

With no output schema, the description carries the return-value burden and does so by naming the three returned facets (text, connection, parameters), plus it warns about the permission failure mode. It is nearly complete; minor omissions like pagination/revision behavior are negligible for a single-item get.

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 rev_id, sql_query_id, include_favorite and include_permissions are already documented in the schema. The description's mention of 'its parameters' refers to the stored query's parameters, not the input arguments, so it adds no meaning beyond the schema. Baseline 3 applies.

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?

The description names a specific verb-resource pair implicitly ('One saved SQL query') and enumerates what it returns: text, connection, parameters. It is clearly a read of a single saved query, distinguishable from datalens_sqlqueries_create/update/delete/run in the sibling list, though it does not explicitly name those siblings.

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 guidance on when to choose this over datalens_sqlqueries_run (to execute) or datalens_entries_revisions_list (to enumerate revisions), and no statement of prerequisites. The 403 SQL_EDITOR_NOT_ALLOWED note is a failure condition, not usage guidance.

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