Skip to main content
Glama

UK Data: Code utilities

binary_search

Read-onlyIdempotent

Performs binary search on a sorted list to find the index of a target value, returning -1 if not found. (cost: 1 credit)

Input Schema

NameRequiredDescriptionDefault
arrNoarray of numbers, required, the sorted list to search
targetNonumber, required, the value to find

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.8/5.0
Behavior4/5

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

Annotations already declare readOnly, idempotent and non-destructive, so the safety profile is covered. The description adds genuinely useful behavior not in the structured fields: the return value (the index) and the not-found sentinel of -1, plus a credit cost. It omits edge behavior such as duplicate handling or what happens on unsorted input.

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 tight sentences with no filler: the core action and return contract come first, and the credit cost is appended compactly. Nothing should be cut.

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?

With no output schema, the description correctly carries the return-value contract (index or -1), which is the most important thing an agent needs. Remaining gaps are minor: sort direction, duplicate handling, and behavior on unsorted input.

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 100% with both parameters described, so the baseline of 3 applies. The description reinforces that the array must be sorted (a constraint the schema description also mentions) but adds no further semantics on types or ordering.

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?

Names a specific verb (performs binary search) and resource (sorted list), and states the outcome (index of target, -1 if absent). It is distinguishable from most siblings, though it never contrasts itself with adjacent algorithm tools like find_kth_smallest or sort_numbers.

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 phrase 'sorted list' implicitly gives the key precondition for use, but there is no explicit when-to-use/when-not guidance and no pointer to alternatives such as sort_numbers for unsorted input. Adequate but leaves inference to the agent.

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