Skip to main content
Glama

find_free_id

Scans a table's numeric id column up to a set range and returns the lowest unused value, so a new row can be inserted without a database sequence.

Instructions

Find a free id for a new row: scans 1..maxRange (default 1000, capped at 10000) and returns the lowest value not already used, so a key can be inserted without a sequence.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tableYesTable name.
columnYesNumeric id column to search for a free value.
schemaNoSchema (owner) of the table. Optional — defaults to the server's current schema; omit rather than guess.
maxRangeNoInclusive upper bound of the search window. Defaults to 1000; capped at 10000.
excludeTableNoOptional second table (same schema, same column) whose ids must also be avoided.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.16.3

TDQS

A3.7/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 burden and does well: it discloses the scan algorithm (1..maxRange), the default (1000), the cap (10000), and the return semantics (lowest unused value). It omits caveats about performance on large scans or concurrency races between find and insert, so it is not exhaustive.

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 sentence that front-loads the action and packs the range, default, cap, and return value without wasted words. Dense but readable; slightly long for one sentence but every clause earns its place.

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 5-parameter tool with no annotations and no output schema, the description explains the mechanism and the returned value adequately. It could say more about failure cases (no free id within range) or concurrency, but an agent has enough to call it 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 description coverage is 100%, so all five parameters are already documented in the schema. The description restates maxRange's default and cap but adds no new semantics for table, column, schema, or excludeTable. Baseline 3 applies when the schema does the heavy lifting.

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 verb+resource ('find a free id for a new row') and clarifies the mechanism: scanning a range and returning the lowest unused value. This is distinguishable from the sibling get_next_sequence_value since the description explicitly frames it as an alternative 'without a sequence'. It stops just short of naming the sibling outright.

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 'so a key can be inserted without a sequence' implies when to use it (when no sequence exists), but there is no explicit when-not guidance or named alternative. The condition is suggested rather than stated.

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