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),
          },
        ],
      };
    }

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