Skip to main content
Glama
nilsir

MCP Server MySQL

by nilsir

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
NameRequiredDescriptionDefault
databaseYesDatabase name

Implementation Reference

  • 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,
      };
    }
  • 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,
        };
      }
    );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/nilsir/mcp-server-mysql'

If you have feedback or need assistance with the MCP directory API, please join our Discord server