Skip to main content
Glama
miyamamoto

JVLink MCP Server

by miyamamoto

execute_template_query

Generate and execute SQL queries from templates to analyze Japanese horse racing data, including race results, jockey performance, and track conditions.

Instructions

テンプレートからSQLを生成して実行

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
template_nameYes
paramsYes

Implementation Reference

  • The execute_template_query tool handler function, which renders a SQL template and executes the resulting query against the database.
    @mcp.tool()
    def execute_template_query(template_name: str, **params) -> dict:
        """テンプレートからSQLを生成して実行"""
        try:
            sql, query_params = render_template(template_name, **params)
            with DatabaseConnection() as db:
                result_df = db.execute_safe_query(sql, params=query_params)
                return {
                    "success": True,
                    "template": template_name,
                    "parameters": params,
                    "generated_sql": sql,
                    "query_params": list(query_params),
                    "rows": len(result_df),
                    "columns": result_df.columns.tolist(),
                    "data": result_df.head(100).to_dict(orient="records"),
                    "note": "max 100 rows" if len(result_df) > 100 else None
                }
        except ValueError as e:
            return {"success": False, "error": str(e), "hint": "Use list_query_templates to see available templates"}
        except Exception as e:
            return {"success": False, "error": str(e)}

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