Skip to main content
Glama

UK Data: Code utilities

count_bits

Read-onlyIdempotent

Counts the number of set bits (1's) in the binary representation of a non-negative integer. (cost: 1 credit)

Input Schema

NameRequiredDescriptionDefault
numNointeger, required, the non-negative integer to analyze

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.6/5.0
Behavior4/5

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

Annotations already declare readOnly, idempotent, non-destructive behavior, so the safety profile is covered. The description adds information that is nowhere in the structured fields: the operation costs 1 credit, which matters for an agent deciding whether to call it. It also confirms the domain restriction (non-negative input), reducing error risk.

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?

Two short sentences, front-loaded with the operation and resource, with the cost note parenthetically appended. Nothing is redundant or padding.

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?

This is a simple, single-parameter pure function, and the description plus schema fully specify how to call it. The only omission is the return type (the bit count as an integer), which is obvious from the tool's name and there is no output schema to compensate, but the gap is minor for an operation this elementary.

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%, and the single 'num' parameter is already documented as a required non-negative integer. The description restates the non-negative constraint but adds no format, range, or edge-case detail (e.g. behavior for zero, or maximum bit width) beyond the schema. Baseline 3 applies when the schema carries the parameter semantics.

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 names a specific verb (counts) and a precise resource (set bits / 1's in the binary representation), removing any ambiguity about what the tool returns. It does not explicitly distinguish itself from nearby computational siblings like is_power_of_two or binary_addition, but the operation is distinct enough that an agent can select it without opening the schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no guidance on when to prefer this tool over alternatives (e.g. binary_addition, is_power_of_two, or a general 'calculate' tool), and no when-not-to-use conditions. The only usage constraint is implicit in the domain restriction to non-negative integers, which is also in the schema.

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