Skip to main content
Glama
EvilPhatBoi

MSSQL MCP Server

by EvilPhatBoi

drop_table

Remove a table from a Microsoft SQL Server database to manage schema changes or delete obsolete data structures.

Instructions

Drops a table from the MSSQL Database.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tableNameYesName of the table to drop

Implementation Reference

  • The `run` method implements the core logic of the drop_table tool: extracts tableName, validates it to prevent SQL injection, executes the DROP TABLE query using mssql, and returns a success or error response.
    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}`
        };
      }
    }
  • Defines the input schema for the drop_table tool, requiring a 'tableName' string parameter.
    inputSchema = {
      type: "object",
      properties: {
        tableName: { type: "string", description: "Name of the table to drop" }
      },
      required: ["tableName"],
    } as any;
  • src/index.ts:112-112 (registration)
    The dropTableTool instance is included in the array of tools advertised via ListToolsRequestHandler (non-readonly mode).
    : [insertDataTool, readDataTool, describeTableTool, updateDataTool, createTableTool, createIndexTool, dropTableTool, listTableTool], // add all new tools here
  • src/index.ts:138-140 (registration)
    Switch case in CallToolRequestHandler that dispatches calls to drop_table by invoking dropTableTool.run().
    case dropTableTool.name:
      result = await dropTableTool.run(args);
      break;
  • dropTableTool is wrapped with ensureSqlConnection before its run method is called.
    [insertDataTool, readDataTool, updateDataTool, createTableTool, createIndexTool, dropTableTool, listTableTool, describeTableTool].forEach(wrapToolRun);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It states the action ('Drops') but doesn't disclose critical behavioral traits: it's a destructive, irreversible operation that requires specific database permissions, removes all data and structure, and likely doesn't return meaningful output. This is inadequate for a high-risk tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste. It's front-loaded with the core action and resource, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the high complexity (destructive database operation) and lack of annotations or output schema, the description is incomplete. It fails to address risks, permissions, or output expectations, leaving significant gaps for safe and effective use by an AI agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with the parameter 'tableName' fully documented in the schema. The description adds no additional parameter semantics beyond what the schema provides, such as format examples or constraints. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Drops') and resource ('a table from the MSSQL Database'), making the purpose unambiguous. It doesn't explicitly distinguish from siblings like 'delete_data' or 'truncate_table' (if they existed), but among actual siblings, it's distinct enough as the only table-dropping operation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing admin permissions), consequences (e.g., irreversible data loss), or when to prefer other tools like 'delete_data' for removing rows instead of dropping the entire table.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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