Planetscale Execute Read Query
planetscale_execute_read_queryFull Description
Execute a read-only SQL query against a PlanetScale database. Write operations are rejected by the database role. This tool creates short-lived credentials and executes the query securely. Queries have a maximum execution time of 50 seconds — if a query exceeds this limit it will be cancelled, so ensure queries are optimized. For Postgres and Neki, this tool uses an ephemeral pg_read_all_data role that does not bypass row-level security (RLS); zero-row or zero-count results on RLS-protected tables may mean rows are hidden by policy, and the response may include warnings when that risk is detected. For Postgres and Neki only: optionally specify postgres_database_name when the user wants to query a non-default database.
Parameters (4 required, 2 optional)
branchstringBranch name (e.g., 'main')
databasestringDatabase name
organizationstringPlanetScale organization name
querystringRead-only SQL query to execute
postgres_database_namestringPostgres and Neki only: target database name to connect to. Use when the user has created additional databases in the same cluster (e.g. via CREATE DATABASE). Omit to use the default database for the branch.
use_replicabooleanRoute read queries to a read replica when the branch has replicas. Defaults to true. Set false to force the primary.