Skip to main content
Glama

engine_db_execute

Run a pool of database steps in a single connection to preserve temporary tables and LAST_INSERT_ID across them. Use for sequences that depend on connection state.

Instructions

Run a pool of steps in ONE database connection, which is the only way a temporary table or LAST_INSERT_ID survives between them. Steps: lock (our table registry, not the DBMS), unlock, generate (id from the generator), select, modify (any sql), insert (table + rows as one multi-row INSERT of at most 65535 values, rows times columns - more rows go as several inserts), change (mark tables so the storefront cache refreshes). Trees (topic, info and any table with tindex/tlevel/absindex) are shaped ONLY by the tree steps - never by raw sql: tree_add (table, parent_id; 0 = top level; answers the new id), tree_move (table, id, parent_id), tree_up / tree_down (table, id), tree_remove (table, id; deletes the whole subtree). A tree step rebuilds the indexes and marks its table itself; the new row is bare, so set its fields with a following modify by the lent id. A new topic or info node is visible to the admin only until you insert its rights rows. Before a delete ask dependent (table, and ids when you have them): what hangs on that table and, with ids, how many rows point at them. After deletions run clear_dependent (table): it sweeps the rows left pointing nowhere and names the busy tables it skipped. Values go in params: :NAME in the sql, upper case, the value under that name in params. A named step lends its value to the next ones as @name, in params too. Nothing is guessed: tables you touched with raw sql are refreshed only by the change step, so put it in. A failed step stops the pool and the answer says which one and why; whatever the pool locked it releases itself. Announce data changes to the owner first, and ask whether to take the tables into work (a lock step) for the time of the change - do not decide that alone. Keep the locked stretch short: read and compute before the pool, not inside it. A pool too big to write out is built by a script and given as pool_file instead of pool.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
poolNo
pool_fileNoPath on this machine, absolute or off the store folder, to a json file holding the pool - the same list of steps; instead of pool.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv6.5.1

TDQS

A4.8/5.0
Behavior5/5

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

With no annotations, the description carries the full burden, and it delivers: connection semantics, insert value limits, cache refresh via change, lock release on failure, admin visibility of new nodes, tree index rebuilding, and dependent sweeping behavior. It even warns about announcing data changes to the owner and keeping locks short.

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?

The description is dense and every sentence carries useful information, but it is a long single block that could be better organized with step categories or formatting. Still, nothing is filler, and the core purpose is front-loaded.

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?

It is remarkably complete for a complex tool: step types, parameter binding, failure behavior, locking, dependent handling, and pool_file are all covered. The main gaps are the exact JSON shape of each step object and the overall success return value, since no output schema exists.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema only defines pool as an array of objects and pool_file as a string. The description adds real meaning: pool is a list of named steps, values are bound via :NAME and @name, pool_file holds the same step list as a JSON file, and it details the step vocabulary with their arguments.

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 names a specific verb and resource: it runs a pool of steps in one database connection. It enumerates the step types and distinguishes the tool from simple DB operations like engine_db_select, making its scope unmistakable.

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

Usage Guidelines5/5

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

It gives explicit when-to-use guidance: this is the only way temporary tables or LAST_INSERT_ID survive between steps. It also tells the agent when not to use raw SQL (tree shaping), what to do before deletions (dependent), after deletions (clear_dependent), and how to handle large pools (pool_file).

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