> **Building with AI coding agents?** Install the authstack plugin with one command. This equips your agent with accurate Scalekit implementation patterns.
>
> **Recommended** (the `-y` flags skip prompts, so the command runs without an interactive terminal):
> ```bash
> npx -y @scalekit-inc/cli setup -y
> ```
>
> Global:
> ```bash
> npm install -g @scalekit-inc/cli
> scalekit setup -y
> ```
>
> Supports Claude Code, Cursor, GitHub Copilot, Codex + skills for other Agent Skills-compatible agents in `~/.agents/skills`.
> Skills: integrate-agentkit, implement-saaskit, add-mcp-oauth, implement-sso, implement-scim.
> [Full setup guide](https://docs.scalekit.com/dev-kit/build-with-ai/)

---

# Connect AI agents to the Planet Scale MCP server

The Planet Scale MCP connector routes your AI agent's tool calls to Planet Scale's own MCP server through Scalekit. Each user signs in to Planet Scale once, and Scalekit stores and refreshes their tokens, so your agent never handles credentials. It comes with 26 tools.

**Authentication:** OAuth 2.1/DCR
**Categories:** Databases, Developer Tools, AI
**Tools:** 26: 15 read, 10 write, 1 destructive
**Users sign in with:** OAuth
**OAuth app:** Scalekit's or your own
**Built by:** Vendor MCP
**Try it:** [Playground in the Scalekit dashboard](https://app.scalekit.com/ws/signup?sk_intent=playground&provider=PLANETSCALEMCP)

## Setup

1. ### Install the SDK

   **Node.js**

   ```bash
   npm install @scalekit-sdk/node dotenv
   ```

   **Python**

   ```bash
   pip install scalekit-sdk-python python-dotenv
   ```

2. ### Set your credentials

   Add your Scalekit credentials to your `.env` file. Find values in **[app.scalekit.com](https://app.scalekit.com)** > **Developers** > **API Credentials**.

   ```sh title=".env"
   SCALEKIT_ENVIRONMENT_URL=<your-environment-url>
   SCALEKIT_CLIENT_ID=<your-client-id>
   SCALEKIT_CLIENT_SECRET=<your-client-secret>
   ```

3. ### Create the Planet Scale MCP connection

   In **AgentKit > Connections**, create a Planet Scale MCP connection. The name you give it is the `connection_name` your code passes. See [Configure connections](/agentkit/connections/).

   Scalekit credentials are available for Planet Scale MCP server, so you don't need to register an OAuth app.

4. ### Authorize a user and make your first call

   **Node.js** (`quickstart.mts`)

   ```typescript
   import { ScalekitClient } from '@scalekit-sdk/node'
   import 'dotenv/config'
   import { createInterface } from 'node:readline/promises'

   const scalekit = new ScalekitClient(
     process.env.SCALEKIT_ENVIRONMENT_URL,
     process.env.SCALEKIT_CLIENT_ID,
     process.env.SCALEKIT_CLIENT_SECRET,
   )
   const actions = scalekit.actions

   const connector = 'planetscalemcp'
   const identifier = 'user_123'

   // Generate an authorization link for the user
   const { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })
   console.log('Authorize Planet Scale MCP:', link)
   const rl = createInterface({ input: process.stdin, output: process.stdout })
   await rl.question('Press Enter after authorizing...')
   rl.close()

   // Make your first call
   const result = await actions.executeTool({
     connector,
     identifier,
     toolName: 'planetscalemcp_planetscale_list_organizations',
     toolInput: {},
   })
   console.log(result)
   ```

   ```bash
   npx tsx quickstart.mts
   ```

   **Python** (`quickstart.py`)

   ```python
   import os
   from scalekit import ScalekitClient
   from dotenv import load_dotenv
   load_dotenv()

   scalekit_client = ScalekitClient(
       env_url=os.getenv("SCALEKIT_ENVIRONMENT_URL"),
       client_id=os.getenv("SCALEKIT_CLIENT_ID"),
       client_secret=os.getenv("SCALEKIT_CLIENT_SECRET"),
   )
   actions = scalekit_client.actions

   connection_name = "planetscalemcp"
   identifier = "user_123"

   # Generate an authorization link for the user
   link_response = actions.get_authorization_link(
       connection_name=connection_name,
       identifier=identifier,
   )
   print("Authorize Planet Scale MCP:", link_response.link)
   input("Press Enter after authorizing...")

   # Make your first call
   result = actions.execute_tool(
       tool_input={},
       tool_name="planetscalemcp_planetscale_list_organizations",
       connection_name=connection_name,
       identifier=identifier,
   )
   print(result)
   ```

   ```bash
   python quickstart.py
   ```

   Each user signs in once. See [Authorize a user](/agentkit/tools/authorize/) for the full flow and statuses.

## Tools

Pass the exact name to `execute_tool`, with an input like each tool's example. To ask for a tool that's missing, use the [request form](https://scalekitsupport.portal.usepylon.com/forms/request-a-connector-tool).

**Node.js**

```typescript
const result = await actions.executeTool({
  toolName: 'planetscalemcp_planetscale_execute_read_query',
  toolInput: {
    branch: 'main',
    database: '<database>',
    organization: '<organization>',
    query: 'checkpoint',
  },
  connector: 'planetscalemcp',
  identifier: 'user_123',
})
```

**Python**

```python
result = actions.execute_tool(
    tool_name="planetscalemcp_planetscale_execute_read_query",
    tool_input={
        "branch": "main",
        "database": "<database>",
        "organization": "<organization>",
        "query": "checkpoint",
    },
    connection_name="planetscalemcp",
    identifier="user_123",
)
```

`result.data` is the app's response as JSON, and `result.execution_id` (`executionId` in Node.js) is the ID of the call.

### `planetscalemcp_planetscale_execute_read_query`

Planetscale Execute Read Query · Read-only

Execute a read-only SQL query (SELECT, SHOW, DESCRIBE, EXPLAIN) against a PlanetScale database branch.

Read only: yes. Destructive: no. Idempotent (safe to retry): no.

Inputs:

- `branch` (`string`, required): Branch name (e.g., 'main')
- `database` (`string`, required): Database name
- `organization` (`string`, required): PlanetScale organization name
- `query` (`string`, required): SQL SELECT query to execute
- `postgres_database_name` (`string`, optional): Postgres only: target database name to connect to. Use when the user has created additional databases in the same PlanetScale Postgres cluster (e.g. via CREATE DATABASE). Omit to use the default database for the branch.
- `use_replica` (`boolean`, optional): Route read queries to a read replica when the branch has replicas. Defaults to true. Set false to force the primary.

Example input: `{"branch":"main","database":"<database>","organization":"<organization>","query":"checkpoint"}`

### `planetscalemcp_planetscale_get_branch`

Planetscale Get Branch · Read-only

Get details about a specific database branch.

Read only: yes. Destructive: no. Idempotent (safe to retry): yes.

Inputs:

- `pathParameters` (`object`, required): No description.

Example input: `{"pathParameters":{}}`

### `planetscalemcp_planetscale_get_branch_schema`

Planetscale Get Branch Schema · Read-only

Get the schema (tables and columns) for a specific database branch.

Read only: yes. Destructive: no. Idempotent (safe to retry): yes.

Inputs:

- `pathParameters` (`object`, required): No description.
- `queryParameters` (`object`, optional): No description.

Example input: `{"pathParameters":{}}`

### `planetscalemcp_planetscale_get_database`

Planetscale Get Database · Read-only

Get details about a specific PlanetScale database.

Read only: yes. Destructive: no. Idempotent (safe to retry): yes.

Inputs:

- `pathParameters` (`object`, required): No description.

Example input: `{"pathParameters":{}}`

### `planetscalemcp_planetscale_get_insights`

Planetscale Get Insights · Read-only

Get query performance insights for a PlanetScale database branch, including top queries aggregated over a time period.

Read only: yes. Destructive: no. Idempotent (safe to retry): no.

Inputs:

- `branch` (`string`, required): Branch name (e.g., 'main')
- `database` (`string`, required): Database name
- `organization` (`string`, required): PlanetScale organization name
- `fields` (`array`, optional): Request specific metric fields from the API (e.g. ['query', 'count', 'percentTime', 'totalTime', 'cpuTime', 'p50Latency', 'rowsRead', 'rowsReadPerQuery', 'rowsAffected', 'egressBytes', 'egressBytesPerQuery', 'maxEgressBytes', 'ingressBytes', 'ingressBytesPerQuery', 'maxIngressBytes', 'indexes', 'maxShardQueries']). 'cpuTime' is Postgres/Neki-only; 'maxEgressBytes' and ingress* are MySQL/Vitess-only. Ignored when fingerprint is provided.
- `fingerprint` (`string`, optional): Query fingerprint hash to drill down into a specific query pattern. Use the `fingerprint` value from an initial insights call. Always include `keyspace` (also from the initial results) to get summary data.
- `from` (`string`, optional): Start of time range (ISO 8601 format). Defaults to 24 hours ago. A range wider than 25 hours must start on the hour (e.g. '2026-08-19T00:00:00Z') and span at most 365 days; a wide range that is not hour-aligned is rejected, not narrowed. Supported in both discovery and fingerprint modes, though in fingerprint mode only the summary honours a wide range.
- `keyspace` (`string`, optional): Keyspace for fingerprint drill-down. Required to get summary data. Use the `keyspace` value returned in insights results (e.g. 'my_keyspace' for MySQL/Vitess or 'postgres.public' for Postgres/Neki databases).
- `limit` (`number`, optional): Number of results per metric (default: 5, max: 20)
- `period` (`string`, optional): Shorthand for a recent time window ending at now. Cannot be combined with from/to — use one or the other. Only supported in discovery mode (ignored in fingerprint mode — use from/to instead). One of: `15m`, `1h`, `3h`, `6h`, `12h`, `1d`, `2d`, `7d`, `8d`.
- `query` (`string`, optional): Filter insights by search query. Supports plain text matching and structured filters: exact match with quotes ("select count"), statement_type:select|delete|update|insert, table:table_name, keyspace:keyspace_name, table_keyspace:keyspace_name, tag:tag_key:tag_value for queries carrying that tag with that value, tag:tag_key on its own for queries carrying the tag whatever its value (including ones whose value went unrecorded), where tag_key is the bare tag name without the 'S'/'B' prefix `list_query_tags` reports and a value containing spaces or colons needs quoting (tag:route:"GET /horses"), index:index_name or index:table.index_name, indexed:true|false, multishard:true|false, query_count:>N or query_count:<N, p99:>N or p50:<N (ms), max_latency:>N (ms). Any term can be negated by an immediately preceding '!' (!tag:app:web). Ignored when fingerprint is provided.
- `sort_by` (`string`, optional): Sort order: 'all' (default) aggregates curated API calls for a comprehensive view, or specify a single metric: 'count', 'percentTime', 'totalTime', 'cpuTime', 'p50Latency', 'p99Latency', 'rowsRead', 'rowsReadPerQuery', 'rowsReadPerReturned', 'rowsAffected', 'egressBytes', 'egressBytesPerQuery', 'maxEgressBytes', 'ingressBytes', 'ingressBytesPerQuery', 'maxIngressBytes'. 'cpuTime' is Postgres/Neki-only; 'maxEgressBytes' and ingress* are MySQL/Vitess-only. Ignored when fingerprint is provided. One of: `all`, `count`, `percentTime`, `totalTime`, `cpuTime`, `p50Latency`, `p99Latency`, `rowsRead`, `rowsReadPerQuery`, `rowsReadPerReturned`, `rowsAffected`, `egressBytes`, `egressBytesPerQuery`, `maxEgressBytes`, `ingressBytes`, `ingressBytesPerQuery`, `maxIngressBytes`.
- `tablet_type` (`string`, optional): Filter by tablet type: 'primary' or 'replica'. One of: `primary`, `replica`.
- `to` (`string`, optional): End of time range (ISO 8601 format). Defaults to now. For a range wider than 25 hours it must land on an hour boundary -- either the top of an hour or its last second ('T13:00:00Z' or 'T12:59:59Z') -- so the simplest way to ask for a wide window is to omit it, which covers everything through the current hour. Supported in both discovery and fingerprint modes.

Example input: `{"branch":"main","database":"<database>","organization":"<organization>"}`

### `planetscalemcp_planetscale_get_invoice_line_items`

Planetscale Get Invoice Line Items · Read-only

Get all line items for a specific invoice, broken down by database branch costs.

Read only: yes. Destructive: no. Idempotent (safe to retry): no.

Inputs:

- `pathParameters` (`object`, required): No description.
- `queryParameters` (`object`, optional): No description.

Example input: `{"pathParameters":{}}`

### `planetscalemcp_planetscale_get_organization`

Planetscale Get Organization · Read-only

Get details about a specific PlanetScale organization.

Read only: yes. Destructive: no. Idempotent (safe to retry): yes.

Inputs:

- `pathParameters` (`object`, required): No description.

Example input: `{"pathParameters":{}}`

### `planetscalemcp_planetscale_list_branches`

Planetscale List Branches · Read-only

List all branches within a PlanetScale database.

Read only: yes. Destructive: no. Idempotent (safe to retry): yes.

Inputs:

- `pathParameters` (`object`, required): No description.
- `queryParameters` (`object`, optional): No description.

Example input: `{"pathParameters":{}}`

### `planetscalemcp_planetscale_list_cluster_sizes`

Planetscale List Cluster Sizes · Read-only

List available PlanetScale cluster sizes (SKUs) for an organization.

Read only: yes. Destructive: no. Idempotent (safe to retry): yes.

Inputs:

- `organization` (`string`, required): PlanetScale organization name
- `engine` (`string`, optional): Database engine to list SKUs for (default: mysql). One of: `mysql`, `postgresql`, `neki`.
- `type` (`string`, optional): Filter to only autoscaling (PS-*, network-backed) or metal (M-*, local storage) sizes. One of: `autoscaling`, `metal`.

Example input: `{"organization":"<organization>"}`

### `planetscalemcp_planetscale_list_databases`

Planetscale List Databases · Read-only

List all databases within a PlanetScale organization.

Read only: yes. Destructive: no. Idempotent (safe to retry): yes.

Inputs:

- `pathParameters` (`object`, required): No description.
- `queryParameters` (`object`, optional): No description.

Example input: `{"pathParameters":{}}`

### `planetscalemcp_planetscale_list_invoices`

Planetscale List Invoices · Read-only

List all invoices for a PlanetScale organization.

Read only: yes. Destructive: no. Idempotent (safe to retry): no.

Inputs:

- `pathParameters` (`object`, required): No description.
- `queryParameters` (`object`, optional): No description.

Example input: `{"pathParameters":{}}`

### `planetscalemcp_planetscale_list_organizations`

Planetscale List Organizations · Read-only

List all PlanetScale organizations you have access to.

Read only: yes. Destructive: no. Idempotent (safe to retry): yes.

Inputs:

- `queryParameters` (`object`, optional): No description.

Example input: `{}`

### `planetscalemcp_planetscale_list_regions_for_organization`

Planetscale List Regions For Organization · Read-only

List the regions available for a PlanetScale organization.

Read only: yes. Destructive: no. Idempotent (safe to retry): no.

Inputs:

- `pathParameters` (`object`, required): No description.
- `queryParameters` (`object`, optional): No description.

Example input: `{"pathParameters":{}}`

### `planetscalemcp_planetscale_list_schema_recommendations`

Planetscale List Schema Recommendations · Read-only

List all schema recommendations for a PlanetScale database based on production query patterns.

Read only: yes. Destructive: no. Idempotent (safe to retry): no.

Inputs:

- `pathParameters` (`object`, required): No description.
- `queryParameters` (`object`, optional): No description.

Example input: `{"pathParameters":{}}`

### `planetscalemcp_planetscale_search_documentation`

Planetscale Search Documentation · Read-only

Search the PlanetScale knowledge base for documentation, API references, code examples, and guides.

Read only: yes. Destructive: no. Idempotent (safe to retry): no.

Inputs:

- `query` (`string`, required): Search query for PlanetScale docs and blog posts

Example input: `{"query":"checkpoint"}`

### `planetscalemcp_planetscale_get_branch_metrics`

Planetscale Get Branch Metrics · Write

Get infrastructure metrics for a PlanetScale branch: CPU, memory, disk, replication lag, connections, PgBouncer, WAL, VTGate, and tablet health. The database kind selects the endpoint. Vitess uses tablet metrics; Postgres and Neki use branch metrics. view summary (the default) returns latest, min, avg, and max for a small health set plus current disk and connection values, without raw samples. Pod memory utilization includes page cache, so the summary also returns RSS and cache bytes. Vitess shard_storage_usage is percent full, not bytes. Use view series or instant and pass metrics to drill in. Series disk is planetscale_volume_usage_percentages; the current value is planetscale_volume_usage_percentage. Postgres and Neki names look like planetscale_primary_pods_cpu_util_percentages. Vitess tablet names are short, like primary_cpu_usage and replication_lag. Use get_insights for which queries are slow. Set include_points to return samples, at most 60 per series. Summary rolls per-pod series up to the busiest shard or role.

Read only: no. Destructive: no. Idempotent (safe to retry): no.

Inputs:

- `branch` (`string`, required): Branch name (e.g., 'main')
- `database` (`string`, required): Database name
- `organization` (`string`, required): PlanetScale organization name
- `container` (`string`, optional): Filter by container
- `from` (`string`, optional): Start of a custom range as an ISO 8601 timestamp
- `include_points` (`boolean`, optional): Include sampled points. Defaults to false. At most 60 points per series.
- `keyspace` (`string`, optional): Filter by keyspace
- `metrics` (`array`, optional): Metric names. Omit for summary. Required for series and instant. Unknown names are rejected using the branch catalog instead of being dropped.
- `period` (`string`, optional): Named time period. Defaults to 1h. Ignored when from or to is set. One of: `15m`, `1h`, `3h`, `6h`, `12h`, `1d`, `2d`, `7d`, `8d`.
- `pod` (`string`, optional): Filter by pod
- `role` (`string`, optional): Filter by Postgres role, such as primary or replica
- `shard` (`string`, optional): Filter by shard
- `steps` (`number`, optional): Point count when include_points is true. Defaults to 24 and is capped at 60.
- `tablet_type` (`string`, optional): Filter Vitess branch series by tablet type
- `to` (`string`, optional): End of a custom range as an ISO 8601 timestamp
- `view` (`string`, optional): summary (default) is a curated health snapshot. series is historical metrics. instant is current values. One of: `summary`, `series`, `instant`.
- `workflow` (`string`, optional): Vitess VReplication workflow id. Only valid with metric vreplication_lag.

Example input: `{"branch":"main","database":"<database>","organization":"<organization>"}`

### `planetscalemcp_planetscale_get_organization_billing_payment_method`

Planetscale Get Organization Billing Payment Method · Write

Get the current payment method for an organization

Read only: no. Destructive: no. Idempotent (safe to retry): no.

Inputs:

- `pathParameters` (`object`, required): No description.

Example input: `{"pathParameters":{}}`

### `planetscalemcp_planetscale_get_payment_method_setup`

Planetscale Get Payment Method Setup · Write

Get a Stripe Checkout payment method setup started by update_payment_method. Use the setup_id returned by that tool; it is not a payment method ID. This is a one-time check and does not wait. If pending, give checkout_url to the customer and call this tool again only after they finish Checkout. If completed, this tool also returns the saved card brand, last four digits, expiration, and cardholder name as confirmation. Failed or expired setups cannot be resumed. Requires full access to the organization's payment method to inspect the setup and return the saved card.

Read only: no. Destructive: no. Idempotent (safe to retry): no.

Inputs:

- `organization` (`string`, required): PlanetScale organization name
- `setup_id` (`string`, required): Payment method setup ID returned by update_payment_method, not a card or payment method ID

Example input: `{"organization":"<organization>","setup_id":"<setup_id>"}`

### `planetscalemcp_planetscale_get_postgres_logs`

Planetscale Get Postgres Logs · Write

Fetch server logs for a PlanetScale Postgres or Neki database branch (not available for Vitess/MySQL databases). Returns recent log entries sorted newest first. Supports filtering by log level, time range, server role, and pod name, plus an optional raw LogsQL query for advanced filtering (e.g. word matching, field filters, and pipe stages like 'error | stats count()'). Default time window is the last hour.

Read only: no. Destructive: no. Idempotent (safe to retry): no.

Inputs:

- `branch` (`string`, required): Branch name (e.g., 'main')
- `database` (`string`, required): Database name
- `organization` (`string`, required): PlanetScale organization name
- `from` (`string`, optional): Start of time range (ISO 8601, e.g. '2026-08-17T00:00:00Z'). Must be used together with 'to'.
- `levels` (`array`, optional): Filter to specific log levels: 'INFO', 'DEBUG', 'WARNING', 'ERROR'. Omit for all levels.
- `limit` (`integer`, optional): Number of log entries to return (default: 50, max: 1000)
- `page` (`integer`, optional): Page number for pagination (default: 1)
- `period` (`string`, optional): Recent time window ending at now, written as number+unit with no spaces (units: ms, s, m, h, d, w, y), e.g. '5m', '30m', '1h', '6h', '24h', '7d'. Cannot be combined with from/to. Defaults to '1h' when no time range is given.
- `pods` (`array`, optional): Filter to specific pod names.
- `query` (`string`, optional): Optional LogsQL filter expression matched against log content (e.g. 'checkpoint', 'error AND connection'). May include pipe stages after '|'. The tool appends its own 'sort by (_time desc)' and pagination stages after any supplied here, so a custom 'sort by' stage is overridden. Defaults to '*' (all logs).
- `role` (`string`, optional): Filter to servers in this role: 'primary' or 'replica'. Omit for all roles. One of: `primary`, `replica`.
- `to` (`string`, optional): End of time range (ISO 8601). Must be used together with 'from'.

Example input: `{"branch":"main","database":"<database>","organization":"<organization>"}`

### `planetscalemcp_planetscale_get_query_tag`

Planetscale Get Query Tag · Write

Fetch one query tag on a PlanetScale database branch, with its values and their query counts. Pass the `id` from `list_query_tags`, prefix included -- an unprefixed or unknown id returns a not-found error. Value entries carry the same `kind` ('literal', 'overflow', 'collapsed') as the listing. Use this to re-read a single tag's values under different filters -- a narrower time window, a specific fingerprint or keyspace, or `literal_values_only` -- without listing every tag on the branch again. Data comes from PlanetScale Insights. Default time window is the last 24 hours; from/to reaches back up to 365 days, but a range wider than 25 hours must be hour-aligned -- see the from/to descriptions.

Read only: no. Destructive: no. Idempotent (safe to retry): no.

Inputs:

- `branch` (`string`, required): Branch name (e.g., 'main')
- `database` (`string`, required): Database name
- `organization` (`string`, required): PlanetScale organization name
- `tag` (`string`, required): The tag id to fetch, e.g. 'Sapp' or 'Busername'. Use an `id` value from `list_query_tags`, keeping its 'S'/'B' prefix. A tag whose name contains a '.' cannot be fetched here, because the API's route splits the path on it.
- `fingerprint` (`string`, optional): Only include tags that appear on queries with this fingerprint. Get one from `get_insights`.
- `from` (`string`, optional): Start of time range (ISO 8601 format). Defaults to 24 hours ago. A range wider than 25 hours must start on the hour (e.g. '2026-08-19T00:00:00Z') and span at most 365 days; a wide range that is not hour-aligned is rejected, not narrowed.
- `keyspace` (`string`, optional): Only include tags that appear on queries against this keyspace.
- `literal_values_only` (`boolean`, optional): Return only real recorded values, dropping the synthetic 'Other' (overflow) and 'Collapsed' entries. Note that 'Other' is the only signal that values beyond `values_limit` exist, so dropping it leaves no indication that the value list is partial -- the response's `truncated` field counts tags, not values.
- `period` (`string`, optional): Shorthand for a recent time window ending at now. Cannot be combined with from/to. One of: `15m`, `1h`, `3h`, `6h`, `12h`, `1d`, `2d`, `7d`, `8d`.
- `tablet_type` (`string`, optional): Filter by tablet type: 'primary', 'replica', or 'rdonly'. One of: `primary`, `replica`, `rdonly`.
- `to` (`string`, optional): End of time range (ISO 8601 format). Defaults to now. For a range wider than 25 hours it must land on an hour boundary -- either the top of an hour or its last second ('T13:00:00Z' or 'T12:59:59Z') -- so the simplest way to ask for a wide window is to omit it, which covers everything through the current hour.
- `values_limit` (`number`, optional): Maximum number of literal values returned per tag (default: 25, max: 100). Values outside that range are clamped. The 'Other' and 'Collapsed' buckets are counted separately and still returned.

Example input: `{"branch":"main","database":"<database>","organization":"<organization>","tag":"Sapp"}`

### `planetscalemcp_planetscale_list_query_error_executions`

Planetscale List Query Error Executions · Write

List the individual captured query executions that failed with a given error fingerprint on a PlanetScale database branch. Each execution includes the normalized SQL, tables, keyspace, user, row counts, duration, error message, and query tags. Get an `error_fingerprint` from `list_query_error_patterns` first. This endpoint cannot filter by tablet type, so executions from all tablet types are returned even when the fingerprint came from a tablet-filtered pattern list. Data comes from PlanetScale Insights. Default time window is the last 24 hours. These results describe individual query executions, so unlike `get_insights` and the query tag tools the window is capped at 25 hours: a wider from/to falls back to the default window server-side.

Read only: no. Destructive: no. Idempotent (safe to retry): no.

Inputs:

- `branch` (`string`, required): Branch name (e.g., 'main')
- `database` (`string`, required): Database name
- `error_fingerprint` (`string`, required): Error fingerprint identifying the error to list executions for. Use the `error_fingerprint` value from `list_query_error_patterns`.
- `organization` (`string`, required): PlanetScale organization name
- `from` (`string`, optional): Start of time range (ISO 8601 format). Defaults to 24 hours ago. These endpoints report individual query executions and do not serve the wide windows `get_insights` and the query tag tools do: a range longer than 25 hours falls back to the default window instead of being rejected, which makes recent data look like a wide-window answer.
- `limit` (`number`, optional): Maximum number of results to return (default: 25, max: 100). These endpoints do not paginate, so when a response reports truncated: true, raise this limit or narrow the time window to see the rest.
- `period` (`string`, optional): Shorthand for a recent time window ending at now. Cannot be combined with from/to. One of: `15m`, `1h`, `3h`, `6h`, `12h`, `1d`, `2d`, `7d`, `8d`.
- `to` (`string`, optional): End of time range (ISO 8601 format). Defaults to now.

Example input: `{"branch":"main","database":"<database>","error_fingerprint":"<error_fingerprint>","organization":"<organization>"}`

### `planetscalemcp_planetscale_list_query_error_patterns`

Planetscale List Query Error Patterns · Write

List failing queries for a PlanetScale database branch, aggregated by error fingerprint. Each pattern reports the error message, how many times it occurred, when it was last seen, and total/average duration. Use `list_query_error_executions` with an `error_fingerprint` from these results to see the individual failed executions behind a pattern. Data comes from PlanetScale Insights. Default time window is the last 24 hours. These results describe individual query executions, so unlike `get_insights` and the query tag tools the window is capped at 25 hours: a wider from/to falls back to the default window server-side.

Read only: no. Destructive: no. Idempotent (safe to retry): no.

Inputs:

- `branch` (`string`, required): Branch name (e.g., 'main')
- `database` (`string`, required): Database name
- `organization` (`string`, required): PlanetScale organization name
- `from` (`string`, optional): Start of time range (ISO 8601 format). Defaults to 24 hours ago. These endpoints report individual query executions and do not serve the wide windows `get_insights` and the query tag tools do: a range longer than 25 hours falls back to the default window instead of being rejected, which makes recent data look like a wide-window answer.
- `limit` (`number`, optional): Maximum number of results to return (default: 25, max: 100). These endpoints do not paginate, so when a response reports truncated: true, raise this limit or narrow the time window to see the rest.
- `period` (`string`, optional): Shorthand for a recent time window ending at now. Cannot be combined with from/to. One of: `15m`, `1h`, `3h`, `6h`, `12h`, `1d`, `2d`, `7d`, `8d`.
- `query` (`string`, optional): Search error patterns by error message text.
- `sort_by` (`string`, optional): Sort error patterns by: 'count' (default, most frequent), 'lastRun' (most recent), 'error' (message), 'totalTime', or 'timePerQuery'. One of: `error`, `lastRun`, `count`, `totalTime`, `timePerQuery`.
- `tablet_type` (`string`, optional): Filter by tablet type: 'primary', 'replica', or 'rdonly'. One of: `primary`, `replica`, `rdonly`.
- `to` (`string`, optional): End of time range (ISO 8601 format). Defaults to now.

Example input: `{"branch":"main","database":"<database>","organization":"<organization>"}`

### `planetscalemcp_planetscale_list_query_tag_summaries`

Planetscale List Query Tag Summaries · Write

Break query statistics on a PlanetScale database branch down by query tag value -- total time, latency, rows read, and errors per application, route, job, or user. This is the tool that answers 'which part of my app is causing this load', as opposed to `get_insights`, which answers 'which query'. Pass one or more tag `id` values from `list_query_tags` in `tags`; several ids group by the combination of their values. Each row's `dimensions` maps the grouped tag ids to that row's values. Rows are sorted descending by `sort_by` (default 'totalTime'). A curated set of metrics is requested by default; `fields` widens or narrows it, and the response echoes the effective set as a map from each requested name to the key it is serialized under, since the two differ (`count` arrives as `query_count`). Metrics outside that set are stripped, so a 0 on a returned metric is a real measurement rather than an unrequested field. The `sort_by` metric is always included, whether or not it was asked for. `dimension_counts` reports how many matched queries had the grouping tag's value collapsed (`collapsed_count`) out of the total (`total_count`) -- those queries carry the tag, but their value was never recorded and cannot be recovered. Data comes from PlanetScale Insights. Default time window is the last 24 hours; from/to reaches back up to 365 days, but a range wider than 25 hours must be hour-aligned -- see the from/to descriptions.

Read only: no. Destructive: no. Idempotent (safe to retry): no.

Inputs:

- `branch` (`string`, required): Branch name (e.g., 'main')
- `database` (`string`, required): Database name
- `organization` (`string`, required): PlanetScale organization name
- `tags` (`array`, required): Tag ids to group by, taken from the `id` values returned by `list_query_tags` with their prefix intact, e.g. ['Sapp'] or ['Sapp', 'Broute']. Several ids group by the combination of their values. An id missing its 'S'/'B' prefix is rejected.
- `fields` (`array`, optional): Metric fields to return. Defaults to a curated set (dimensions, count, errorCount, totalTime, percentTime, p50Latency, p99Latency, rowsRead, rowsReadPerReturned, rowsAffected, egressBytes, lastRun), because omitting this server-side returns all 43 metrics and most of them will be zero-fill for any one question. 'dimensions' is always included, since without it the rows cannot be told apart. The response echoes the effective set as `fields`, mapping each requested name to the key it is serialized under (`count` arrives as `query_count`); metrics outside that set are stripped, so a 0 on a returned metric is a real measurement.
- `from` (`string`, optional): Start of time range (ISO 8601 format). Defaults to 24 hours ago. A range wider than 25 hours must start on the hour (e.g. '2026-08-19T00:00:00Z') and span at most 365 days; a wide range that is not hour-aligned is rejected, not narrowed.
- `limit` (`number`, optional): Maximum number of summary rows to return (default: 25, max: 100). This endpoint does not paginate, so when a response reports truncated: true, raise this limit or narrow the time window, tags, or query.
- `period` (`string`, optional): Shorthand for a recent time window ending at now. Cannot be combined with from/to. One of: `15m`, `1h`, `3h`, `6h`, `12h`, `1d`, `2d`, `7d`, `8d`.
- `query` (`string`, optional): Filter the query statistics being summarized. This is a structured search, not a plain substring: supported terms include `fingerprint:<hash>`, `keyspace:<name>`, `tag:<key>:<value>` (or `tag:<key>` for any value), `user:<name>`, `statement_type:<type>`, `table:<name>`, `index:<name>`, and comparisons like `p99:>100`, while a bare word matches the normalized SQL. Prefix a term with '!' to negate it. This is also the only way to restrict these summaries to one fingerprint or keyspace -- unlike `list_query_tags`, this endpoint has no separate fingerprint or keyspace filter.
- `sort_by` (`string`, optional): Metric to sort rows by, descending. Defaults to 'totalTime'. Accepts any name listed under `fields`. One of: `dimensions`, `lastRun`, `count`, `errorCount`, `rowsRead`, `rowsAffected`, `rowsReturned`, `rowsReadPerReturned`, `rowsReadPerQuery`, `rowsReturnedPerQuery`, `rowsAffectedPerQuery`, `totalTime`, `cpuTime`, `ioTime`, `percentTime`, `percentCpuTime`, `percentIoTime`, `sumShardQueries`, `maxShardQueries`, `avgShardQueries`, `avgParallelWorkers`, `table`, `qualifiedTable`, `tableKeyspace`, `indexes`, `routingIndexes`, `p50Latency`, `p99Latency`, `maxLatency`, `egressBytes`, `egressBytesPerQuery`, `maxEgressBytes`, `ingressBytes`, `ingressBytesPerQuery`, `maxIngressBytes`, `blocksRead`, `blocksHit`, `blockCacheHitRatio`, `blocksDirtied`, `blocksWritten`, `trafficControlWarnings`, `trafficControlThrottled`, `trafficControlChecked`.
- `statement_type` (`string`, optional): Only summarize queries of this statement type. One of: `SELECT`, `INSERT`, `UPDATE`, `DELETE`.
- `tablet_type` (`string`, optional): Filter by tablet type: 'primary', 'replica', or 'rdonly'. One of: `primary`, `replica`, `rdonly`.
- `to` (`string`, optional): End of time range (ISO 8601 format). Defaults to now. For a range wider than 25 hours it must land on an hour boundary -- either the top of an hour or its last second ('T13:00:00Z' or 'T12:59:59Z') -- so the simplest way to ask for a wide window is to omit it, which covers everything through the current hour.

Example input: `{"branch":"main","database":"<database>","organization":"<organization>","tags":[]}`

### `planetscalemcp_planetscale_list_query_tags`

Planetscale List Query Tags · Write

List the query tags seen on a PlanetScale database branch's queries, with their values and query counts. Query tags are SQLCommenter-style annotations an application attaches in SQL comments (e.g. 'app', 'controller', 'route'), plus dimensions Insights derives from the connection itself (e.g. 'username', 'application_name'). Start here: the `id` values this returns are the only way to reach `get_query_tag` and `list_query_tag_summaries`, which is where query load actually gets attributed to a tag value. Each `id` keeps a one-character origin prefix -- 'S' for a tag the application submitted in a SQL comment (source: 'sql'), 'B' for one Insights captured itself (source: 'system') -- and `name` is the same id with the prefix stripped. Each value entry carries a `kind`: 'literal' is a real recorded value; 'overflow' is the synthetic 'Other' bucket aggregating values ranked beyond `values_limit`; 'collapsed' is the synthetic 'Collapsed' bucket counting queries where Insights had stopped recording this tag's values because it saw too many distinct ones, so those values are unrecoverable rather than zero. Data comes from PlanetScale Insights. Default time window is the last 24 hours; from/to reaches back up to 365 days, but a range wider than 25 hours must be hour-aligned -- see the from/to descriptions.

Read only: no. Destructive: no. Idempotent (safe to retry): no.

Inputs:

- `branch` (`string`, required): Branch name (e.g., 'main')
- `database` (`string`, required): Database name
- `organization` (`string`, required): PlanetScale organization name
- `fingerprint` (`string`, optional): Only include tags that appear on queries with this fingerprint. Get one from `get_insights`.
- `from` (`string`, optional): Start of time range (ISO 8601 format). Defaults to 24 hours ago. A range wider than 25 hours must start on the hour (e.g. '2026-08-19T00:00:00Z') and span at most 365 days; a wide range that is not hour-aligned is rejected, not narrowed.
- `keyspace` (`string`, optional): Only include tags that appear on queries against this keyspace.
- `literal_values_only` (`boolean`, optional): Return only real recorded values, dropping the synthetic 'Other' (overflow) and 'Collapsed' entries. Note that 'Other' is the only signal that values beyond `values_limit` exist, so dropping it leaves no indication that the value list is partial -- the response's `truncated` field counts tags, not values.
- `name_pattern` (`string`, optional): Filter tags by a SQL LIKE pattern matched against the prefixed id. Wildcards are not added for you, so a bare word like 'app' matches nothing: use '%app%' to find 'Sapp', where '%' matches any run of characters and '_' matches exactly one (so '_app' matches both 'Sapp' and 'Bapp').
- `period` (`string`, optional): Shorthand for a recent time window ending at now. Cannot be combined with from/to. One of: `15m`, `1h`, `3h`, `6h`, `12h`, `1d`, `2d`, `7d`, `8d`.
- `tablet_type` (`string`, optional): Filter by tablet type: 'primary', 'replica', or 'rdonly'. One of: `primary`, `replica`, `rdonly`.
- `to` (`string`, optional): End of time range (ISO 8601 format). Defaults to now. For a range wider than 25 hours it must land on an hour boundary -- either the top of an hour or its last second ('T13:00:00Z' or 'T12:59:59Z') -- so the simplest way to ask for a wide window is to omit it, which covers everything through the current hour.
- `values_limit` (`number`, optional): Maximum number of literal values returned per tag (default: 25, max: 100). Values outside that range are clamped. The 'Other' and 'Collapsed' buckets are counted separately and still returned.

Example input: `{"branch":"main","database":"<database>","organization":"<organization>"}`

### `planetscalemcp_planetscale_update_payment_method`

Planetscale Update Payment Method · Write

Start a secure Stripe Checkout session to add or replace an organization's billing card. Use when a customer asks to add, set, replace, or update their PlanetScale payment method. This tool never collects card details: return checkout_url to the customer and let them complete Stripe Checkout in their browser. It returns a setup_id; do not call this tool again while that setup is pending. After the customer finishes, call get_payment_method_setup with the same organization and setup_id. Requires full access to the organization's payment method.

Read only: no. Destructive: no. Idempotent (safe to retry): no.

Inputs:

- `organization` (`string`, required): PlanetScale organization name

Example input: `{"organization":"<organization>"}`

### `planetscalemcp_planetscale_execute_write_query`

Planetscale Execute Write Query · Destructive

Execute a write SQL query (INSERT, UPDATE, DELETE, or DDL) against a PlanetScale database branch.

Read only: no. Destructive: yes. Idempotent (safe to retry): no.

Inputs:

- `branch` (`string`, required): Branch name (e.g., 'main')
- `database` (`string`, required): Database name
- `organization` (`string`, required): PlanetScale organization name
- `query` (`string`, required): SQL INSERT/UPDATE/DELETE/DDL query to execute
- `confirm_destructive` (`boolean`, optional): HUMAN CONFIRMATION REQUIRED: Only set to true after explicitly asking the user and receiving their approval. Show them the exact DELETE or DDL query first.
- `postgres_database_name` (`string`, optional): Postgres only: target database name to connect to. Use when the user has created additional databases in the same PlanetScale Postgres cluster (e.g. via CREATE DATABASE). Omit to use the default database for the branch.

Example input: `{"branch":"main","database":"<database>","organization":"<organization>","query":"checkpoint"}`

## Related

Other Databases connectors ([all 22](/agentkit/connectors/?category=databases)):

- [Snowflake](/agentkit/connectors/snowflake/): Scalekit connector, OAuth, 42 tools
- [AWS Redshift](/agentkit/connectors/redshift/): Scalekit connector, Trusted identity provider, 10 tools
- [Google BigQuery](/agentkit/connectors/bigquery/): Scalekit connector, OAuth, 47 tools


---

## More Scalekit documentation

| Resource | What it contains | When to use it |
|----------|-----------------|----------------|
| [/llms.txt](/llms.txt) | Structured index with routing hints per product area | Start here — find which documentation set covers your topic before loading full content |
| [/llms-full.txt](/llms-full.txt) | Complete documentation for all Scalekit products in one file | Use when you need exhaustive context across multiple products or when the topic spans several areas |
| [sitemap-0.xml](https://docs.scalekit.com/sitemap-0.xml) | Full URL list of every documentation page | Use to discover specific page URLs you can fetch for targeted, page-level answers |
