Skip to main content
Glama
nilsir

MCP Server MySQL

by nilsir

drop_index

Remove an index from a MySQL database table to optimize storage or modify table structure. Specify the table name and index to delete.

Instructions

Drop an index from a table

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tableYesTable name
indexNameYesIndex name
databaseNoDatabase name (optional)

Implementation Reference

  • The asynchronous handler function that executes the logic to drop the specified index from the table using the database connection pool.
    async ({ table, indexName, database }) => { const p = await getPool(); const tableName = database ? `\`${database}\`.\`${table}\`` : `\`${table}\``; await p.execute(`DROP INDEX \`${indexName}\` ON ${tableName}`); const output = { success: true, table, indexName, database: database || null, }; return { content: [ { type: "text" as const, text: `Index ${indexName} dropped from ${table}`, }, ], structuredContent: output, }; }
  • Zod schema defining the input parameters for the drop_index tool: table, indexName, and optional database.
    { table: z.string().describe("Table name"), indexName: z.string().describe("Index name"), database: z.string().optional().describe("Database name (optional)"), },
  • src/index.ts:563-595 (registration)
    The server.tool() call that registers the drop_index tool, including its name, description, input schema, and inline handler function.
    // Tool: drop_index server.tool( "drop_index", "Drop an index from a table", { table: z.string().describe("Table name"), indexName: z.string().describe("Index name"), database: z.string().optional().describe("Database name (optional)"), }, async ({ table, indexName, database }) => { const p = await getPool(); const tableName = database ? `\`${database}\`.\`${table}\`` : `\`${table}\``; await p.execute(`DROP INDEX \`${indexName}\` ON ${tableName}`); const output = { success: true, table, indexName, database: database || null, }; return { content: [ { type: "text" as const, text: `Index ${indexName} dropped from ${table}`, }, ], 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