Skip to main content
Glama

reservoir_sample

Selects k random items from a list with equal probability, with optional seed for reproducible sampling.

Instructions

Select k random items from a list with equal probability using reservoir sampling.

Input Schema

NameRequiredDescriptionDefault
kNoNumber of items to sample (default 1)
seedNoOptional seed for reproducible results
itemsYesArray of items to sample from

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.1.11

TDQS

B3.3/5.0
Behavior3/5

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

No annotations are provided, so the description carries the full behavioral burden. It usefully discloses 'equal probability' and the reservoir-sampling algorithm, but omits edge-case behavior (e.g., k greater than list length) and any ordering/return-format detail.

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?

A single front-loaded sentence with no filler. The purpose and mechanism are stated immediately and nothing is wasted.

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

Completeness3/5

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

For a pure, no-annotation, no-output-schema function this is roughly adequate, but it leaves edge cases (k exceeding list size) and result ordering unexplained. A bit more behavioral detail would make the definition robust.

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 all three parameters (k, seed, items) are already documented in the schema, including the default of 1 for k and the reproducibility role of seed. The description adds no parameter meaning beyond what the schema provides, so the baseline of 3 applies.

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?

The description states a specific verb ('Select') and resource ('k random items from a list') and names the underlying technique. It implicitly distinguishes itself from single-item siblings like random_pick_from_list by specifying k items, but it never explicitly contrasts with them.

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?

There is no guidance on when to use this tool versus alternatives, despite many siblings that overlap (random_pick_from_list, random_shuffle_list, random_number). No prerequisites or exclusions are stated.

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

Deploy Server

Other Tools