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