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.

Instructions

Drop an index from a table

Input Schema

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

Implementation Reference

  • The handler function for the 'drop_index' tool. It retrieves a database pool, constructs the table name (optionally with database), executes the SQL DROP INDEX command, prepares a success output object, and returns an MCP-formatted response with text content and structured data.
    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 input schema defining parameters for the 'drop_index' tool: required table and indexName strings, optional database string.
    { 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 registration call for the 'drop_index' tool, including 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