What the agent does
This is for a company that sells class booking and membership software to gyms, yoga studios and climbing walls. A studio signs up for a 14-day trial, and the trials that turn into customers are the ones that do three things early: add a class schedule, connect a payment account, and take a first booking from a real member. The sales team wants a list each Monday of studios in the middle of their trial that have done none or only some of those, with what is missing, so a rep can call while there is still time. The data is in the product's own database on PlanetScale, so the agent reads it there instead of from a CRM that only knows about signups. It connects to PlanetScale's hosted MCP server at https://mcp.pscale.dev/mcp/planetscale, which signs in with OAuth. Connect it once with the API key: POST /me/connections {"type": "mcp", "name": "planetscale", "url": "https://mcp.pscale.dev/mcp/planetscale", "auth": {"mode": "oauth"}}, and on PlanetScale's authorization page give the connection read-only access to the one production database.
The agent calls planetscale_list_databases and planetscale_get_branch_schema for the production branch, so it writes its queries against the tables and columns the database actually has rather than the names in the prompt. Then it runs planetscale_execute_read_query, which accepts only SELECT, SHOW, DESCRIBE and EXPLAIN and goes to a replica by default when the branch has replicas, so the sales list does not load the primary that serves studios.
Its queries find studios whose trial started 5 to 12 days ago and are still on trial, then check, per studio, whether it has any class on its schedule, a connected payment account, and a booking made by someone other than the studio's own staff. It reads the owner's name and email and the last sign-in time, and joins the assigned sales rep from the accounts table. Studios with all three steps done are left out; the rest are grouped by rep, oldest trial first.
For each studio it writes a two-line note for the rep: what is missing and the one thing to offer, such as importing the class schedule for them when no class exists. It sends nothing to the studio. The rep calls or writes from their own inbox.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Trial activation list for the week of 2026-11-23. Use the PlanetScale connection, database 'studio-app', branch 'main', read only. 1) planetscale_get_branch_schema, and map: studios (id, name, plan, trial_started_at, owner name and email, last sign-in, assigned rep), classes, payment accounts, bookings (booked by member or staff). 2) With planetscale_execute_read_query only, find studios on trial whose trial started between 2026-11-11 and 2026-11-18. For each: has_class_schedule, payment_connected, member_booking (a booking not made by staff). Leave out studios with all three. Return Markdown grouped by rep: studio, owner, email, trial day, last sign-in, missing steps, and a two-line note for the rep. Show each SQL query you ran at the end. Never call planetscale_execute_write_query, the Insights Agent tools, or any payment method tool.",
"connections": [
"planetscale"
]
}- Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
- Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions. The run starts in its own cloud sandbox.
- Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.
What comes back
The answer is a Markdown list grouped by sales rep. Each studio has its owner and email, which day of the trial it is on, when someone last signed in, which of the three steps are missing, and a two-line note the rep can work from. The SQL queries the agent ran follow at the end, so an engineer can see exactly how each step was counted.
Before the reps use it, someone who knows the schema reads those queries once: whether a booking made by a staff member testing the app was correctly left out, whether a studio that connected payments and then disconnected counts, and whether trial dates are stored in UTC. Once the queries are right, the prompt can carry them word for word so every week counts the same way. Reps read each note before calling, because a studio that has not signed in for a week may have already chosen another product.
Run it on every Monday morning
Save the prompt as an agent with POST /o/{org}/agents and connections: ["planetscale"], and give it an automation in the console with a schedule trigger, a cron such as 0 8 * * 1 and the sales team's timezone, so the list is waiting at the start of the week; a schedule fills nothing into the prompt, so the saved prompt says "trials that started 12 to 5 days before today" in place of the dates. Automations need Pro or Max. A company whose backend schedules its own jobs sends the request each Monday with the dates filled in and a request_id that is a UUID v5 of the week's start date.
A rep can also start a run for one studio from the admin screen before a call, with that studio's id in the prompt, and read the answer from the session.
The use case this job follows, with its automation and trigger: Produce a report or file, no repo.
Why run it on Rush?
A report like this usually ends up as a SQL script on someone's laptop with a production password, run when someone remembers. On Rush the PlanetScale sign-in stays in Rush's connection with the access chosen on PlanetScale's page, PlanetScale's docs say each query uses short-lived credentials created on demand and deleted after it runs, and nobody keeps a database password for the sales report.
Each Monday's list is a session with every query the agent ran and what came back, so when a rep asks why a studio was on the list, the answer is in the record, beside the run's cost. Runs for different databases or teams start at once in their own computers.
Frequently asked questions
How do we make sure it can never write to production?
Choose read-only access to the database on PlanetScale's authorization page when you connect. An organization administrator can also set MCP query access to read-only queries in the organization's Settings, which PlanetScale applies to new authorizations. The prompt forbids planetscale_execute_write_query as a third layer.
Will the queries slow down the app for our studios?
PlanetScale's docs say read queries go to a replica by default when the branch has replicas configured. Without replicas they run on the primary, so keep the queries narrow: the prompt asks only for studios in a one-week signup window.
We restrict database connections by IP. Does this still work?
PlanetScale's docs say queries from the hosted MCP server leave from four dedicated IP addresses, listed on its MCP page. Add those to the database's allowlist; the queries do not come from Rush's sandbox.
Can the agent email the studios itself?
Not in this setup. It writes notes for the reps and sends nothing. A company that wants drafts in a rep's mailbox can add a Gmail or Outlook connection to the saved agent, and the rep still sends each one.
More PlanetScale jobs
- Which Queries Got Slower This Month? A Database Consultancy's PlanetScale Review for Each Client
- Which Client Does Each Line of Our PlanetScale Invoice Belong To? A Software Agency's Monthly Rebilling Split
- How Many Subscribers Did We Gain and Lose This Week? A Meal-Kit Company's Monday Report From PlanetScale