Skip to main content
Glama

Search Variables

search_variables
Read-only

Find which local SAS datasets contain a specific variable by scanning metadata only, avoiding trial-and-error metadata checks. Supports exact or substring matching, filename filtering, and scan limits.

Instructions

在 SAS_DATA_ROOT 下搜索含指定变量的数据集。

回答"哪个数据集里有 USUBJID / 哪些表有 AEDECOD",避免逐个 get_dataset_metadata 试错。只读取元数据,不加载数据行;损坏文件记入 errors 而不中断搜索。

Input Schema

NameRequiredDescriptionDefault
limitNo返回匹配条数(默认 50)。
patternNo可选,先按文件名子串过滤数据集,缩小扫描范围。
containsNo为 True 时改为子串匹配(如 "AGE" 命中 AGE / AGEU)。
variableYes要查找的变量名(默认精确匹配,不区分大小写)。
max_datasetsNo最多扫描多少个数据集(默认 200)。

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already declare readOnlyHint/openWorldHint=false, so safety is covered; the description adds genuinely new behavior: only metadata is read, no data rows are loaded, and corrupted files are collected in errors without aborting the search. That error-tolerance disclosure is exactly the kind of context annotations cannot carry.

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?

Three short sentences, front-loaded with the scope constraint, then the use case, then the read-only and error behavior. Nothing repeats the tool name or the schema, and every sentence earns its place.

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 an output schema present and full parameter documentation, the description only needs to cover purpose, read-only semantics, and failure behavior, which it does. The only gap is guidance on choosing among siblings such as list_datasets versus this tool, which would make it fully complete.

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 schema already explains variable, pattern, contains, limit, and max_datasets. The description only restates that a variable name is supplied and adds no format, matching, or scoping 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 and resource (search datasets containing a given variable) plus its scope (under SAS_DATA_ROOT), which is distinct from every sibling. It also explicitly names the sibling it replaces, get_dataset_metadata trial-and-error, so the agent can tell them apart without opening schemas.

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?

Gives two concrete motivating questions ("which dataset has USUBJID", "which tables have AEDECOD") and names the alternative it avoids (iterating get_dataset_metadata). It lacks explicit when-not-to-use guidance, e.g. when list_datasets or read_dataset is preferable, so it falls short of a 5.

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