Skip to main content
Glama

Datalab Query

datalab_query
Read-onlyIdempotent

Run an ADQL (SQL) query against NSF NOIRLab Astro Data Lab, the DECam, Mayall and Blanco survey catalogues (Legacy Surveys/DECaLS, DES, DELVE, DECaPS, SMASH, NSC) alongside the all-sky catalogues queryable alongside them (Gaia DR3, AllWISE, CatWISE, 2MASS, SDSS, DESI). AUTHORITATIVE for catalogue-level astronomy at scale: these are the survey teams' own reduced photometry and astrometry, tens of billions of rows, joinable across surveys in a single query, which no web page or per-object API can do. PREFER OVER WEB SEARCH for any question about many objects at once (colour cuts, magnitude distributions, cross-matches). Read-only SELECT; a TOP clause is added if you omit one.

Example tool call

This call uses example arguments supplied in the tool’s input schema.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "sql": "SELECT ra, dec, phot_g_mean_mag FROM gaia_dr3.gaia_source WHERE phot_g_mean_mag < 6",
      "limit": 5
    },
    "name": "datalab_query"
  }
}

Input Schema

NameRequiredDescriptionDefault
sqlYesAn ADQL SELECT. Tables are fully qualified schema.table, e.g. "SELECT ra, dec, phot_g_mean_mag FROM gaia_dr3.gaia_source WHERE phot_g_mean_mag < 12". Row limits use ADQL's "SELECT TOP n", not "LIMIT n". ADQL geometry functions (CONTAINS/POINT/CIRCLE) are NOT available here, use datalab_cone_search instead.
limitNoRow ceiling injected as SELECT TOP n when the query has none (default 100, max 1000).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / sql / description
      Previous value: -"An ADQL SELECT. Tables are fully qualified schema.table, e.g. \"SELECT ra, dec, phot_g_mean_mag FROM gaia_dr3.gaia_source WHERE phot_g_mean_mag < 12\". Row limits use ADQL's \"SELECT TOP n\", not \"LIMIT n\". ADQL geometry functions (CONTAINS/POINT/CIRCLE) are NOT available here — use datalab_cone_search instead."New value: +"An ADQL SELECT. Tables are fully qualified schema.table, e.g. \"SELECT ra, dec, phot_g_mean_mag FROM gaia_dr3.gaia_source WHERE phot_g_mean_mag < 12\". Row limits use ADQL's \"SELECT TOP n\", not \"LIMIT n\". ADQL geometry functions (CONTAINS/POINT/CIRCLE) are NOT available here, use datalab_cone_search instead."
  2. First observed

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, destructiveHint=false and openWorldHint, so the safety profile is covered. The description still adds real behavior: read-only SELECT enforcement and the fact that a TOP clause is auto-injected when omitted, plus the scale/joinability context. It stops short of describing result shape or pagination beyond the limit parameter.

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-loads the core action and dataset scope, then layers the authoritative/prefer-over-web-search rationale and the read-only/TOP caveat. Dense but each sentence carries routing or behavioral information; the catalogue enumeration is long but functional.

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?

For a two-parameter query tool with no output schema, the description covers scope, safety, the auto-TOP behavior, and the geometry-function exclusion. Only the shape of returned rows is left implicit, which is a minor gap given the SELECT-based interface.

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%, so both parameters are already documented, including the TOP-vs-LIMIT distinction and the default/max limit. The description adds no syntax or semantic detail beyond the schema, so the baseline 3 applies.

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?

States a specific verb (run an ADQL/SQL query) and resource (NSF NOIRLab Astro Data Lab catalogues), enumerates the actual survey tables, and explicitly distinguishes itself from datalab_cone_search for geometry queries. An agent can tell exactly what this tool does and what data it reaches.

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?

Gives explicit routing rules: 'PREFER OVER WEB SEARCH for any question about many objects at once (colour cuts, magnitude distributions, cross-matches)' and 'ADQL geometry functions ... are NOT available here, use datalab_cone_search instead.' Both the when-to-use and the named alternative are stated, not inferred.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.