Skip to main content
Glama

alloc

Reserves Slurm resources and starts a persistent tmux shell on the granted compute node, with automatic GPU-first or CPU fallback selection and active-session checks.

Instructions

抢占资源并直接执行(绝不只返回命令):tmux 内 salloc + srun bash, 分配后 attach 即入计算节点 shell,断线不丢资源。同名 purpose 已有活会话时返回 state="exists"(附 job 与接入/释放指引)——不会静默复用旧会话。

抢占选择自动完成(无需先查询):resource 缺省 = GPU 优先、无空闲 GPU 回退 CPU; resource=gpu / cpu 只抢该类(无则失败并附当前余量摘要); partition 显式指定则直接使用。返回 granted/pending/failed 与 job_id/node。

Args: connection: cluster 连接 label purpose: 会话用途名(如 train-a100),用于 tmux 命名与检索 resource: gpu | cpu;缺省为自动(GPU 优先回退 CPU) gpus: GPU 卡数(默认 1;resource 含 gpu 时生效) cpus: CPU 核数(cpu 资源必给则默认 4;也可与 GPU 同时指定) partition: 显式分区(跳过自动选择) wait: 等待授予秒数(超时会话保留,session_info 随时查)

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "connection": "<connection>"
    },
    "name": "alloc"
  }
}

Input Schema

NameRequiredDescriptionDefault
cpusNo
gpusNo
waitNo
purposeNoalloc
resourceNo
partitionNo
connectionYes

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.7/5.0
Behavior5/5

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

Annotations only declare readOnly=false and destructive=false; the description goes well beyond them by promising the allocation actually executes, that the session survives disconnects, that an existing same-purpose session is never silently reused, and that a timeout leaves the session intact and queryable. It also discloses the return states granted/pending/failed with job_id/node.

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

Conciseness4/5

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

Front-loaded with the single most important constraint ('绝不只返回命令') and organized as behavior followed by per-argument notes. Slightly verbose in the middle section on preemption selection, but no sentence is filler.

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

Completeness5/5

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

An output schema exists, yet the description still summarizes the outcome states and key identifiers, and it covers lifecycle details (survives disconnect, timeout retention, release guidance) an agent needs to act on the result. Nothing material is missing for a 7-parameter allocation tool.

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

Parameters5/5

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

Schema description coverage is 0%, so the description must carry the load, and it does: every one of the 7 parameters is explained, including auto-selection semantics for resource, when gpus applies, cpus defaulting to 4, and partition bypassing auto-selection. This adds meaning well beyond bare types and defaults.

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 plus the exact mechanism ('tmux 内 salloc + srun bash,分配后 attach 即入计算节点 shell'), and explicitly distinguishes itself from tools that merely return a command. An agent can tell this apart from sibling session_start/exec without opening any schema.

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 concrete selection rules: resource defaults to GPU-first with CPU fallback, explicit resource/partition overrides, and the state="exists" behavior when a same-purpose session is live, plus a pointer to session_info for waiting. It lacks an explicit statement of when to prefer session_start over this tool, which keeps it just 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.