Skip to main content
Glama

execute_japan_megabank_sql

Read-onlyIdempotent

Run read-only DuckDB SQL SELECT queries across 155 Japanese public datasets to aggregate, group, and join records by municipality or corporate number.

Instructions

Execute a read-only DuckDB SQL SELECT query across all 155 mounted datasets (10.16M+ records). Enables complex aggregations (COUNT, SUM, AVG, GROUP BY) and multi-table JOINs using 'municipality_code' (5-digit JIS code) or 'corporate_number' (13-digit ID). Enforces AST validation (single SELECT only, max 10,000 rows). PREREQUISITE: Requires a MEGA tier subscription on RapidAPI or local database access; always call 'describe_japan_dataset' first to confirm table and column names. WHEN NOT TO USE: Do not use for simple single-table keyword or prefecture lookups (use 'search_japan_official_data' instead, which works on all tiers including BASIC) or for browsing available tables (use 'list_japan_datasets').

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYesSingle read-only DuckDB SQL SELECT statement. DDL/DML statements are rejected. Always include a LIMIT clause (e.g., 'SELECT prefecture_en, COUNT(*) AS cnt FROM medical GROUP BY 1 ORDER BY 2 DESC LIMIT 10').

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
rowsNoList of result row objects mapped by column name.
columnsNoOrdered list of column names in the query result.
row_countNoNumber of result rows returned by the SQL query.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changedv1.0.4
    • addedInput schema / additionalProperties
      Added value: +false
    • changedInput schema / properties / sql / description
      Previous value: -"Read-only SQL SELECT query (e.g., SELECT prefecture, count(*) AS cnt FROM medical GROUP BY 1 ORDER BY 2 DESC LIMIT 10)."New value: +"Single read-only DuckDB SQL SELECT statement. DDL/DML statements are rejected. Always include a LIMIT clause (e.g., 'SELECT prefecture_en, COUNT(*) AS cnt FROM medical GROUP BY 1 ORDER BY 2 DESC LIMIT 10')."
    • addedOutput schema / properties / columns / description
      Added value: +"Ordered list of column names in the query result."
    • addedOutput schema / properties / row_count / description
      Added value: +"Number of result rows returned by the SQL query."
    • addedOutput schema / properties / rows / description
      Added value: +"List of result row objects mapped by column name."
  2. First observedv0.1.0

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already declare readOnly/idempotent/non-destructive, so the bar is lower, yet the description adds real operational context beyond them: AST validation, single-SELECT enforcement, a 10,000-row cap, and an auth/tier prerequisite. These are constraints an agent cannot infer from the annotations or schema.

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

Conciseness4/5

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

Dense but front-loaded, with the core purpose first and labeled PREREQUISITE / WHEN NOT TO USE sections that scan well. It is on the long side and packs several facts per sentence, but each sentence carries distinct, actionable information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a one-parameter, high-complexity query tool with an output schema already defined, this covers everything an agent needs: capability scope, join keys, row/statement limits, tier prerequisite, and sibling routing. No return-value explanation is required given the output schema.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3, but the description adds genuine meaning the schema lacks: the join keys 'municipality_code' (5-digit JIS) and 'corporate_number' (13-digit ID) and the read-only SELECT-only constraint. It stops short of documenting the LIMIT/validation interaction in detail, keeping it at 4.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Execute a read-only DuckDB SQL SELECT query') plus concrete scope (155 mounted datasets, 10.16M+ records) and capability envelope (aggregations, JOINs). It also distinguishes itself from siblings by naming search_japan_official_data and list_japan_datasets as the tools for other jobs.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly routes the agent: a labeled PREREQUISITE block (MEGA tier or local DB, call describe_japan_dataset first) and a labeled WHEN NOT TO USE block that names two alternatives and the conditions selecting them. Nothing about when to pick this tool is left to inference.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.