Skip to main content
Glama

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

NameRequiredDescriptionDefault
queryYesSQL SELECT query to execute

Input Schema (JSON Schema)

{ "properties": { "query": { "description": "SQL SELECT query to execute", "type": "string" } }, "required": [ "query" ], "type": "object" }

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'], }, },

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