Skip to main content
Glama
rlawogh1005

green-mcp

by rlawogh1005

measure_tokens

Measure LLM token consumption of any program by routing its API calls through a non-blocking token-counting proxy, reporting input/output/total tokens and call count.

Instructions

Measure how many LLM tokens a program consumes when it runs (works on any machine — no special hardware). The program must read base_url_env for its LLM endpoint (most SDKs do); we point that at a non-blocking counting proxy forwarding to upstream, run the program, and report real provider usage (input/output/total tokens, call count). For a non-Anthropic target, pass its provider's base-url env var and upstream (e.g. OPENAI_BASE_URL, https://api.openai.com). If llm_calls is 0, the target didn't route through base_url_env.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commandYes
upstreamNohttps://api.anthropic.com
base_url_envNoANTHROPIC_BASE_URL
Behavior5/5

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

With no annotations, the description fully reveals internal behavior: it sets up a non-blocking counting proxy, runs the program, and reports usage. It also explains the consequence of zero llm_calls and the env var dependency.

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?

The description is a single paragraph of about 100 words, efficiently covering purpose, mechanism, usage tips, and edge cases without redundancy.

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?

Given no output schema, the description explains what will be reported (input/output/total tokens, call count) and addresses the zero-call scenario. It covers all necessary aspects for an agent to use the tool correctly.

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 coverage is 0%, but the description adds meaning to 'base_url_env' and 'upstream' by explaining their roles in the proxy mechanism. 'command' is implied but not detailed. Partially compensates for low schema coverage.

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?

The description clearly states the specific verb 'measure' and the resource 'LLM tokens consumed by a program'. It differentiates from sibling tools like measure_energy by focusing on tokens and mentions the proxy-based method.

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?

Provides context on when to use: for measuring token consumption of programs that read an LLM endpoint from an environment variable. Gives guidance for different providers and explains the zero-call edge case. However, does not explicitly state when not to use or list alternatives.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/rlawogh1005/green-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server