Skip to main content
Glama
miyamamoto

JVLink MCP Server

by miyamamoto

validate_sql_query

Validates SQL queries for safety, providing verification results and security checks when querying Japanese horse racing data.

Instructions

SQLクエリの安全性を検証

Args:
    sql_query: 検証するSQLクエリ

Returns:
    検証結果と安全性チェック

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sql_queryYes

Implementation Reference

  • The handler function for the validate_sql_query tool. It checks whether a given SQL query is safe by scanning for dangerous keywords (DROP, DELETE, UPDATE, etc.) and verifying it contains SELECT.
    @mcp.tool()
    def validate_sql_query(sql_query: str) -> dict:
        """SQLクエリの安全性を検証
    
        Args:
            sql_query: 検証するSQLクエリ
    
        Returns:
            検証結果と安全性チェック
        """
        dangerous_keywords = [
            "DROP", "DELETE", "UPDATE", "INSERT", "CREATE", "ALTER",
            "TRUNCATE", "REPLACE", "MERGE", "GRANT", "REVOKE"
        ]
    
        query_upper = sql_query.upper()
        found_dangerous = [kw for kw in dangerous_keywords if kw in query_upper]
    
        is_safe = len(found_dangerous) == 0 and "SELECT" in query_upper
    
        return {
            "is_safe": is_safe,
            "query": sql_query,
            "dangerous_keywords_found": found_dangerous,
            "recommendation": "安全に実行可能" if is_safe else "危険なキーワードが含まれています",
            "can_execute": is_safe
        }
  • Registration of validate_sql_query as an MCP tool via the @mcp.tool() decorator. The tool name defaults to the function name 'validate_sql_query'.
    @mcp.tool()
  • Input schema: takes a single string parameter 'sql_query'. Output schema: returns a dict with is_safe (bool), query (str), dangerous_keywords_found (list), recommendation (str), can_execute (bool).
    Args:
        sql_query: 検証するSQLクエリ
    
    Returns:
        検証結果と安全性チェック
    """
    dangerous_keywords = [
        "DROP", "DELETE", "UPDATE", "INSERT", "CREATE", "ALTER",
        "TRUNCATE", "REPLACE", "MERGE", "GRANT", "REVOKE"
    ]
    
    query_upper = sql_query.upper()
    found_dangerous = [kw for kw in dangerous_keywords if kw in query_upper]
    
    is_safe = len(found_dangerous) == 0 and "SELECT" in query_upper
    
    return {
        "is_safe": is_safe,
        "query": sql_query,
        "dangerous_keywords_found": found_dangerous,
        "recommendation": "安全に実行可能" if is_safe else "危険なキーワードが含まれています",
        "can_execute": is_safe
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description must carry the full burden. It only mentions 'validation result and safety check' without specifying side effects, state changes, or whether it modifies data. The behavior is minimally disclosed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is short but mixes Japanese and English, and the structure (Args/Returns) is standard. It is not verbose, but the brevity sacrifices clarity. It earns its place but could be more explicit.

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 simplicity (1 param, no output schema), the description is incomplete. It does not explain what 'safety' entails, the format of the return, or how it relates to sibling tools. More context is needed for an agent to use it effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, yet the description only repeats the parameter name ('sql_query') without adding constraints, format, or meaning. It fails to compensate for the lack of schema documentation.

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 states 'Validate SQL query safety' which clearly indicates the verb (validate) and resource (SQL query). While it doesn't explicitly differentiate from siblings like execute_template_query, the purpose is specific enough for an AI agent.

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 vs alternatives like execute_template_query or other query-related tools. No context on prerequisites or when not to use it.

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/miyamamoto/jvlink-mcp-server'

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