Skip to main content
Glama

Agent Billing Primitives (Dirtsmith)

agent_semaphore

agent_semaphore

Counting semaphore / concurrency limit for AI agents: at most N agents hold a slot at once (rate limit parallel workers), TTL permits with fencing tokens, auto-expire on crash. Idempotent, shared by namespace. Every call requires a tiny solved packet (returned in the reply, 2 s, one try); free first call, no API key (GET /try?tool=agent_semaphore).

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": {
      "namespace": "<namespace>",
      "semaphore": "<semaphore>",
      "action": "<action>",
      "idempotency_key": "<idempotency_key>"
    },
    "name": "agent_semaphore"
  }
}

Input Schema

NameRequiredDescriptionDefault
ttl_sNo
actionYes
sourceNo
caller_idNodemo_caller
holder_idNo
max_slotsNo
namespaceYes
permit_idNo
semaphoreYes
idempotency_keyYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

B3.3/5.0
Behavior4/5

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

With no annotations, the description carries the full disclosure burden and does so unusually well: it reveals TTL-based permits with fencing tokens, auto-expiry on crash, idempotency, namespace-level sharing, and a mandatory solved-packet gate (2 s, one try, free first call, no API key). It omits the call-level behavior an agent most needs — whether an acquire blocks or fails immediately when slots are exhausted, and how to interpret the returned packet — which keeps it below a 5.

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?

A single dense paragraph that front-loads the core mechanism and deduplicates nothing, with no filler sentences. The trailing onboarding detail ('free first call, no API key (GET /try?...)') is slightly promotional but still actionable for a first-time caller.

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?

For a 10-parameter, unannotated, no-output-schema tool with three distinct actions, the description is materially incomplete: an agent knows what the tool models but not how to drive acquire vs release vs status, which fields are conditional on action, or what a call returns. The onboarding packet requirement is covered, but the operational contract is not.

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

Parameters2/5

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

Schema description coverage is 0% across 10 parameters, so the description must compensate and largely does not. It only loosely gestures at max_slots ('at most N'), ttl_s ('TTL permits'), namespace ('shared by namespace'), and permit_id ('fencing tokens'), leaving action enum values, holder_id, caller_id, source, and idempotency_key entirely unexplained in both schema and prose.

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?

States a specific resource and mechanism: a counting semaphore where 'at most N agents hold a slot at once', plus TTL permits and auto-expiry. This is enough to distinguish it from a mutex-style sibling like agent_lease_lock, but the description never names or contrasts the siblings explicitly, so the differentiation is inferential rather than stated.

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 parenthetical '(rate limit parallel workers)' implies the intended use case, and 'shared by namespace' hints at multi-agent coordination scope. There is no explicit when-to-use/when-not guidance, no mention of what to do when the semaphore is full, and no routing to agent_lease_lock for simple mutual exclusion.

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.