Skip to main content

Description

The Run SQL tool allows the execution of custom SQL queries on the database using Prisma’s raw query capabilities. This tool is intended for direct SQL access, enabling agents to retrieve database information as specified in the query.
Status: Under Testing. This tool is in a testing phase, and security measures for error handling and SQL injection prevention are not fully implemented.
Database Connection: Managed by Prisma Client
This tool uses Prisma’s $queryRawUnsafe function to execute SQL queries dynamically.

Arguments

  • query (string): The SQL query to be executed.

Example Configuration

Example Usage

  1. User Query: “Show the last two transactions from the Transaction table.”
  2. Agent Invocation: The agent calls run_sql with a SQL query like:
  1. Response: The tool returns the specified transaction data in descending order by date.

Response Handling

  • Successful Response: If the query executes successfully, the function returns an object with:
    • result: The query results as an array of records.
  • Error Handling: If the query fails, an error message and the original query are returned for debugging.
Example Response