Skip to main content
Glama

execute_sql

Execute SQL queries on the sqlserver_local database to retrieve and manage data, with results returned as JSON for integration and analysis.

Instructions

Execute SQL query on the 'sqlserver_local' database. Returns query results as JSON.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYesSQL query or multiple SQL statements to execute

Implementation Reference

  • The handler function for the 'execute_sql' tool. Currently a stub that returns a placeholder response indicating the actual SQL execution is not yet implemented.
    async (args) => {
      // TODO: Implement actual SQL execution with database connector
      return createToolSuccessResponse({
        message: `SQL execution on '${sourceId}' not yet implemented`,
        sql: args.sql,
        source_id: sourceId,
        note: "Database connector integration pending",
      });
    }
  • Input schema definition for the 'execute_sql' tool using Zod, specifying a single 'sql' string parameter.
    {
      sql: z.string().describe("SQL query or multiple SQL statements to execute"),
    },
  • src/server.ts:116-131 (registration)
    Registration of the 'execute_sql' tool (with optional source suffix) in the registerTools function, called for each configured database source.
    server.tool(
      `execute_sql${toolSuffix}`,
      `Execute SQL query on the '${sourceId}' database. Returns query results as JSON.`,
      {
        sql: z.string().describe("SQL query or multiple SQL statements to execute"),
      },
      async (args) => {
        // TODO: Implement actual SQL execution with database connector
        return createToolSuccessResponse({
          message: `SQL execution on '${sourceId}' not yet implemented`,
          sql: args.sql,
          source_id: sourceId,
          note: "Database connector integration pending",
        });
      }
    );
  • Type definition listing 'execute_sql' as one of the built-in database tools.
    export const BUILTIN_DATABASE_TOOLS = [
      "execute_sql",
      "search_objects", // For database schema search
    ] as const;
  • Helper function used by the execute_sql handler to format successful tool responses as JSON text content.
    function createToolSuccessResponse(data: any) {
      return {
        content: [
          {
            type: "text" as const,
            text: JSON.stringify(data, null, 2),
          },
        ],
      };
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the database target and JSON output format but lacks critical details: whether queries can be read/write, if there are transaction or timeout limits, authentication requirements, error handling, or safety warnings about destructive operations. This is inadequate for a tool that executes arbitrary SQL.

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 extremely concise and front-loaded, consisting of two clear sentences that directly state the tool's purpose and output. Every word earns its place with zero redundancy, making it easy for an agent 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 complexity of executing arbitrary SQL (potentially destructive operations), no annotations, and no output schema, the description is incomplete. It omits essential context like safety warnings, permissions needed, result structure details beyond 'JSON', and limitations. This leaves significant gaps for an agent to use the tool effectively and safely.

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 single parameter 'sql' documented in the schema as 'SQL query or multiple SQL statements to execute'. The description adds no additional meaning beyond this, such as syntax examples, supported SQL dialects, or constraints on query complexity. Baseline 3 is appropriate since the schema does the heavy lifting.

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

Purpose5/5

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

The description clearly states the specific action ('Execute SQL query'), target resource ('on the 'sqlserver_local' database'), and outcome ('Returns query results as JSON'). It uses precise language that distinguishes it from sibling tools like search_db_objects or get_object, which likely perform different operations on databases or objects.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., database connectivity), exclusions (e.g., avoid for read-only vs. write queries), or compare it to sibling tools like search_db_objects, leaving the agent to infer usage context independently.

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/zq940222/hybrid-mcp'

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