Skip to main content
Glama

sampler_sample_stratified

Given a groups dictionary and number per group, randomly sample that many items from each group to create a balanced stratified sample. Optional seed ensures reproducibility. Returns sample with group-to-item-list mapping.

Instructions

[sampler] Balanced sampling: n_per_group items from each group dict key. Returns {sample: {group: [items]}}.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
groupsYes
n_per_groupYes
seedNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior3/5

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

No annotations are provided, so the description bears full burden. It states the return format but does not disclose behaviors like shuffling, order preservation, or how seed affects sampling. The description is adequate but minimal.

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?

The description is a single sentence with no fluff. It uses a clear prefix and efficiently conveys the core functionality and return type.

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 tool with 3 parameters and an output schema, the description covers the input and output structure adequately. It could mention constraints like non-empty groups, but is largely 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 0%. The description explains that groups is a dict and n_per_group is the count per group, adding meaning beyond schema names. However, it does not explain the seed parameter, leaving a gap.

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?

The description clearly states the tool performs balanced sampling by taking n_per_group items from each group key in the input dict, and specifies the return format. This is specific, distinct from siblings like sampler_sample_list.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for stratified sampling but does not explicitly state when to use this versus alternatives (e.g., sampler_sample_list for simple random sampling). No when-not or exclusion criteria are provided.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/0-co/agent-friend'

If you have feedback or need assistance with the MCP directory API, please join our Discord server