Skip to main content
Glama
nilsir

MCP Server MySQL

by nilsir

drop_table

Delete a table from a MySQL database to remove unnecessary data structures or clean up schema. Specify the table name and optionally the database for targeted removal.

Instructions

Drop/delete a table

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tableYesTable name
databaseNoDatabase name (optional)

Implementation Reference

  • Handler function that executes DROP TABLE SQL command using the database pool.
    async ({ table, database }) => { const p = await getPool(); const tableName = database ? `\`${database}\`.\`${table}\`` : `\`${table}\``; await p.execute(`DROP TABLE ${tableName}`); const output = { success: true, table, database: database || null }; return { content: [ { type: "text" as const, text: `Table ${table} dropped successfully`, }, ], structuredContent: output, }; }
  • Input schema using Zod for table name and optional database.
    { table: z.string().describe("Table name"), database: z.string().optional().describe("Database name (optional)"), },
  • src/index.ts:409-434 (registration)
    Registration of the drop_table tool using server.tool method.
    server.tool( "drop_table", "Drop/delete a table", { table: z.string().describe("Table name"), database: z.string().optional().describe("Database name (optional)"), }, async ({ table, database }) => { const p = await getPool(); const tableName = database ? `\`${database}\`.\`${table}\`` : `\`${table}\``; await p.execute(`DROP TABLE ${tableName}`); const output = { success: true, table, database: database || null }; return { content: [ { type: "text" as const, text: `Table ${table} 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