Skip to main content
Glama

Query Dataset

query_dataset
Read-only

Run read-only DuckDB SQL queries against a SAS dataset registered as dataset, with optional extra tables for joins, pagination, and value-label decoding.

Instructions

对数据集执行 duckdb SQL(仅 SELECT / WITH)。

主数据集表名固定为 dataset。传入 extra_paths 可再注册附加表,表名取文件名主干 (如 lb.sas7bdat -> lb),冲突时回退 dataset2/dataset3;返回的 tables 给出 表名->路径 映射。用于跨数据集对比,例如: sql="SELECT COUNT(*) FROM dataset a FULL JOIN lb b USING(USUBJID)"

Input Schema

NameRequiredDescriptionDefault
sqlYesSQL 语句,如 "SELECT COUNT(*) AS n FROM dataset"。
pathYes主数据集路径,相对 SAS_DATA_ROOT 或绝对路径。
limitNo返回行数(默认 100,上限 SAS_LOCAL_MCP_MAX_AGG_ROWS,默认 1000)。
offsetNo起始行号,用于翻页。
extra_pathsNo可选,附加数据集路径列表,注册为额外表参与 JOIN。
apply_labelsNo为 True 时把结果里的 coded 值替换为 SAS 值标签文本。

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare readOnlyHint/openWorldHint/destructiveHint=false, and the description is consistent with them, adding the important enforcement detail that only SELECT/WITH statements are accepted. It also discloses the extra_paths table-registration and collision fallback behavior (dataset2/dataset3), which the agent could not infer otherwise. It does not discuss error behavior or result-size truncation, keeping it below a 5.

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 constraint in the first sentence, then adds the table-naming rule and a worked example, each of which earns its place. Dense but not padded; a short pointer to the paging parameters is the only missing piece.

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?

An output schema exists, so return values needn't be spelled out, and the description still helpfully notes that the response includes a tables name->path map. Combined with the SELECT/WITH restriction and extra_paths naming rules, an agent has enough to call it correctly; only truncation/paging behavior at the row cap is unaddressed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 100% schema coverage the baseline is 3, and the description genuinely adds semantics beyond the schema: how extra_paths entries map to table names (filename stem, e.g. lb.sas7bdat -> lb) and how name conflicts resolve. The remaining parameters (limit, offset, apply_labels) are left entirely to the schema.

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?

Names a specific verb (execute DuckDB SQL) and resource (dataset), pins the main table name as `dataset`, and restricts the dialect to SELECT/WITH. That level of specificity cleanly separates it from read_dataset, summarize_dataset, and frequency.

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?

Explicitly states the intended scenario — cross-dataset comparison via extra_paths — and backs it with a concrete FULL JOIN example. It stops short of saying when to prefer the simpler siblings (read_dataset/summarize_dataset) instead, so it is clear context without exclusions.

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