Skip to main content
Glama
miyamamoto

JVLink MCP Server

by miyamamoto

get_column_examples

Retrieve sample values from a specified column in a table to understand the data format and content.

Instructions

特定カラムの値の例を取得(データ形式理解用)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
table_nameYes
column_nameYes
limitNo

Implementation Reference

  • Core implementation of get_column_value_examples - the actual database query logic that retrieves unique column values grouped by count, with validation of table/column names and a limit parameter.
    def get_column_value_examples(
        db_connection,
        table_name: str,
        column_name: str,
        limit: int = 10
    ) -> Dict[str, Any]:
        """特定カラムの値の例を取得
    
        Args:
            db_connection: DatabaseConnectionインスタンス
            table_name: テーブル名
            column_name: カラム名
            limit: 取得する値の種類数
    
        Returns:
            dict: {
                'column_name': カラム名,
                'unique_values': ユニークな値のリスト,
                'value_counts': 値ごとの件数(上位10件)
            }
        """
        validate_identifier(table_name, "table name")
        validate_identifier(column_name, "column name")
    
        # テーブル名・カラム名のホワイトリスト検証
        valid_tables = db_connection.get_tables()
        if table_name not in valid_tables:
            return {"table_name": table_name, "column_name": column_name, "error": f"テーブル '{table_name}' は存在しません。"}
    
        try:
            schema_df = db_connection.get_table_schema(table_name)
            valid_columns = set(schema_df["column_name"].tolist())
            if column_name not in valid_columns:
                return {"table_name": table_name, "column_name": column_name, "error": f"カラム '{column_name}' は存在しません。"}
        except Exception as e:
            return {"table_name": table_name, "column_name": column_name, "error": str(e)}
    
        # limit上限
        limit = min(max(1, limit), 100)
    
        # ユニーク値取得
        sql = f"""
        SELECT {column_name}, COUNT(*) as cnt
        FROM {table_name}
        WHERE {column_name} IS NOT NULL AND {column_name} != ''
        GROUP BY {column_name}
        ORDER BY cnt DESC
        LIMIT {limit}
        """
    
        try:
            df = db_connection.execute_safe_query(sql)
    
            return {
                "table_name": table_name,
                "column_name": column_name,
                "unique_values": df[column_name].tolist(),
                "value_counts": df.to_dict(orient="records"),
                "description": _get_column_description(table_name, column_name),
            }
        except Exception as e:
            return {
                "table_name": table_name,
                "column_name": column_name,
                "error": str(e),
            }
  • MCP tool registration of 'get_column_examples' using @mcp.tool() decorator. Delegates to _get_column_value_examples (imported from sample_data_provider).
    @mcp.tool()
    def get_column_examples(table_name: str, column_name: str, limit: int = 10) -> dict:
        """特定カラムの値の例を取得(データ形式理解用)"""
        with DatabaseConnection() as db:
            return _get_column_value_examples(
                db, table_name=table_name,
                column_name=column_name, limit=limit
            )
  • Import of get_column_value_examples from sample_data_provider, aliased as _get_column_value_examples.
    from .database.sample_data_provider import (
        get_sample_data as _get_sample_data,
        get_column_value_examples as _get_column_value_examples,
        get_data_snapshot as _get_data_snapshot,
    )
  • Helper function _get_column_description used within get_column_value_examples to look up column descriptions.
    def _get_column_description(table_name: str, column_name: str) -> str:
        """カラムの説明を取得"""
        descriptions = _get_column_info(table_name)
        return descriptions.get(column_name, "説明なし")
  • Module __all__ exports, listing get_column_value_examples as a public interface.
    __all__ = [
        "get_sample_data",
        "get_column_value_examples",
        "get_data_snapshot",
        "IMPORTANT_COLUMNS",
        "clear_cache",
    ]
Behavior2/5

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

No annotations are provided, so the description carries full responsibility. It only states 'get examples' without disclosing behavioral traits like the effect of the limit parameter, ordering of results, required permissions, or the response format. This is insufficient for a data retrieval tool.

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

Conciseness5/5

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

The description is a single sentence with no redundancy. Every word contributes meaning, making it appropriately sized and front-loaded.

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

Completeness3/5

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

Given the tool's simplicity (3 parameters, no output schema), the description covers the basic purpose but omits important details like the limit parameter's role and the return format. It is missing nuanced context that would fully guide an agent.

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?

The input schema has 3 parameters with titles but no descriptions (0% coverage). The description does not elaborate on any parameter, adding no semantic value beyond the schema. While parameter names are self-explanatory, the description fails to compensate for the lack of schema descriptions.

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?

The description clearly states it retrieves examples of column values for understanding data format. The verb 'get' and resource 'column value examples' are specific. It distinguishes from sibling tools like get_table_sample_data which retrieve multiple rows/columns.

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

Usage Guidelines3/5

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

The description includes a use case ('for understanding data format') but does not provide explicit guidance on when to use this tool versus alternatives such as get_table_sample_data or get_database_schema. No exclusions or when-not-to-use criteria are mentioned.

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