Skip to main content
Glama

Randomization / allocation / 随机化分组

randomization_allocate
Read-only

Randomization / allocation / 随机化分组 | USE WHEN: produce a reproducible randomization list: simple, block, stratified, or minimization, with a fixed seed | ALIASES: 随机分组, 随机数字表, 区组随机, 分层随机, 最小化法, randomization, random allocation, 分组名单, seed | RETURNS: 分组结果表

Example tool call

This call uses example arguments supplied in the tool’s input schema.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "seed": 20261107,
      "groups": [
        "干预组",
        "对照组"
      ],
      "method": "block",
      "block_size": 4,
      "n_subjects": 60
    },
    "name": "randomization_allocate"
  }
}

Input Schema

NameRequiredDescriptionDefault
seedNo随机种子(固定才可复现)
groupsYes分组名称数组,如 ["干预组","对照组"](**必须是数组,不是数字**)。组数由数组长度决定;两组以上会按区组/分层规则分配。
methodNosimple 简单 / block 区组 / stratified 分层 / minimization 最小化
strataNo分层因素 {因素名: [各水平…]},仅 method=stratified 时使用,如 {"中心": ["A","B"], "分期": ["I","II"]}。
factorsNo最小化法的预后因素及权重 {因素名: 权重},仅 method=minimization 时使用。
block_sizeNo区组长度(block 方法用)
covariatesNo基线协变量 {因素名: [各例取值…]},用于随机后自动做均衡性检验(返回 balance_report)。长度须等于 n_subjects。
n_subjectsYes总样本量,如 60
n_per_stratumNo每个层内例数,仅 method=stratified 时使用;不传按 n_subjects/层数 均分。
covariate_typesNo协变量类型 {因素名: "continuous"|"categorical"},配合 covariates 使用。

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changed
    • addedInput schema / properties / covariate_types
      Added value: +{
      +  "description": "协变量类型 {因素名: \"continuous\"|\"categorical\"},配合 covariates 使用。",
      +  "type": "object"
      +}
    • addedInput schema / properties / covariates
      Added value: +{
      +  "description": "基线协变量 {因素名: [各例取值…]},用于随机后自动做均衡性检验(返回 balance_report)。长度须等于 n_subjects。",
      +  "type": "object"
      +}
    • addedInput schema / properties / factors
      Added value: +{
      +  "description": "最小化法的预后因素及权重 {因素名: 权重},仅 method=minimization 时使用。",
      +  "type": "object"
      +}
    • changedInput schema / properties / groups / description
      Previous value: -"分组名称数组,如 [\"干预组\",\"对照组\"](必须是数组,不是数字)"New value: +"分组名称数组,如 [\"干预组\",\"对照组\"](**必须是数组,不是数字**)。组数由数组长度决定;两组以上会按区组/分层规则分配。"
    • addedInput schema / properties / n_per_stratum
      Added value: +{
      +  "description": "每个层内例数,仅 method=stratified 时使用;不传按 n_subjects/层数 均分。",
      +  "type": "integer"
      +}
    • addedInput schema / properties / strata
      Added value: +{
      +  "description": "分层因素 {因素名: [各水平…]},仅 method=stratified 时使用,如 {\"中心\": [\"A\",\"B\"], \"分期\": [\"I\",\"II\"]}。",
      +  "type": "object"
      +}
  2. Added

TDQS

A3.5/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true, destructiveHint=false, and openWorldHint=false, so the safety profile is covered and the description does not contradict it. The description adds a genuinely useful behavioral point — that a fixed seed makes output reproducible — but says nothing about validation failures, what happens with mismatched covariate lengths, or the shape of the returned table beyond '分组结果表'.

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?

Structure is front-loaded with a USE WHEN line and a RETURNS line, which is good, but the bulk is a pipe-delimited alias list containing a long Chinese synonym dump that is search-engine bait rather than agent guidance. The title repeats verbatim as the first field, wasting the opening position.

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 ten-parameter tool with nested objects, 100% schema coverage carries most of the load, and the description correctly signals the design families and the seed requirement. However, it omits the balance_report side-effect that the schema mentions for covariates and gives no indication of output structure despite there being no output schema.

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 ten parameters including nested objects (strata, factors, covariates, covariate_types) are already documented in the schema. The description only echoes method names and the seed concept, adding no format or interaction details beyond what the schema states; baseline 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 concrete verb+resource ('produce a reproducible randomization list') and enumerates the four supported designs (simple, block, stratified, minimization), which is far more specific than the title alone. It stops short of distinguishing this from the sibling 'animal_randomization', so an agent cannot fully resolve the overlap from the description alone.

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?

The 'USE WHEN' clause gives an explicit trigger condition ('produce a reproducible randomization list... with a fixed seed'), which is clear positive guidance. There is no when-not guidance and no named alternative for the adjacently-named 'animal_randomization' sibling, so selection is not fully disambiguated.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources