keiba_data_search
Search and analyze Japanese horse racing data using SQL queries to access race results, odds, pedigrees, and training information for custom analysis.
Instructions
SQLで競馬データを自由に検索・分析できる万能ツール
人気別成績、騎手成績などの専用ツールでカバーできない分析はこのツールで実行できます。
レース結果、オッズ、血統、調教など、あらゆる競馬データにアクセス可能です。
Args:
sql_query: 実行するSQLクエリ(SELECTのみ)
Returns:
クエリ実行結果Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql_query | Yes |
Implementation Reference
- src/jvlink_mcp_server/server.py:387-416 (handler)The tool "keiba_data_search" is implemented as the `execute_safe_query` function, which accepts a SQL query, performs auto-correction, executes it against the database, and returns the result.
@mcp.tool(name="keiba_data_search") def execute_safe_query(sql_query: str) -> dict: """SQLで競馬データを自由に検索・分析できる万能ツール 人気別成績、騎手成績などの専用ツールでカバーできない分析はこのツールで実行できます。 レース結果、オッズ、血統、調教など、あらゆる競馬データにアクセス可能です。 Args: sql_query: 実行するSQLクエリ(SELECTのみ) Returns: クエリ実行結果 """ try: # Auto-correct query (zero-padding etc.) corrected_sql, corrections = auto_correct_query(sql_query) with DatabaseConnection() as db: result_df = db.execute_safe_query(corrected_sql) result = { "success": True, "rows": len(result_df), "columns": result_df.columns.tolist(), "data": result_df.head(100).to_dict(orient="records"), "note": "最大100行まで表示" if len(result_df) > 100 else None } # Notify if auto-corrections were made if corrections: