Skip to main content
Glama

drop_table

Remove a specified table from the MSSQL Database using the "MSSQL MCP Server" tool. Simplify database management by executing table deletion tasks via natural language commands.

Instructions

Drops a table from the MSSQL Database.

Input Schema

NameRequiredDescriptionDefault
tableNameYesName of the table to drop

Input Schema (JSON Schema)

{ "properties": { "tableName": { "description": "Name of the table to drop", "type": "string" } }, "required": [ "tableName" ], "type": "object" }

Implementation Reference

  • The main handler function that executes the drop table logic, including validation and MSSQL query execution.
    async run(params: any) { try { const { tableName } = params; // Basic validation to prevent SQL injection if (!/^[\w\d_]+$/.test(tableName)) { throw new Error("Invalid table name."); } const query = `DROP TABLE [${tableName}]`; await new sql.Request().query(query); return { success: true, message: `Table '${tableName}' dropped successfully.` }; } catch (error) { console.error("Error dropping table:", error); return { success: false, message: `Failed to drop table: ${error}` }; } }
  • Input schema defining the required 'tableName' parameter for the tool.
    inputSchema = { type: "object", properties: { tableName: { type: "string", description: "Name of the table to drop" } }, required: ["tableName"], } as any;
  • src/index.ts:109-113 (registration)
    Registration of dropTableTool in the list of available tools returned by ListToolsRequestSchema handler.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: isReadOnly ? [listTableTool, readDataTool, describeTableTool] // todo: add searchDataTool to the list of tools available in readonly mode once implemented : [insertDataTool, readDataTool, describeTableTool, updateDataTool, createTableTool, createIndexTool, dropTableTool, listTableTool], // add all new tools here }));
  • src/index.ts:138-140 (registration)
    Dispatch to dropTableTool.run() in the CallToolRequestSchema switch statement.
    case dropTableTool.name: result = await dropTableTool.run(args); break;
  • Helper wrapper applied to dropTableTool to ensure SQL connection before execution.
    [insertDataTool, readDataTool, updateDataTool, createTableTool, createIndexTool, dropTableTool, listTableTool, describeTableTool].forEach(wrapToolRun);

Other Tools

Related Tools

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/EvilPhatBoi/McpSqlServer'

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