Skip to main content
Glama
Atomzzm
by Atomzzm

query

Execute SELECT queries on MySQL databases to retrieve data using SQL statements with optional parameters for dynamic filtering.

Instructions

Execute a SELECT query

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYesSQL SELECT query
paramsNoQuery parameters (optional)

Implementation Reference

  • The main handler function for the 'query' tool, which executes SELECT queries on the MySQL database after validation.
    private async handleQuery(args: any) {
      await this.ensureConnection();
    
      if (!args.sql) {
        throw new McpError(ErrorCode.InvalidParams, 'SQL query is required');
      }
    
      if (!args.sql.trim().toUpperCase().startsWith('SELECT')) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Only SELECT queries are allowed with query tool'
        );
      }
    
      try {
        const [rows] = await this.connection!.query(args.sql, args.params || []);
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(rows, null, 2),
            },
          ],
        };
      } catch (error) {
        throw new McpError(
          ErrorCode.InternalError,
          `Query execution failed: ${getErrorMessage(error)}`
        );
      }
    }
  • The tool definition including name, description, and input schema for the 'query' tool in the listTools response.
    {
      name: 'query',
      description: 'Execute a SELECT query',
      inputSchema: {
        type: 'object',
        properties: {
          sql: {
            type: 'string',
            description: 'SQL SELECT query',
          },
          params: {
            type: 'array',
            items: {
              type: ['string', 'number', 'boolean', 'null'],
            },
            description: 'Query parameters (optional)',
          },
        },
        required: ['sql'],
      },
    },
  • src/index.ts:197-198 (registration)
    The switch case that routes the 'query' tool call to the handleQuery function.
    case 'query':
      return await this.handleQuery(request.params.arguments);
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. 'Execute a SELECT query' implies a read-only operation that returns data, but it doesn't disclose critical behaviors like whether it requires authentication, has rate limits, returns results in a specific format (e.g., JSON, table), handles large result sets, or what happens on SQL errors. This leaves significant gaps for an agent to use it correctly.

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 at three words, front-loading the core purpose with zero wasted text. Every word ('Execute', 'SELECT', 'query') earns its place by contributing essential information about the tool's function.

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 database queries (which involves SQL syntax, result handling, and potential errors), the description is incomplete. With no annotations, no output schema, and minimal behavioral disclosure, an agent lacks sufficient context to use this tool effectively. The description doesn't compensate for the missing structured information about what the tool returns or how it behaves.

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?

The schema description coverage is 100%, with both parameters ('sql' and 'params') clearly documented in the schema. The description adds no additional semantic meaning beyond what the schema provides (e.g., no examples of SQL syntax, no explanation of how params bind to placeholders). Since the schema does the heavy lifting, the baseline score of 3 is appropriate.

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 'Execute a SELECT query' clearly states the action (execute) and resource (SELECT query), making the purpose immediately understandable. It distinguishes from siblings like 'connect_db' (connection management) and 'describe_table' (metadata querying), though it doesn't explicitly differentiate from 'execute' which might handle non-SELECT queries.

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 like 'execute' (which might handle INSERT/UPDATE/DELETE) or 'list_tables' (which might provide table listings). There's no mention of prerequisites (e.g., requires database connection), error conditions, or typical use cases for SELECT queries.

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/Atomzzm/mcp-mysql-server'

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