Skip to content

db

Run SQL against an App's SQLite database (/data/app.db) and print the rows.

The tool of basemodo db, on the local MCP and the remote one. It changes things, so an agent's client may ask you before it runs.

Every App has a SQLite file at /data/app.db on its volume ($BASEMODO_DB in its processes), made by whatever opens it first. Several statements run in order and stop at the first error; what ran before it stays done. The rows are those of the last statement that returned any. A sleeping App is woken to run it. In a terminal the SQL may come on stdin. A control character in a value (an escape, a carriage return) prints as \x1b or \x0d, so a row cannot drive your terminal; --json keeps every value exact.

Arguments

  • sql (text): The SQL to run; - or nothing reads it from stdin.
  • app (text): The App whose database to use. Default: the one named after the current folder.

On the remote MCP

  • app is required on the remote MCP, which has no folder of yours to find the App from.

Answer

It answers {"columns": [...], "rows": [[...], ...]}, empty for statements that return no rows. SQL that fails is an error with code sql_error and SQLite's message.