drop_database
Delete a MySQL database to remove its structure and data. Use this tool to permanently eliminate databases from your MySQL server.
Instructions
Drop/delete a database
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| database | Yes | Database name |
Implementation Reference
- src/index.ts:475-491 (handler)Handler function that executes the drop_database tool: obtains database pool, executes DROP DATABASE query, and returns success response with structured content.async ({ database }) => { const p = await getPool(); await p.execute(`DROP DATABASE \`${database}\``); const output = { success: true, database }; return { content: [ { type: "text" as const, text: `Database ${database} dropped successfully`, }, ], structuredContent: output, }; }
- src/index.ts:472-474 (schema)Input schema using Zod, defining the required 'database' string parameter.{ database: z.string().describe("Database name"), },
- src/index.ts:469-492 (registration)Registration of the 'drop_database' tool via server.tool(), specifying name, description, input schema, and inline handler function.server.tool( "drop_database", "Drop/delete a database", { database: z.string().describe("Database name"), }, async ({ database }) => { const p = await getPool(); await p.execute(`DROP DATABASE \`${database}\``); const output = { success: true, database }; return { content: [ { type: "text" as const, text: `Database ${database} dropped successfully`, }, ], structuredContent: output, }; } );