Skip to content

Built-in Tool: Database

Document ID: TRT-103
File Path: docs/07-tool-runtime/database.md
Version: 1.0.0
Status: Draft
Owner: AI Platform Team
Last Updated: 2026-06-27


The db.* built-in tools let agents query external databases through governed, scoped connections — never with ambient credentials. Credentials are resolved from the secret vault and injected at run time.


ToolDescription
db.queryRun a read query, return rows
db.executeRun a write/DDL statement (guarded)
db.schemaIntrospect tables/columns

// input
{ "connection": "secret://acme/reporting-db", "sql": "SELECT * FROM orders WHERE id = $1", "params": ["123"], "max_rows": 1000 }
// output
{ "columns": ["id","state"], "rows": [["123","shipped"]], "row_count": 1 }

connection is a secret reference, not a raw DSN.


secret:read:<connection-ref> net:egress:<db-host>
db:query | db:execute (write requires db:execute)

Writes (db.execute) require an explicit, higher-privilege grant; many deployments restrict agents to read-only.


  • Parameterized queries are required; raw string interpolation is rejected to prevent injection.
  • Egress allowed only to the granted DB host (network isolation).
  • max_rows/timeout bound result size and duration.
  • Credentials injected in-memory, zeroed on teardown (secrets).

db.query is read-only and may be cached briefly for identical (connection+sql+params); db.execute is side-effecting and never cached.


Terminal window
wovyr tools invoke db.query --input '{"connection":"secret://acme/reporting-db","sql":"SELECT count(*) FROM users","params":[]}'


VersionDateDescription
1.0.02026-06-27Initial Database tool spec