Is there a "read-only" mode for SQLTools

Hi,

I’m using SQLTools for my agent. It works great, but I want to make sure the agent can only query data (SELECT) and not change anything (like INSERT, UPDATE, or DELETE).

Does the toolkit have a built-in setting to force read-only access? If not, what’s the best way to customize it so the agent can’t accidentally update/wipe my database? I am using mysql database and agno v2.2.13.

Thanks!

Hi @ank, thank you again for reaching out. I’ve shared this with the team, we’re working through all queries one by one and will get back to you soon. If it’s urgent, please let us know. We appreciate your patience!

@yuvi Any updates on this? Thank you

Hey! Thanks for raising this , great question.

At the moment, SQLTools toolkit doesn’t provide a built-in read-only mode. The best workaround is to combine a couple of approaches:

  1. Add strict instructions to the agent

    • e.g., “Only run SELECT queries do not modify data.”

    • This prevents most accidental writes but isn’t fully enforceable.

  2. Extend the base SQLTools class

    • You can create a custom ReadOnlySQLTools that validates queries before execution.

    • For example, reject anything that isn’t a SELECT (e.g., contains INSERT, UPDATE, DELETE, ALTER, etc.).

We can also extend the Base class - however it may take us some time to implement unless you want to take it up. Let me know if it was helpful