Skip to main content
Glama
madhukarkumar

SingleStore MCP Server

run_read_query

Execute a SELECT query on a SingleStore database to retrieve data. This tool performs read-only operations, ensuring secure and efficient data access.

Instructions

Execute a read-only (SELECT) query on the database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSQL SELECT query to execute

Implementation Reference

  • The handler for 'run_read_query' tool. Validates input, ensures query is SELECT-only, executes on database, returns results as JSON text.
    case 'run_read_query': {
      if (!request.params.arguments || typeof request.params.arguments.query !== 'string') {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Query parameter must be a string'
        );
      }
    
      const query = request.params.arguments.query.trim().toLowerCase();
      if (!query.startsWith('select ')) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Only SELECT queries are allowed for this tool'
        );
      }
    
      try {
        const [rows] = await conn.query(request.params.arguments.query) as [mysql.RowDataPacket[], mysql.FieldPacket[]];
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(rows, null, 2),
            },
          ],
        };
      } catch (error: unknown) {
        const err = error as Error;
        throw new McpError(
          ErrorCode.InternalError,
          `Query error: ${err.message}`
        );
      }
    }
  • Input schema definition for run_read_query tool in MCP ListToolsRequestSchema response.
      name: 'run_read_query',
      description: 'Execute a read-only (SELECT) query on the database',
      inputSchema: {
        type: 'object',
        properties: {
          query: {
            type: 'string',
            description: 'SQL SELECT query to execute',
          },
        },
        required: ['query'],
      },
    },
  • src/index.ts:1224-1236 (registration)
    The run_read_query tool is registered here in the tools list returned by ListToolsRequestSchema handler.
      name: 'run_read_query',
      description: 'Execute a read-only (SELECT) query on the database',
      inputSchema: {
        type: 'object',
        properties: {
          query: {
            type: 'string',
            description: 'SQL SELECT query to execute',
          },
        },
        required: ['query'],
      },
    },
  • Duplicate schema definition for SSE/HTTP API tool listing.
      name: 'run_read_query',
      description: 'Execute a read-only (SELECT) query on the database',
      inputSchema: {
        type: 'object',
        properties: {
          query: {
            type: 'string',
            description: 'SQL SELECT query to execute',
          },
        },
        required: ['query'],
      },
    },
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 states 'read-only (SELECT)' which implies non-destructive and safe operations, but fails to address critical aspects like permissions needed, rate limits, error handling, or what the output looks like (e.g., result format, pagination). This leaves significant gaps for an agent to understand the tool's behavior.

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 that front-loads key information ('Execute a read-only (SELECT) query'). There is no wasted verbiage or redundancy, making it highly concise and well-structured for quick comprehension.

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?

For a database query tool with no annotations and no output schema, the description is incomplete. It lacks details on behavioral traits (e.g., security, performance), output format, and usage guidelines compared to siblings. While concise, it does not provide enough context for an agent to reliably use the tool without additional assumptions or trial-and-error.

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 input schema has 100% description coverage, with the 'query' parameter clearly documented as 'SQL SELECT query to execute'. The description adds no additional semantic details beyond this, such as syntax examples, supported SQL features, or constraints. Given the high schema coverage, a baseline score of 3 is appropriate as 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 ('Execute') and resource ('read-only (SELECT) query on the database'), making the purpose immediately understandable. It distinguishes from siblings like 'create_table' or 'optimize_sql' by specifying read-only SELECT operations, though it doesn't explicitly contrast with 'query_table' which might have overlapping functionality.

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

Usage Guidelines3/5

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

The description implies usage for executing SELECT queries, but provides no explicit guidance on when to use this tool versus alternatives like 'query_table' or 'optimize_sql'. It mentions 'read-only' which suggests safety, but lacks details on prerequisites, limitations, or specific scenarios where this tool is preferred.

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

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/madhukarkumar/singlestore-mcp-server'

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