execute_sql
Execute SQL statements against MySQL for queries, inserts, updates, deletes, and schema inspection. Supports cross-database queries via fully qualified names and requires explicit confirmation for write operations.
Instructions
Execute a SQL statement against the MySQL server. Use for SELECT, DML (INSERT/UPDATE/DELETE), SHOW, DESCRIBE, and ad-hoc queries. Supports cross-database queries using database.table notation. Single statements only — use fully qualified names instead of USE statements. Write/delete statements require user confirmation: depending on the client, either a confirmation prompt appears, or the first call returns a confirm_token — show the SQL to the user, and after explicit consent re-call with the same query plus confirm_token. Use the optional alias parameter to target a different configured database within a single connection.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| alias | No | 数据库别名,或管理页面 /admin 中为该库配置的项目名称(项目文件夹名)。在单个 SSE 连接内通过此参数切换不同库;省略时用连接 URL ?alias 指定的别名或默认别名。建议优先传当前项目文件夹名自动匹配对应数据库。 | |
| query | Yes | The SQL statement to execute. Single statements only. | |
| confirm_token | No | One-time confirmation token returned by a previous write attempt. Pass it with the SAME query after the user explicitly approved the SQL. |