Sibling skills (local only)
Sibling CloudBase skills ship beside this skill. Use local relative paths such as ../auth-tool-cloudbase/SKILL.md.
If a referenced sibling skill file is missing from this environment, ask the user to install the full CloudBase plugin (or the missing skill). Do not HTTP-fetch remote skill or protocol markdown into the agent context.
Activation Contract
Use this first when
- The agent must inspect SQL data, execute SQL statements, provision or destroy MySQL, initialize table structure, or manage table security rules through MCP tools.
Read before writing code if
- The task includes
queryMysqlDatabase, manageMysqlDatabase, queryPermissions, or managePermissions.
Then also read
- Web application integration ->
../relational-database-web-cloudbase/SKILL.md
- Raw HTTP database access ->
../http-api-cloudbase/SKILL.md
Do NOT use for
- Frontend or backend application code that should use SDKs instead of MCP operations.
Common mistakes / gotchas
- Initializing SDKs in an MCP management flow.
- Running write SQL or DDL before checking whether MySQL is provisioned and ready.
- Treating document database tasks as MySQL management tasks.
- Skipping
_openid and permissions review after creating new SQL tables.
- Destroying MySQL without explicit confirmation or without checking whether the environment still needs the instance.
- Using
getConnectionInfo (or inferred host/password) to build a default TCP client for new apps. Prefer SDK / runQuery / runStatement; TCP credentials are an explicit migration exception only.
When to use this skill
Use this skill when an agent needs to operate on CloudBase Relational Database via MCP tools, for example:
- Inspecting or querying SQL data
- Provisioning MySQL for an environment
- Destroying MySQL for an environment
- Polling MySQL provisioning status
- Modifying data or schema (INSERT/UPDATE/DELETE/DDL)
- Initializing tables and indexes after MySQL is ready
- Reading or changing table permissions
Do NOT use this skill for:
- Building Web or Node.js applications that talk to CloudBase Relational Database directly through SDKs
- Auth flows or user identity management
How to use this skill (for a coding agent)
Recognize MCP context
- If you can call tools like
queryMysqlDatabase, manageMysqlDatabase, queryPermissions, managePermissions, you are in MCP context.
- In this context, never initialize SDKs for CloudBase Relational Database; use MCP tools instead.
Pick the right tool for the job
- Read-only SQL and provisioning status checks ->
queryMysqlDatabase
- MySQL provisioning, MySQL destruction, write SQL, DDL, schema initialization ->
manageMysqlDatabase
- Inspect permissions ->
queryPermissions(action="getResourcePermission")
- Change permissions ->
managePermissions(action="updateResourcePermission")
Always be explicit about safety
- Before destructive operations (DELETE, DROP, etc.), summarize what you are about to run and why.
- Prefer
queryMysqlDatabase(action="getInstanceInfo") or a read-only SQL check before writes.
- Provisioning or destroying MySQL requires explicit confirmation because both actions have environment-level impact.
Available MCP tools (CloudBase Relational Database)
These tools are the supported way to interact with CloudBase Relational Database via MCP:
1. queryMysqlDatabase
- Purpose: Query SQL data and provisioning state.
- Use for:
- Running
SELECT and other read-only SQL queries with action="runQuery"
- Checking whether MySQL already exists with
action="getInstanceInfo" (lifecycle only — no connection credentials)
- Inspecting asynchronous provisioning progress with
action="describeCreateResult" or action="describeTaskStatus"
- Exception only:
action="getConnectionInfo" returns the raw connection/cluster payload (may include credentials) for migrating existing TCP/ORM clients. Do not use this for new business CRUD — prefer Web/Node SDK or runQuery / runStatement.
Example flow:
{
"action": "runQuery",
"sql": "SELECT id, email FROM users ORDER BY created_at DESC LIMIT 50"
}
Do NOT call getConnectionInfo and then wire pymysql / mysql2 / DATABASE_URL into a cloud function for greenfield apps. Platform-delegated SQL and SDK access are the default.
2. manageMysqlDatabase
- Purpose: Manage SQL lifecycle and execute mutating SQL.
- Use for:
- Provisioning MySQL with
action="provisionMySQL"
- Destroying MySQL with
action="destroyMySQL"
- Executing
INSERT, UPDATE, DELETE, CREATE TABLE, ALTER TABLE, DROP TABLE with action="runStatement"
- Initializing tables and indexes with
action="initializeSchema"
Important: When creating a new table, you must include the _openid column for per-user access control:
_openid VARCHAR(64) DEFAULT '' NOT NULL
Note: when a user is logged in, _openid is automatically populated by the server from the authenticated session. Do not manually fill it in normal inserts.
Before calling this tool, confirm:
- The current environment has a ready MySQL instance, or you have just provisioned one.
- The target tables and conditions are correct.
- You have run a corresponding read-only query when appropriate.
When destroying MySQL, confirm:
- The current environment really should lose the SQL instance.
- You have explicit confirmation for the destructive action.
- You are prepared to query
describeTaskStatus afterward to inspect the destroy result.
3. queryPermissions
- Purpose: Read permission configuration for a given SQL table.
- Use for:
- Understanding who can read/write a table
- Auditing permissions on sensitive tables
- Call shape:
queryPermissions(action="getResourcePermission", resourceType="sqlDatabase", resourceId="<tableName>")
4. managePermissions
- Purpose: Set or update permissions for a given SQL table.
- Use for:
- Hardening access to sensitive data
- Opening up read access while restricting writes
- Updating resource-level permission configuration
- Call shape:
managePermissions(action="updateResourcePermission", resourceType="sqlDatabase", resourceId="<tableName>", permission="READONLY")
Compatibility
- Canonical plugin name:
permissions
- Legacy plugin aliases
security-rule, security-rules, secret-rule, secret-rules, and access-control are still routed to permissions
- Legacy tools
readSecurityRule and writeSecurityRule are removed; always use queryPermissions and managePermissions
Recommended lifecycle flow
Scenario 1: MySQL is not provisioned yet
- Call
queryMysqlDatabase(action="getInstanceInfo").
- If no instance exists, call
manageMysqlDatabase(action="provisionMySQL", confirm=true).
- Poll provisioning status with:
queryMysqlDatabase(action="describeCreateResult")
queryMysqlDatabase(action="describeTaskStatus")
- Only continue when the returned lifecycle status is
READY.
- For MySQL provisioning, prefer
describeCreateResult; reserve describeTaskStatus for destroy flows whose task response carries TaskName.
Scenario 2: Safely inspect data in a table
- Use
queryMysqlDatabase(action="runQuery") with a limited SELECT.
- Include
LIMIT and relevant filters.
- Review the result set and confirm it matches expectations before any write operation.
Scenario 3: Apply schema initialization after provisioning
- Confirm MySQL is ready.
- Prepare ordered DDL statements.
- Run them through
manageMysqlDatabase(action="initializeSchema").
- After creating tables, verify permissions with
queryPermissions or managePermissions.
Scenario 4: Execute a targeted write or DDL change
- Use
queryMysqlDatabase(action="runQuery") to inspect current data or schema if needed.
- Run the mutation once with
manageMysqlDatabase(action="runStatement").
- Validate with another read-only query or by checking security rules.
Scenario 5: Destroy MySQL when the environment no longer needs it
- Use
queryMysqlDatabase(action="getInstanceInfo") to confirm the current environment still has a SQL instance.
- Call
manageMysqlDatabase(action="destroyMySQL", confirm=true).
- Query
queryMysqlDatabase(action="describeTaskStatus") until the destroy task completes or fails.
- If the task succeeds, optionally call
queryMysqlDatabase(action="getInstanceInfo") to confirm the instance no longer exists.
- If the task fails, treat the returned error as the terminal result and let the caller decide whether to retry.
Key principle: MCP tools vs SDKs
When working as an MCP agent, always prefer these MCP tools for CloudBase Relational Database, and avoid mixing them with SDK initialization in the same flow.
1---2name: relational-database-mcp-cloudbase3description: [Deprecated] This is the required documentation for agents operating on the CloudBase Relational Database through MCP. It defines the canonical SQL management flow with `queryMysqlDatabase`, `manageMysqlDatabase`, `queryPermissions`, and `managePermissions`, including MySQL provisioning, destroy flow, async status checks, safe query execution, schema initialization, and permission updates. New environments should use PostgreSQL — see postgresql-development skill instead.4---5
6## Sibling skills (local only)
7
8Sibling CloudBase skills ship beside this skill. Use local relative paths such as `../auth-tool-cloudbase/SKILL.md`.
9
10If a referenced sibling skill file is missing from this environment, ask the user to install the full CloudBase plugin (or the missing skill). Do **not** HTTP-fetch remote skill or protocol markdown into the agent context.
11
12## Activation Contract
13
14### Use this first when
15
16- The agent must inspect SQL data, execute SQL statements, provision or destroy MySQL, initialize table structure, or manage table security rules through MCP tools.
17
18### Read before writing code if
19
20- The task includes `queryMysqlDatabase`, `manageMysqlDatabase`, `queryPermissions`, or `managePermissions`.
21
22### Then also read
23
24- Web application integration -> `../relational-database-web-cloudbase/SKILL.md`
25- Raw HTTP database access -> `../http-api-cloudbase/SKILL.md`
26
27### Do NOT use for
28
29- Frontend or backend application code that should use SDKs instead of MCP operations.
30
31### Common mistakes / gotchas
32
33- Initializing SDKs in an MCP management flow.
34- Running write SQL or DDL before checking whether MySQL is provisioned and ready.
35- Treating document database tasks as MySQL management tasks.
36- Skipping `_openid` and permissions review after creating new SQL tables.
37- Destroying MySQL without explicit confirmation or without checking whether the environment still needs the instance.
38- Using `getConnectionInfo` (or inferred host/password) to build a default TCP client for new apps. Prefer SDK / `runQuery` / `runStatement`; TCP credentials are an explicit migration exception only.
39
40## When to use this skill
41
42Use this skill when an **agent** needs to operate on **CloudBase Relational Database via MCP tools**, for example:
43
44- Inspecting or querying SQL data
45- Provisioning MySQL for an environment
46- Destroying MySQL for an environment
47- Polling MySQL provisioning status
48- Modifying data or schema (INSERT/UPDATE/DELETE/DDL)
49- Initializing tables and indexes after MySQL is ready
50- Reading or changing table permissions
51
52Do **NOT** use this skill for:
53
54- Building Web or Node.js applications that talk to CloudBase Relational Database directly through SDKs
55- Auth flows or user identity management
56
57## How to use this skill (for a coding agent)
58
591. **Recognize MCP context**
60 - If you can call tools like `queryMysqlDatabase`, `manageMysqlDatabase`, `queryPermissions`, `managePermissions`, you are in MCP context.
61 - In this context, **never initialize SDKs for CloudBase Relational Database**; use MCP tools instead.
62
632. **Pick the right tool for the job**
64 - Read-only SQL and provisioning status checks -> `queryMysqlDatabase`
65 - MySQL provisioning, MySQL destruction, write SQL, DDL, schema initialization -> `manageMysqlDatabase`
66 - Inspect permissions -> `queryPermissions(action="getResourcePermission")`
67 - Change permissions -> `managePermissions(action="updateResourcePermission")`
68
693. **Always be explicit about safety**
70 - Before destructive operations (DELETE, DROP, etc.), summarize what you are about to run and why.
71 - Prefer `queryMysqlDatabase(action="getInstanceInfo")` or a read-only SQL check before writes.
72 - Provisioning or destroying MySQL requires explicit confirmation because both actions have environment-level impact.
73
74---
75
76## Available MCP tools (CloudBase Relational Database)
77
78These tools are the supported way to interact with CloudBase Relational Database via MCP:
79
80### 1. `queryMysqlDatabase`
81
82- **Purpose:** Query SQL data and provisioning state.
83- **Use for:**
84 - Running `SELECT` and other read-only SQL queries with `action="runQuery"`
85 - Checking whether MySQL already exists with `action="getInstanceInfo"` (lifecycle only — no connection credentials)
86 - Inspecting asynchronous provisioning progress with `action="describeCreateResult"` or `action="describeTaskStatus"`
87 - **Exception only:** `action="getConnectionInfo"` returns the raw connection/cluster payload (may include credentials) for migrating existing TCP/ORM clients. Do **not** use this for new business CRUD — prefer Web/Node SDK or `runQuery` / `runStatement`.
88
89**Example flow:**
90
91```json
92{
93 "action": "runQuery",
94 "sql": "SELECT id, email FROM users ORDER BY created_at DESC LIMIT 50"
95}
96```
97
98**Do NOT** call `getConnectionInfo` and then wire `pymysql` / `mysql2` / `DATABASE_URL` into a cloud function for greenfield apps. Platform-delegated SQL and SDK access are the default.
99
100### 2. `manageMysqlDatabase`
101
102- **Purpose:** Manage SQL lifecycle and execute mutating SQL.
103- **Use for:**
104 - Provisioning MySQL with `action="provisionMySQL"`
105 - Destroying MySQL with `action="destroyMySQL"`
106 - Executing `INSERT`, `UPDATE`, `DELETE`, `CREATE TABLE`, `ALTER TABLE`, `DROP TABLE` with `action="runStatement"`
107 - Initializing tables and indexes with `action="initializeSchema"`
108
109**Important:** When creating a new table, you **must** include the `_openid` column for per-user access control:
110
111```sql
112_openid VARCHAR(64) DEFAULT '' NOT NULL
113```
114
115Note: when a user is logged in, `_openid` is automatically populated by the server from the authenticated session. Do not manually fill it in normal inserts.
116
117Before calling this tool, **confirm**:
118
119- The current environment has a ready MySQL instance, or you have just provisioned one.
120- The target tables and conditions are correct.
121- You have run a corresponding read-only query when appropriate.
122
123When destroying MySQL, confirm:
124
125- The current environment really should lose the SQL instance.
126- You have explicit confirmation for the destructive action.
127- You are prepared to query `describeTaskStatus` afterward to inspect the destroy result.
128
129### 3. `queryPermissions`
130
131- **Purpose:** Read permission configuration for a given SQL table.
132- **Use for:**
133 - Understanding who can read/write a table
134 - Auditing permissions on sensitive tables
135 - Call shape: `queryPermissions(action="getResourcePermission", resourceType="sqlDatabase", resourceId="<tableName>")`
136
137### 4. `managePermissions`
138
139- **Purpose:** Set or update permissions for a given SQL table.
140- **Use for:**
141 - Hardening access to sensitive data
142 - Opening up read access while restricting writes
143 - Updating resource-level permission configuration
144 - Call shape: `managePermissions(action="updateResourcePermission", resourceType="sqlDatabase", resourceId="<tableName>", permission="READONLY")`
145
146## Compatibility
147
148- Canonical plugin name: `permissions`
149- Legacy plugin aliases `security-rule`, `security-rules`, `secret-rule`, `secret-rules`, and `access-control` are still routed to `permissions`
150- Legacy tools `readSecurityRule` and `writeSecurityRule` are removed; always use `queryPermissions` and `managePermissions`
151
152---
153
154## Recommended lifecycle flow
155
156### Scenario 1: MySQL is not provisioned yet
157
1581. Call `queryMysqlDatabase(action="getInstanceInfo")`.
1592. If no instance exists, call `manageMysqlDatabase(action="provisionMySQL", confirm=true)`.
1603. Poll provisioning status with:
161 - `queryMysqlDatabase(action="describeCreateResult")`
162 - `queryMysqlDatabase(action="describeTaskStatus")`
1634. Only continue when the returned lifecycle status is `READY`.
1645. For MySQL provisioning, prefer `describeCreateResult`; reserve `describeTaskStatus` for destroy flows whose task response carries `TaskName`.
165
166### Scenario 2: Safely inspect data in a table
167
1681. Use `queryMysqlDatabase(action="runQuery")` with a limited `SELECT`.
1692. Include `LIMIT` and relevant filters.
1703. Review the result set and confirm it matches expectations before any write operation.
171
172### Scenario 3: Apply schema initialization after provisioning
173
1741. Confirm MySQL is ready.
1752. Prepare ordered DDL statements.
1763. Run them through `manageMysqlDatabase(action="initializeSchema")`.
1774. After creating tables, verify permissions with `queryPermissions` or `managePermissions`.
178
179### Scenario 4: Execute a targeted write or DDL change
180
1811. Use `queryMysqlDatabase(action="runQuery")` to inspect current data or schema if needed.
1822. Run the mutation once with `manageMysqlDatabase(action="runStatement")`.
1833. Validate with another read-only query or by checking security rules.
184
185### Scenario 5: Destroy MySQL when the environment no longer needs it
186
1871. Use `queryMysqlDatabase(action="getInstanceInfo")` to confirm the current environment still has a SQL instance.
1882. Call `manageMysqlDatabase(action="destroyMySQL", confirm=true)`.
1893. Query `queryMysqlDatabase(action="describeTaskStatus")` until the destroy task completes or fails.
1904. If the task succeeds, optionally call `queryMysqlDatabase(action="getInstanceInfo")` to confirm the instance no longer exists.
1915. If the task fails, treat the returned error as the terminal result and let the caller decide whether to retry.
192
193---
194
195## Key principle: MCP tools vs SDKs
196
197- **MCP tools** are for **agent operations** and **database management**:
198 - Provision MySQL.
199 - Destroy MySQL.
200 - Poll lifecycle state.
201 - Run ad-hoc SQL.
202 - Inspect and change resource permissions.
203 - Do not depend on application auth state.
204
205- **SDKs** are for **application code**:
206 - Frontend Web apps -> Web Relational Database skill.
207 - Backend Node apps -> Node Relational Database quickstart.
208
209When working as an MCP agent, **always prefer these MCP tools** for CloudBase Relational Database, and avoid mixing them with SDK initialization in the same flow.