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.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"table": "<table>",
"column": "<column>"
},
"name": "find_free_id"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| table | Yes | Table name. | |
| column | Yes | Numeric id column to search for a free value. | |
| schema | No | Schema (owner) of the table. Optional — defaults to the server's current schema; omit rather than guess. | |
| maxRange | No | Inclusive upper bound of the search window. Defaults to 1000; capped at 10000. | |
| excludeTable | No | Optional second table (same schema, same column) whose ids must also be avoided. |