Skip to main content
Glama
IzumiSy

MCP Universal DB Client

analyzer.ts726 B
import parserPkg from "node-sql-parser"; const { Parser } = parserPkg; export type QueryType = "read" | "write"; const parser = new Parser(); const WRITE_OPERATIONS = new Set([ "insert", "update", "delete", "replace", "create", "alter", "drop", "truncate", "merge", "rename", ]); /** * SQLクエリのタイプを分析 */ export function analyzeQueryType(query: string): QueryType { const ast = parser.astify(query); // 複数のステートメントの場合は配列 const statements = Array.isArray(ast) ? ast : [ast]; for (const stmt of statements) { const type = stmt.type?.toLowerCase(); if (WRITE_OPERATIONS.has(type)) { return "write"; } } return "read"; }

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/IzumiSy/mcp-universal-db-client'

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