Skip to main content
Glama

调用计量

metering.record

记录或查询跨 Agent 任务的用量计量,用于跨 Agent 任务结算/分账。mode=record 时写入一条计量(参数:actor 执行方、metric 指标名、units 用量数);mode=query 时按 actor 聚合查询累计用量(返回 total_units 与 by_metric 分组)。当多 Agent 协作需要计量各方资源消耗、或做任务结算/分账时使用。Example: {"mode":"record","actor":"agent-a","metric":"tokens","units":1200}

Input Schema

NameRequiredDescriptionDefault
modeYesrecord=写入计量;query=查询聚合用量
actorYes执行方标识(Agent 名/ID/角色)
unitsNo用量数(record 时用,必须为数字)
metricNo计量指标名,如 tokens、calls、duration_ms(record 时用)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A3.9/5.0
Behavior4/5

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

Annotations already declare the mutation profile (readOnlyHint=false, destructiveHint=false, idempotentHint=false), and the description adds useful context beyond them: mode=record writes one record, mode=query aggregates and returns total_units plus by_metric grouping. It stops short of saying what happens to duplicate records or whether the write is reversible.

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?

Purpose is front-loaded, followed by a compact mode-by-mode breakdown and the usage condition. The trailing Example mostly repeats the schema's examples block, which is the one redundant sentence.

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

Completeness4/5

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

For a four-parameter, fully schema-documented tool with no output schema, the description covers the write payload and the query return shape. Only the aggregation semantics (per-actor totals, by_metric units) and record duplication behavior could be more explicit.

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 four parameters are already documented in the schema, which sets the baseline at 3. The description restates actor/metric/units meanings and maps them to record mode, but adds little syntax or validation detail beyond the schema.

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+resource (记录/查询 用量计量) and clearly splits behavior into the two modes of the single tool. It does not, however, distinguish itself from the closely related settlement.ledger / settlement.account / audit.record siblings named in the tool set.

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?

It gives an explicit usage context: 当多 Agent 协作需要计量各方资源消耗、或做任务结算/分账时使用. That is a usable when-to-use signal, but it names no alternative tool and no exclusion (e.g., when to prefer settlement.ledger for the ledger entry itself).

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.