Skip to main content
Glama

sampler_random_choice

Randomly select one item from a given array. Returns the chosen value and its position index. Ideal for sampling, randomization, or drawing winners.

Instructions

[sampler] Pick a single random item. Returns {choice, index}.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
itemsYes
seedNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior2/5

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

With no annotations, the description must fully disclose behavior. It states the return format but omits crucial details: whether the selection is uniform or pseudo-random, that seed ensures reproducibility, that the items array must not be empty, and that the operation is non-destructive. These gaps leave the agent uninformed about side effects and guarantees.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is short (two sentences) but lacks important parameter and behavioral information. While conciseness is valued, it sacrifices completeness. Could be expanded slightly to cover parameters without becoming verbose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity and the existence of an output schema (though not described), the description is incomplete. It fails to explain parameters, edge cases (empty items), randomness properties, and seed usage. A more complete description would enable confident invocation without additional inference.

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

Parameters1/5

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

Schema description coverage is 0%, so the description should explain parameters. It does not mention 'items' or 'seed' at all. 'items' is required but not described (e.g., type of items, minimum length). 'seed' default is null but no explanation of its role in reproducibility. This is a critical omission for correct invocation.

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?

Description clearly states the tool picks a single random item and returns the choice and index. The verb 'Pick' and resource 'single random item' are specific. It distinguishes from sibling sampler tools that perform different operations (e.g., split, weighted, shuffle). However, it does not explicitly mention 'from the provided items array', relying on context from the input schema.

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?

No guidance on when to use this tool versus sibling sampler tools (e.g., sampler_random_split, sampler_sample_weighted). The description does not mention prerequisites, such as the items array must be non-empty, or alternatives for weighted or stratified sampling. This lack of usage direction reduces its helpfulness for tool selection.

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