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-cloudbase
3description: "[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."
4version: 2.33.2
5alwaysApply: false
6metadata:
7 priority: "5"
8 deprecated: "true"
9---
10
11## Sibling skills (local only)
12
13Sibling CloudBase skills ship beside this skill. Use local relative paths such as `../auth-tool-cloudbase/SKILL.md`.
14
15If 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.
16
17## Activation Contract
18
19### Use this first when
20
21- The agent must inspect SQL data, execute SQL statements, provision or destroy MySQL, initialize table structure, or manage table security rules through MCP tools.
22
23### Read before writing code if
24
25- The task includes `queryMysqlDatabase`, `manageMysqlDatabase`, `queryPermissions`, or `managePermissions`.
26
27### Then also read
28
29- Web application integration -> `../relational-database-web-cloudbase/SKILL.md`
30- Raw HTTP database access -> `../http-api-cloudbase/SKILL.md`
31
32### Do NOT use for
33
34- Frontend or backend application code that should use SDKs instead of MCP operations.
35
36### Common mistakes / gotchas
37
38- Initializing SDKs in an MCP management flow.
39- Running write SQL or DDL before checking whether MySQL is provisioned and ready.
40- Treating document database tasks as MySQL management tasks.
41- Skipping `_openid` and permissions review after creating new SQL tables.
42- Destroying MySQL without explicit confirmation or without checking whether the environment still needs the instance.
43- 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.
44
45## When to use this skill
46
47Use this skill when an **agent** needs to operate on **CloudBase Relational Database via MCP tools**, for example:
48
49- Inspecting or querying SQL data
50- Provisioning MySQL for an environment
51- Destroying MySQL for an environment
52- Polling MySQL provisioning status
53- Modifying data or schema (INSERT/UPDATE/DELETE/DDL)
54- Initializing tables and indexes after MySQL is ready
55- Reading or changing table permissions
56
57Do **NOT** use this skill for:
58
59- Building Web or Node.js applications that talk to CloudBase Relational Database directly through SDKs
60- Auth flows or user identity management
61
62## How to use this skill (for a coding agent)
63
641. **Recognize MCP context**
65 - If you can call tools like `queryMysqlDatabase`, `manageMysqlDatabase`, `queryPermissions`, `managePermissions`, you are in MCP context.
66 - In this context, **never initialize SDKs for CloudBase Relational Database**; use MCP tools instead.
67
682. **Pick the right tool for the job**
69 - Read-only SQL and provisioning status checks -> `queryMysqlDatabase`
70 - MySQL provisioning, MySQL destruction, write SQL, DDL, schema initialization -> `manageMysqlDatabase`
71 - Inspect permissions -> `queryPermissions(action="getResourcePermission")`
72 - Change permissions -> `managePermissions(action="updateResourcePermission")`
73
743. **Always be explicit about safety**
75 - Before destructive operations (DELETE, DROP, etc.), summarize what you are about to run and why.
76 - Prefer `queryMysqlDatabase(action="getInstanceInfo")` or a read-only SQL check before writes.
77 - Provisioning or destroying MySQL requires explicit confirmation because both actions have environment-level impact.
78
79---
80
81## Available MCP tools (CloudBase Relational Database)
82
83These tools are the supported way to interact with CloudBase Relational Database via MCP:
84
85### 1. `queryMysqlDatabase`
86
87- **Purpose:** Query SQL data and provisioning state.
88- **Use for:**
89 - Running `SELECT` and other read-only SQL queries with `action="runQuery"`
90 - Checking whether MySQL already exists with `action="getInstanceInfo"` (lifecycle only — no connection credentials)
91 - Inspecting asynchronous provisioning progress with `action="describeCreateResult"` or `action="describeTaskStatus"`
92 - **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`.
93
94**Example flow:**
95
96```json
97{
98 "action": "runQuery",
99 "sql": "SELECT id, email FROM users ORDER BY created_at DESC LIMIT 50"
100}
101```
102
103**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.
104
105### 2. `manageMysqlDatabase`
106
107- **Purpose:** Manage SQL lifecycle and execute mutating SQL.
108- **Use for:**
109 - Provisioning MySQL with `action="provisionMySQL"`
110 - Destroying MySQL with `action="destroyMySQL"`
111 - Executing `INSERT`, `UPDATE`, `DELETE`, `CREATE TABLE`, `ALTER TABLE`, `DROP TABLE` with `action="runStatement"`
112 - Initializing tables and indexes with `action="initializeSchema"`
113
114**Important:** When creating a new table, you **must** include the `_openid` column for per-user access control:
115
116```sql
117_openid VARCHAR(64) DEFAULT '' NOT NULL
118```
119
120Note: 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.
121
122Before calling this tool, **confirm**:
123
124- The current environment has a ready MySQL instance, or you have just provisioned one.
125- The target tables and conditions are correct.
126- You have run a corresponding read-only query when appropriate.
127
128When destroying MySQL, confirm:
129
130- The current environment really should lose the SQL instance.
131- You have explicit confirmation for the destructive action.
132- You are prepared to query `describeTaskStatus` afterward to inspect the destroy result.
133
134### 3. `queryPermissions`
135
136- **Purpose:** Read permission configuration for a given SQL table.
137- **Use for:**
138 - Understanding who can read/write a table
139 - Auditing permissions on sensitive tables
140 - Call shape: `queryPermissions(action="getResourcePermission", resourceType="sqlDatabase", resourceId="<tableName>")`
141
142### 4. `managePermissions`
143
144- **Purpose:** Set or update permissions for a given SQL table.
145- **Use for:**
146 - Hardening access to sensitive data
147 - Opening up read access while restricting writes
148 - Updating resource-level permission configuration
149 - Call shape: `managePermissions(action="updateResourcePermission", resourceType="sqlDatabase", resourceId="<tableName>", permission="READONLY")`
150
151## Compatibility
152
153- Canonical plugin name: `permissions`
154- Legacy plugin aliases `security-rule`, `security-rules`, `secret-rule`, `secret-rules`, and `access-control` are still routed to `permissions`
155- Legacy tools `readSecurityRule` and `writeSecurityRule` are removed; always use `queryPermissions` and `managePermissions`
156
157---
158
159## Recommended lifecycle flow
160
161### Scenario 1: MySQL is not provisioned yet
162
1631. Call `queryMysqlDatabase(action="getInstanceInfo")`.
1642. If no instance exists, call `manageMysqlDatabase(action="provisionMySQL", confirm=true)`.
1653. Poll provisioning status with:
166 - `queryMysqlDatabase(action="describeCreateResult")`
167 - `queryMysqlDatabase(action="describeTaskStatus")`
1684. Only continue when the returned lifecycle status is `READY`.
1695. For MySQL provisioning, prefer `describeCreateResult`; reserve `describeTaskStatus` for destroy flows whose task response carries `TaskName`.
170
171### Scenario 2: Safely inspect data in a table
172
1731. Use `queryMysqlDatabase(action="runQuery")` with a limited `SELECT`.
1742. Include `LIMIT` and relevant filters.
1753. Review the result set and confirm it matches expectations before any write operation.
176
177### Scenario 3: Apply schema initialization after provisioning
178
1791. Confirm MySQL is ready.
1802. Prepare ordered DDL statements.
1813. Run them through `manageMysqlDatabase(action="initializeSchema")`.
1824. After creating tables, verify permissions with `queryPermissions` or `managePermissions`.
183
184### Scenario 4: Execute a targeted write or DDL change
185
1861. Use `queryMysqlDatabase(action="runQuery")` to inspect current data or schema if needed.
1872. Run the mutation once with `manageMysqlDatabase(action="runStatement")`.
1883. Validate with another read-only query or by checking security rules.
189
190### Scenario 5: Destroy MySQL when the environment no longer needs it
191
1921. Use `queryMysqlDatabase(action="getInstanceInfo")` to confirm the current environment still has a SQL instance.
1932. Call `manageMysqlDatabase(action="destroyMySQL", confirm=true)`.
1943. Query `queryMysqlDatabase(action="describeTaskStatus")` until the destroy task completes or fails.
1954. If the task succeeds, optionally call `queryMysqlDatabase(action="getInstanceInfo")` to confirm the instance no longer exists.
1965. If the task fails, treat the returned error as the terminal result and let the caller decide whether to retry.
197
198---
199
200## Key principle: MCP tools vs SDKs
201
202- **MCP tools** are for **agent operations** and **database management**:
203 - Provision MySQL.
204 - Destroy MySQL.
205 - Poll lifecycle state.
206 - Run ad-hoc SQL.
207 - Inspect and change resource permissions.
208 - Do not depend on application auth state.
209
210- **SDKs** are for **application code**:
211 - Frontend Web apps -> Web Relational Database skill.
212 - Backend Node apps -> Node Relational Database quickstart.
213
214When 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.